diff --git a/admin/inc/class.admin_mail.inc.php b/admin/inc/class.admin_mail.inc.php index 9d4b8311de..7c05a0946b 100644 --- a/admin/inc/class.admin_mail.inc.php +++ b/admin/inc/class.admin_mail.inc.php @@ -1031,7 +1031,7 @@ class admin_mail unset($content['smimeKeyUpload']); } self::fix_account_id_0($content['account_id'], true); - $content = Mail\Account::write($content, $content['called_for'] || !$this->is_admin ? + $content = Mail\Account::write($content, !empty($content['called_for']) && $this->is_admin ? $content['called_for'] : $GLOBALS['egw_info']['user']['account_id']); self::fix_account_id_0($content['account_id']); $msg = lang('Account saved.'); diff --git a/api/src/Mail/Account.php b/api/src/Mail/Account.php index 57d21be166..c535b39026 100644 --- a/api/src/Mail/Account.php +++ b/api/src/Mail/Account.php @@ -781,7 +781,7 @@ class Account implements \ArrayAccess 'account_id' => self::is_multiple($identity) ? 0 : (is_array($identity['account_id']) ? $identity['account_id'][0] : $identity['account_id']), ); - if ($identity['ident_id'] > 0) + if ($identity['ident_id'] !== 'new' && (int)$identity['ident_id'] > 0) { self::$db->update(self::IDENTITIES_TABLE, $data, array( 'ident_id' => $identity['ident_id'], @@ -1196,7 +1196,7 @@ class Account implements \ArrayAccess // store identity $new_ident_id = self::save_identity($data); - if (!($data['ident_id'] > 0)) + if ($data['ident_id'] === 'new' || empty($data['ident_id'])) { $data['ident_id'] = $new_ident_id; self::$db->update(self::TABLE, array(