diff --git a/addressbook/inc/class.bocontacts.inc.php b/addressbook/inc/class.bocontacts.inc.php index bf270dbfdf..f177b736bc 100755 --- a/addressbook/inc/class.bocontacts.inc.php +++ b/addressbook/inc/class.bocontacts.inc.php @@ -241,11 +241,11 @@ class bocontacts extends socontacts $data = parent::read($keys,$extra_cols,$join); if (!$data) { - return $content['msg'] = lang('something went wrong by reading this contact'); + return lang('something went wrong by reading this contact'); } if(!$this->check_perms(EGW_ACL_READ,$data)) { - return $content['msg'] = lang('you are not permittet to view this contact'); + return lang('you are not permittet to view this contact'); } // convert access into private for historical reasons diff --git a/addressbook/inc/class.socontacts.inc.php b/addressbook/inc/class.socontacts.inc.php index 7b12a2aa7f..6bac67aafe 100755 --- a/addressbook/inc/class.socontacts.inc.php +++ b/addressbook/inc/class.socontacts.inc.php @@ -111,15 +111,17 @@ class socontacts * @param array &$contact contact data from etemplate::exec * @return bool false if all went right */ - function delete(&$contact) + function delete($contact) { // delete mainfields - $ok_main = $this->somain->delete(array('id' => $contact['id'])); - - // delete customfields - $ok_extra = $this->soextra->delete(array($this->extra_id => $contact['id'])); - return !((bool)$ok_extra & (bool)$ok); - + if ($this->somain->delete(array('id' => $contact['id']))) + { + // delete customfields, can return 0 if there are no customfields + $this->soextra->delete(array($this->extra_id => $contact['id'])); + + return false; + } + return true; } /** diff --git a/addressbook/inc/class.uicontacts.inc.php b/addressbook/inc/class.uicontacts.inc.php index dcc632b0d8..918c810562 100644 --- a/addressbook/inc/class.uicontacts.inc.php +++ b/addressbook/inc/class.uicontacts.inc.php @@ -186,22 +186,21 @@ class uicontacts extends bocontacts $GLOBALS['egw']->redirect_link('/index.php','menuaction=addressbook.uiaddressbook.index'); case 'delete': - if(!$this->delete($content)) - { - $content['msg'] = lang('Something went wrong by deleting this contact'); - } - else - { - $GLOBALS['egw']->redirect_link('/index.php','menuaction=addressbook.uiaddressbook.index'); - } + $GLOBALS['egw']->redirect_link('/index.php',array( + 'menuaction' => 'addressbook.uiaddressbook.index', + 'msg' => $this->delete($content) ? lang('Something went wrong by deleting this contact') : lang('Contact deleted !!!'), + )); } } else { - $contact_id = $_GET['contact_id']; - if(!$contact_id) return false; - - $content = $this->read($contact_id); + if(!(int)$_GET['contact_id'] || !is_array($content = $this->read((int) $_GET['contact_id']))) + { + $GLOBALS['egw']->redirect_link('/index.php',array( + 'menuaction' => 'addressbook.uiaddressbook.index', + 'msg' => $content, + )); + } } foreach((array)$content as $key => $val) {