Skip to content
This repository
Browse code

BUG Filter pages by LastEdited always returns an empty list

This is caused by the input date values entered by the user are passed into query without converting in a correct format first.
  • Loading branch information...
commit e5401668faa9cff780202cb492c7b5c772c35249 1 parent 8c1f622
Saophalkun Ponlu authored August 30, 2012

Showing 1 changed file with 4 additions and 2 deletions. Show diff stats Hide diff stats

  1. 6  code/controllers/CMSSiteTreeFilter.php
6  code/controllers/CMSSiteTreeFilter.php
@@ -194,11 +194,13 @@ public function pagesIncluded() {
194 194
 					break;
195 195
 
196 196
 				case 'LastEditedFrom':
197  
-					$query->where("\"LastEdited\" >= '$SQL_val'");
  197
+					$fromDate = new DateField(null, null, $SQL_val);
  198
+					$query->where("\"LastEdited\" >= '{$fromDate->dataValue()}'");
198 199
 					break;
199 200
 
200 201
 				case 'LastEditedTo':
201  
-					$query->where("\"LastEdited\" <= '$SQL_val'");
  202
+					$toDate = new DateField(null, null, $SQL_val);
  203
+					$query->where("\"LastEdited\" <= '{$toDate->dataValue()}'");
202 204
 					break;
203 205
 
204 206
 				case 'ClassName':

0 notes on commit e540166

Please sign in to comment.
Something went wrong with that request. Please try again.