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

This commit is contained in:
Sam Minnee 2011-12-17 16:32:45 +13:00
parent 0bdfc0c515
commit fece61c90b

View File

@ -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() {