fix mail account creation under PHP 8.0

PHP 8.0: "new" > 0 === true
PHP<8.0: "new" > 0 === false
This commit is contained in:
Ralf Becker 2021-10-06 12:31:23 +02:00
parent d3fd2aa76a
commit cb8cac15dc
2 changed files with 3 additions and 3 deletions

View File

@ -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.');

View File

@ -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(