Skip to content

Commit

Permalink
fixed issue when filtering on navigation groups with id values greate…
Browse files Browse the repository at this point in the history
…r then 10
  • Loading branch information
David McReynolds committed Sep 6, 2011
1 parent bf44fb1 commit a7e89db
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions fuel/modules/fuel/models/base_module_model.php
Expand Up @@ -204,11 +204,27 @@ function list_items($limit = NULL, $offset = 0, $col = 'id', $order = 'asc')

if (strtolower($this->filter_join) == 'and')
{
$this->db->like('LOWER('.$key.')', strtolower($val), 'both');
// do a direct match if the values are integers and have _id in them
if (preg_match('#_id#', $key) AND is_numeric($val))
{
$this->db->where(array($key => $val));
}
else
{
$this->db->like('LOWER('.$key.')', strtolower($val), 'both');
}
}
else
{
$this->db->or_like('LOWER('.$key.')', strtolower($val), 'both');
// do a direct match if the values are integers and have _id in them
if (preg_match('#_id#', $key) AND is_numeric($val))
{
$this->db->or_where(array($key => $val));
}
else
{
$this->db->or_like('LOWER('.$key.')', strtolower($val), 'both');
}
}
}
}
Expand All @@ -219,7 +235,6 @@ function list_items($limit = NULL, $offset = 0, $col = 'id', $order = 'asc')
$this->db->offset($offset);
$query = $this->db->get($this->table_name);
$data = $query->result_array();

return $data;
}

Expand Down

0 comments on commit a7e89db

Please sign in to comment.