forked from extern/egroupware
fixed sometimes (no customfields) wrong redirects and NOT calling the content-history
This commit is contained in:
parent
8f5f0953df
commit
062d4531e0
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user