prevent the change of owner, if the entry to be changed is an account

This commit is contained in:
Klaus Leithoff 2010-10-06 15:30:07 +00:00
parent 2072920aae
commit b32eff2132

View File

@ -847,7 +847,13 @@ class addressbook_bo extends addressbook_so
// Get old record for tracking changes
$old = $this->data2db($this->read($contact['id']));
// IF THE OLD ENTRY IS A ACCOUNT, dont allow to change the owner/location
// maybe we need that for id and account_id as well.
if (is_array($old) && (!isset($old['owner']) || empty($old['owner'])))
{
error_log(__METHOD__.__LINE__." Trying to change account to owner:". $to_write['owner'].' Account affected:'.array2string($old).' Data send:'.array2string($to_write));
if (isset($to_write['owner']) && !empty($to_write['owner'])) unset($to_write['owner']);
}
// we dont update the content-history, if we run inside setup (admin-account-creation)
if(!($this->error = parent::save($to_write)) && is_object($GLOBALS['egw']->contenthistory))
{