From 1465d5065b1a38f19b864feca067392e39a4e142 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 24 Sep 2014 06:55:44 +0000 Subject: [PATCH] * 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 --- admin/inc/class.admin_account.inc.php | 2 +- admin/inc/class.admin_cmd_edit_user.inc.php | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/admin/inc/class.admin_account.inc.php b/admin/inc/class.admin_account.inc.php index f35583c704..6dc40db30c 100644 --- a/admin/inc/class.admin_account.inc.php +++ b/admin/inc/class.admin_account.inc.php @@ -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']; } diff --git a/admin/inc/class.admin_cmd_edit_user.inc.php b/admin/inc/class.admin_cmd_edit_user.inc.php index b681da3937..6b53e651ca 100644 --- a/admin/inc/class.admin_cmd_edit_user.inc.php +++ b/admin/inc/class.admin_cmd_edit_user.inc.php @@ -19,9 +19,9 @@ class admin_cmd_edit_user extends admin_cmd_change_pw * Constructor * * @param string/int/array $account account name or id (!$account to add a new account), or array with all parameters - * @param array $set=null array with all data to change - * @param string $password=null password - * @param boolean $run_addaccount_hook=null default run addaccount for new accounts and editaccount for existing ones + * @param array $set =null array with all data to change + * @param string $password =null password + * @param boolean $run_addaccount_hook =null default run addaccount for new accounts and editaccount for existing ones */ function __construct($account,$set=null,$password=null,$run_addaccount_hook=null) { @@ -41,7 +41,7 @@ class admin_cmd_edit_user extends admin_cmd_change_pw /** * change the password of a given user * - * @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself + * @param boolean $check_only =false only run the checks (and throw the exceptions), but not the command itself * @return string success message * @throws egw_exception_no_admin * @throws egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15); @@ -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); */