mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-23 07:09:20 +01:00
"- allow more then one cf filter, gave sql error before
- allow to combine lettersearch with cf filter, gave sql error before"
This commit is contained in:
parent
db8b9cc428
commit
b5d3888f74
@ -15,7 +15,6 @@ include_once(EGW_INCLUDE_ROOT.'/etemplate/inc/class.so_sql.inc.php');
|
|||||||
/**
|
/**
|
||||||
* SQL storage object of the adressbook
|
* SQL storage object of the adressbook
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class socontacts_sql extends so_sql
|
class socontacts_sql extends so_sql
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -319,17 +318,27 @@ class socontacts_sql extends so_sql
|
|||||||
$join .= $this->extra_join_order.' AND extra_order.contact_name='.$this->db->quote(substr($val,1));
|
$join .= $this->extra_join_order.' AND extra_order.contact_name='.$this->db->quote(substr($val,1));
|
||||||
}
|
}
|
||||||
// do we filter by a cf?
|
// do we filter by a cf?
|
||||||
|
$extra_filter = '';
|
||||||
foreach($filter as $name => $val)
|
foreach($filter as $name => $val)
|
||||||
{
|
{
|
||||||
if ($name[0] == '#')
|
if ($name[0] == '#')
|
||||||
{
|
{
|
||||||
if (!empty($val)) // empty -> dont filter
|
if (!empty($val)) // empty -> dont filter
|
||||||
{
|
{
|
||||||
$join .= $this->extra_join_filter.' AND extra_filter.contact_name='.$this->db->quote(substr($name,1)).
|
$join .= str_replace('extra_filter','extra_filter'.$extra_filter,$this->extra_join_filter.' AND extra_filter.contact_name='.$this->db->quote(substr($name,1)).
|
||||||
' AND extra_filter.contact_value='.$this->db->quote($val);
|
' AND extra_filter.contact_value='.$this->db->quote($val));
|
||||||
|
++$extra_filter;
|
||||||
}
|
}
|
||||||
unset($filter[$name]);
|
unset($filter[$name]);
|
||||||
}
|
}
|
||||||
|
elseif($val[0] == '#') // lettersearch: #cfname like 's%'
|
||||||
|
{
|
||||||
|
list($cf) = explode(' ',$val);
|
||||||
|
$join .= str_replace('extra_filter','extra_filter'.$extra_filter,$this->extra_join_filter.' AND extra_filter.contact_name='.$this->db->quote(substr($cf,1)).
|
||||||
|
' AND '.str_replace($cf,'extra_filter.contact_value',$val));
|
||||||
|
++$extra_filter;
|
||||||
|
unset($filter[$name]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (isset($filter['list']))
|
if (isset($filter['list']))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user