backported a bugfixes from HEAD:

addressbook popup for email apps: adding all search results was not working with ldap (contacts_ldap class did not support the "!''" filter used)
This commit is contained in:
Ralf Becker 2005-11-04 07:05:07 +00:00
parent a5c24a7b3e
commit 550b6319f4

View File

@ -324,28 +324,24 @@
if($filter)
{
if($DEBUG) { echo 'DEBUG - Inbound filter is: #'.$filter.'#'; }
$filterarray = split(',',$filter);
if($filterarray[1])
foreach(explode(',',$filter) as $f)
{
$i=0;
for($i=0;$i<count($filterarray);$i++)
list($name,$value) = explode('=',$f,2);
if ($this->stock_contact_fields[$name])
{
list($name,$value) = split("=",$filterarray[$i]);
if($name)
{
if($DEBUG) { echo '<br>DEBUG - Filter strings: #'.$this->non_contact_fields[$name].'# => #'.$value.'#'; }
$filterfields[$this->non_contact_fields[$name]] = $value;
}
$filterfields[$this->stock_contact_fields[$name]] = $value;
}
}
else
{
list($name,$value) = split('=',$filter);
if($DEBUG)
elseif ($this->non_contact_fields[$name])
{
echo '<br>DEBUG - Filter strings: #'.$this->non_contact_fields[$name].'# => #'.$value.'#';
$filterfields[$this->non_contact_fields[$name]] = $value;
}
else
{
if ($DEBUG) echo "<p>contacts_ldap::read(filter=$filter): Cant filter for '$name', allowed only: ".implode(', ',array_keys($this->non_contact_fields))."</p>\n";
}
$filterfields = array($this->non_contact_fields[$name] => $value);
}
}
else
@ -528,6 +524,8 @@
/* Used by read() above to build the ldap filter string */
function makefilter($qarray,$extra='',$query='', $DEBUG=False)
{
if($DEBUG) echo "<p>contacts_ldap::makefilter(".print_r($qarray,true).",'$extra','$query')</p>\n";
if(!@is_array($qarray))
{
return $qarray;
@ -616,6 +614,10 @@
}
$aquery .= ')';
}
elseif ($value == "!''") // query for not empty
{
$aquery .= '(' . $name . '=*)';
}
else
{
$aquery .= '(' . $name . '=' . $value . ')';
@ -655,7 +657,6 @@
echo '<br>Will search in "' . $GLOBALS['phpgw_info']['server']['ldap_contact_context'] . '"';
}
// echo $fquery;
return $fquery;
}