fixed sometimes (no customfields) wrong redirects and NOT calling the content-history

This commit is contained in:
Ralf Becker 2006-03-28 11:41:48 +00:00
parent 8f5f0953df
commit 062d4531e0
3 changed files with 22 additions and 21 deletions

View File

@ -241,11 +241,11 @@ class bocontacts extends socontacts
$data = parent::read($keys,$extra_cols,$join); $data = parent::read($keys,$extra_cols,$join);
if (!$data) 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)) 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 // convert access into private for historical reasons

View File

@ -111,15 +111,17 @@ class socontacts
* @param array &$contact contact data from etemplate::exec * @param array &$contact contact data from etemplate::exec
* @return bool false if all went right * @return bool false if all went right
*/ */
function delete(&$contact) function delete($contact)
{ {
// delete mainfields // delete mainfields
$ok_main = $this->somain->delete(array('id' => $contact['id'])); if ($this->somain->delete(array('id' => $contact['id'])))
{
// delete customfields // delete customfields, can return 0 if there are no customfields
$ok_extra = $this->soextra->delete(array($this->extra_id => $contact['id'])); $this->soextra->delete(array($this->extra_id => $contact['id']));
return !((bool)$ok_extra & (bool)$ok);
return false;
}
return true;
} }
/** /**

View File

@ -186,22 +186,21 @@ class uicontacts extends bocontacts
$GLOBALS['egw']->redirect_link('/index.php','menuaction=addressbook.uiaddressbook.index'); $GLOBALS['egw']->redirect_link('/index.php','menuaction=addressbook.uiaddressbook.index');
case 'delete': case 'delete':
if(!$this->delete($content)) $GLOBALS['egw']->redirect_link('/index.php',array(
{ 'menuaction' => 'addressbook.uiaddressbook.index',
$content['msg'] = lang('Something went wrong by deleting this contact'); 'msg' => $this->delete($content) ? lang('Something went wrong by deleting this contact') : lang('Contact deleted !!!'),
} ));
else
{
$GLOBALS['egw']->redirect_link('/index.php','menuaction=addressbook.uiaddressbook.index');
}
} }
} }
else else
{ {
$contact_id = $_GET['contact_id']; if(!(int)$_GET['contact_id'] || !is_array($content = $this->read((int) $_GET['contact_id'])))
if(!$contact_id) return false; {
$GLOBALS['egw']->redirect_link('/index.php',array(
$content = $this->read($contact_id); 'menuaction' => 'addressbook.uiaddressbook.index',
'msg' => $content,
));
}
} }
foreach((array)$content as $key => $val) foreach((array)$content as $key => $val)
{ {