function post_updateItem($history = 1) { // Update emails (use _useremails set from UI, not _emails set from LDAP) if (isset($this->input['_useremails']) && count($this->input['_useremails'])) { $useremail = new UserEmail(); foreach ($this->input['_useremails'] as $id => $email) { $email = trim($email); // existing email if ($id > 0) { $params = array('id' => $id); // empty email : delete if (strlen($email) == 0) { $useremail->delete($params); } else { // Update email $params['email'] = $email; if ($this->input['_default_email'] == $id) { $params['is_default'] = 1; } $useremail->update($params); } } else { // New email $email_input = array('email' => $email, 'users_id' => $this->getID()); if (isset($this->input['_default_email']) && $this->input['_default_email'] == $id) { $email_input['is_default'] = 1; } else { $email_input['is_default'] = 0; } $useremail->add($email_input); } } } $this->syncLdapGroups(); $this->syncDynamicEmails(); $this->applyRightRules(); }
function post_updateItem($history = 1) { // Update emails (use _useremails set from UI, not _emails set from LDAP) if (isset($this->input['_useremails']) && count($this->input['_useremails'])) { $useremail = new UserEmail(); foreach ($this->input['_useremails'] as $id => $email) { $email = trim($email); // existing email if ($id > 0) { $params = array('id' => $id); // empty email : delete if (strlen($email) == 0) { $useremail->delete($params); } else { // Update email $params['email'] = $email; if ($this->input['_default_email'] == $id) { $params['is_default'] = 1; } $useremail->update($params); } } else { // New email $email_input = array('email' => $email, 'users_id' => $this->getID()); if (isset($this->input['_default_email']) && $this->input['_default_email'] == $id) { $email_input['is_default'] = 1; } else { $email_input['is_default'] = 0; } $useremail->add($email_input); } } } /* //User was not present in LDAP, and it just comes back if (in_array('is_deleted_ldap', $this->updates) && $this->fields['is_deleted_ldap'] == 0) { $changes[0] = '0'; $changes[1] = ''; $changes[2] = __('User present in LDAP directory'); Log::history($this->getID(), 'User', $changes, 0, Log::HISTORY_LOG_SIMPLE_MESSAGE); }*/ $this->syncLdapGroups(); $this->syncDynamicEmails(); $this->applyRightRules(); }