Skip to content
This repository
Browse code

ENHANCEMENT: GreaterThanFilter should be consistent with LessThanFilter

Numeric or float values weren't supported.
  • Loading branch information...
commit 66dfa38d0a3f4dcd1f06e80e4e0e35a48d93bfea 1 parent e0e9634
unclecheese authored August 21, 2012

Showing 1 changed file with 6 additions and 5 deletions. Show diff stats Hide diff stats

  1. 11  search/filters/GreaterThanFilter.php
11  search/filters/GreaterThanFilter.php
@@ -14,11 +14,12 @@ class GreaterThanFilter extends SearchFilter {
14 14
 	 */
15 15
 	public function apply(DataQuery $query) {
16 16
 		$this->model = $query->applyRelation($this->relation);
17  
-		return $query->where(sprintf(
18  
-			"%s > '%s'",
19  
-			$this->getDbName(),
20  
-			Convert::raw2sql($this->getDbFormattedValue())
21  
-		));
  17
+		$value = $this->getDbFormattedValue();
  18
+
  19
+		if(is_numeric($value)) $filter = sprintf("%s > %s", $this->getDbName(), Convert::raw2sql($value));
  20
+		else $filter = sprintf("%s > '%s'", $this->getDbName(), Convert::raw2sql($value));
  21
+		
  22
+		return $query->where($filter);
22 23
 	}
23 24
 	
24 25
 	public function isEmpty() {

0 notes on commit 66dfa38

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