From c13fd6c40a2012236b7e1cb2c758ce946acdb38b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20Wei=C3=9F?= Date: Thu, 10 Nov 2005 13:29:05 +0000 Subject: [PATCH] big fix for ! search in cf :-) --- addressbook/inc/class.socontacts.inc.php | 35 ++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/addressbook/inc/class.socontacts.inc.php b/addressbook/inc/class.socontacts.inc.php index 5ba721d082..dc0d6f04d7 100755 --- a/addressbook/inc/class.socontacts.inc.php +++ b/addressbook/inc/class.socontacts.inc.php @@ -197,14 +197,43 @@ class socontacts $firstrun = true; foreach ((array)$criteria_extra as $extra_crit) { - $result = $this->soextra->search($extra_crit,true,'','',$wildcard); - if ($op == 'OR' && $result) + if($extra_crit[$this->extra_value]{0} == '!') + { + if(!isset($all_main_ids)) $all_main_ids = $this->somain->search(array($this->main_id => '*')); + $extra_crit[$this->extra_value] = substr($extra_crit[$this->extra_value],1); + $not_result = $this->soextra->search($extra_crit,true,'','',$wildcard); + if(is_array($not_result)) + { + $expr = '$not_result[0]'; + for($i=1; $imain_id],(array)$not_result[$this->extra_id]) === false) + { + $result[] = array( + $this->extra_id => $entry[$this->main_id], + $this->extra_key => $extra_crit[$this->extra_key], + ); + } + } + } + else + { + $result = $this->soextra->search($extra_crit,true,'','',$wildcard); + } + + if ($op == 'OR' && $result) { $resultextra = array_merge_recursive((array)$result,(array)$resultextra); } elseif ($op == 'AND') { - if (!$result) + if (!$result) { return false; //$resultextra = array();