Skip to content

Commit

Permalink
BUGFIX: Use numeric literal for numeric less-than filter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Minnee committed Dec 17, 2011
1 parent 0bdfc0c commit fece61c
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions search/filters/LessThanFilter.php
Expand Up @@ -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() {
Expand Down

0 comments on commit fece61c

Please sign in to comment.