diff --git a/admin/inc/class.admin_account.inc.php b/admin/inc/class.admin_account.inc.php index ac84bd3dd9..130558a13b 100644 --- a/admin/inc/class.admin_account.inc.php +++ b/admin/inc/class.admin_account.inc.php @@ -132,7 +132,7 @@ class admin_account 'changepassword', 'anonymous', 'mustchangepassword', 'account_passwd', 'account_passwd2', 'account_primary_group', - 'account_expires', 'account_status', + 'account_expires' ) as $c_name => $a_name) { if (is_int($c_name)) $c_name = $a_name; @@ -140,7 +140,8 @@ class admin_account switch($a_name) { case 'account_expires': - $account[$a_name] = $content[$c_name] ? $content[$c_name] : 'never'; + $account[$a_name] = $content[$c_name] ? $content[$c_name] : + ($content['account_status'] ? 'never' : 'already'); break; case 'changepassword': // boolean values: admin_cmd_edit_user understands '' as NOT set diff --git a/admin/inc/class.admin_cmd_edit_user.inc.php b/admin/inc/class.admin_cmd_edit_user.inc.php index 976e12c25e..b681da3937 100644 --- a/admin/inc/class.admin_cmd_edit_user.inc.php +++ b/admin/inc/class.admin_cmd_edit_user.inc.php @@ -88,8 +88,17 @@ class admin_cmd_edit_user extends admin_cmd_change_pw { throw new egw_exception_wrong_userinput(lang('The two passwords are not the same'),0); } - $data['account_expires'] = $expires = self::_parse_expired($data['account_expires'],(boolean)$this->account); - $data['account_status'] = is_null($expires) ? null : ($expires == -1 || $expires > time() ? 'A' : ''); + $expires = self::_parse_expired($data['account_expires'],(boolean)$this->account); + if ($expires === 0) // deactivated + { + $data['account_expires'] = -1; + $data['account_status'] = ''; + } + else + { + $data['account_expires'] = $expires; + $data['account_status'] = is_null($expires) ? null : ($expires == -1 || $expires > time() ? 'A' : ''); + } $data['changepassword'] = admin_cmd::parse_boolean($data['changepassword'],$this->account ? null : true); $data['anonymous'] = admin_cmd::parse_boolean($data['anonymous'],$this->account ? null : false); @@ -138,6 +147,11 @@ class admin_cmd_edit_user extends admin_cmd_change_pw if (is_null($value)) $value = $old[$name]; } } + // hook allowing apps to intercept adding/editing accounts before saving them + $GLOBALS['egw']->hooks->process($data+array( + 'location' => $this->account ? 'pre_editaccount' : 'pre_addaccount', + ),False,True); // called for every app now, not only enabled ones) + if (!($data['account_id'] = admin_cmd::$accounts->save($data))) { //_debug_array($data);