* Admin/PostgreSQL: adding new accounts failed

because they were added with account_id=0, which is stored literaly in postgres but created a new auto-id in mysql, unsetting it works of cause for both
This commit is contained in:
Ralf Becker 2014-09-24 06:55:44 +00:00
parent cd8f1cdd4f
commit 1465d5065b
2 changed files with 10 additions and 6 deletions

View File

@ -159,7 +159,7 @@ class admin_account
}
}
// Make sure primary group is in account groups
if($account['account_primary_group'] && !array_search($account['account_primary_group'], $account['account_groups']))
if($account['account_primary_group'] && !array_search($account['account_primary_group'], (array)$account['account_groups']))
{
$account['account_groups'][] = $account['account_primary_group'];
}

View File

@ -147,6 +147,10 @@ class admin_cmd_edit_user extends admin_cmd_change_pw
if (is_null($value)) $value = $old[$name];
}
}
else
{
unset($data['account_id']); // otherwise add will fail under postgres
}
// hook allowing apps to intercept adding/editing accounts before saving them
$GLOBALS['egw']->hooks->process($data+array(
'location' => $this->account ? 'pre_editaccount' : 'pre_addaccount',
@ -221,7 +225,7 @@ class admin_cmd_edit_user extends admin_cmd_change_pw
* parse the expired string and return the expired date as timestamp
*
* @param string $str date, 'never', 'already' or '' (=dont change, or default of never of new accounts)
* @param boolean $exists
* @param boolean $existing
* @return int timestamp, 0 for already, -1 for never or null for dont change
* @throws egw_exception_wrong_userinput(lang('Invalid formated date "%1"!',$datein),6);
*/