"replace ambiguous auto-id with (an exact match of) table_name.autoid"

This commit is contained in:
Ralf Becker 2009-04-01 13:01:16 +00:00
parent 892e22a4a0
commit bfab75389c

View File

@ -387,6 +387,16 @@ class so_sql_cf extends so_sql
$this->db->quote('%'.$criteria[$this->extra_value].'%');
unset($criteria[$this->extra_value]);
$join .= $this->extra_join;
// replace ambiguous auto-id with (an exact match of) table_name.autoid
if (isset($criteria[$this->autoinc_id]))
{
if ((int)$criteria[$this->autoinc_id])
{
$criteria[] = $this->table_name.'.'.$this->autoinc_id.'='.(int)$criteria[$this->autoinc_id];
}
unset($criteria[$this->autoinc_id]);
}
}
// check if we order by a custom field --> join cf table for given cf and order by it's value
if (strpos($order_by,self::CF_PREFIX) !== false &&