From 7b2ab4f697e929364595421b55cf45e55600599a Mon Sep 17 00:00:00 2001 From: Miles Lott Date: Mon, 26 Mar 2001 02:00:47 +0000 Subject: [PATCH] Some more filtering fixes, I hope --- addressbook/inc/class.contacts_sql.inc.php | 15 ++++++++++++--- addressbook/inc/functions.inc.php | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/addressbook/inc/class.contacts_sql.inc.php b/addressbook/inc/class.contacts_sql.inc.php index 89b3b31757..52121bc3a5 100644 --- a/addressbook/inc/class.contacts_sql.inc.php +++ b/addressbook/inc/class.contacts_sql.inc.php @@ -295,6 +295,16 @@ // turn filter's a=b,c=d OR a=b into an array if ($filter) { + $extra_stock = array( + 'id' => 'id', + 'tid' => 'tid', + 'lid' => 'lid', + 'owner' => 'owner', + 'access' => 'access', + 'cat_id' => 'cat_id' + ); + $check_stock = $this->stock_contact_fields + $extra_stock; + if ($DEBUG) { echo "DEBUG - Inbound filter is: #".$filter."#"; } $filterarray = split(',',$filter); if ($filterarray[1]) { @@ -323,7 +333,6 @@ $isstd=0; if ($name && empty($value)) { if ($DEBUG) { echo "
DEBUG - filter field '".$name."' is empty (NULL)"; } - $check_stock = $this->stock_contact_fields + array('id' => 'id', 'tid' => 'tid', 'lid' => 'lid', 'owner' => 'owner', 'cat_id' => 'cat_id'); while (list($fname,$fvalue)=each($check_stock)) { if ($fvalue==$name) { $filterlist .= $name.' is NULL,'; @@ -332,8 +341,8 @@ } } } elseif($name && $value) { - reset($stock_fields); - while (list($fname,$fvalue)=each($stock_fields)) { + reset($check_stock); + while (list($fname,$fvalue)=each($check_stock)) { if ($fvalue==$name) { if (gettype($value) == "integer") { $filterlist .= $name."=".$value.","; diff --git a/addressbook/inc/functions.inc.php b/addressbook/inc/functions.inc.php index b82269e1df..7419aa91a9 100755 --- a/addressbook/inc/functions.inc.php +++ b/addressbook/inc/functions.inc.php @@ -170,7 +170,7 @@ } } - function addressbook_add_entry($userid,$fields,$access,$cat_id) { + function addressbook_add_entry($userid,$fields,$access='',$cat_id='') { global $this,$rights; if ($rights & PHPGW_ACL_ADD) { $this->add($userid,$fields,$access,$cat_id);