From a48b353c14b97e6ca4a82275868ffc50eceaa599 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 24 Jun 2006 16:03:00 +0000 Subject: [PATCH] link_title method returns now null to indicate an entry does not exist (and all links can be deleted) or false if there are insufficent rights to view the title --- addressbook/inc/class.bocontacts.inc.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/addressbook/inc/class.bocontacts.inc.php b/addressbook/inc/class.bocontacts.inc.php index 79f0d3e032..a2669fd6e2 100755 --- a/addressbook/inc/class.bocontacts.inc.php +++ b/addressbook/inc/class.bocontacts.inc.php @@ -442,14 +442,17 @@ class bocontacts extends socontacts * reads contacts matched by key and puts all cols in the data array * * @param int/string $contact_id - * @return array/boolean contact data or false on error + * @return array/boolean array with contact data, null if not found or false on no view perms */ function read($contact_id) { - $data = parent::read($contact_id); - if (!$data || !$this->check_perms(EGW_ACL_READ,$data)) + if (!($data = parent::read($contact_id))) { - return false; + return null; // not found + } + if (!$this->check_perms(EGW_ACL_READ,$data)) + { + return false; // no view perms } // determine the file-as type $data['fileas_type'] = $this->fileas_type($data); @@ -635,7 +638,7 @@ class bocontacts extends socontacts * Is called as hook to participate in the linking * * @param int/string/array $contact int/string id or array with contact - * @param string the title + * @param string/boolean string with the title, null if contact does not exitst, false if no perms to view it */ function link_title($contact) { @@ -645,9 +648,9 @@ class bocontacts extends socontacts } if (!is_array($contact)) { - return False; + return $contact; } - return $contact['n_fileas']; + return $contact['n_fileas'] ? $contact['n_fileas'] : $this->fileas($contact); } /**