Permalink
Browse files

BUGFIX: Use numeric literal for numeric less-than filter.

  • Loading branch information...
1 parent 0bdfc0c commit fece61c90bcad215b5c6e3867ba704edbce67d3d @sminnee sminnee committed Dec 17, 2011
Showing with 6 additions and 5 deletions.
  1. +6 −5 search/filters/LessThanFilter.php
@@ -14,11 +14,12 @@ class LessThanFilter extends SearchFilter {
*/
public function apply(DataQuery $query) {
$this->model = $query->applyRelation($this->relation);
- return $query->where(sprintf(
- "%s < '%s'",
- $this->getDbName(),
- Convert::raw2sql($this->getDbFormattedValue())
- ));
+ $value = $this->getDbFormattedValue();
+
+ if(is_numeric($value)) $filter = sprintf("%s < %s", $this->getDbName(), Convert::raw2sql($value));
+ else $filter = sprintf("%s < '%s'", $this->getDbName(), Convert::raw2sql($value));
+
+ return $query->where($filter);
}
public function isEmpty() {

0 comments on commit fece61c

Please sign in to comment.