Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 4.12.3
-
Component/s: None
-
Labels:None
Description
- Under Settings > Company > Client Options > General Client Settings, Enable email verification
- Under Settings > Company > Client Options > Required Client Field select Address 1
- Login as a client
- Change their email under the account settings
- Go back to the client profile in the admin interface and switch them to verified
- See that the contact email is not updated
To fix:
In app/models/contacts.php starting at line 1400 change:
$rules = array_merge($rules, $this->getRequiredFieldRules($vars['client_id']));
To
$rules = array_merge($rules, $this->getRequiredFieldRules($vars['client_id'], $edit));
Replace the getRequiredFieldRules() with
/** * Gets the rules for all contact fields that are require by the client group * * @param int $client_id The ID of the client this contact is associated with * @param bool $edit Whether this data is being validated for an edit (optional, default false) * @return array A list of rules with the addition of the client groups required fields */ private function getRequiredFieldRules($client_id, $edit = false) { Loader::loadModels($this, ['ClientGroups']); $required_fields = []; $client = $this->Record->select('client_group_id') ->from('clients') ->where('id', '=', $client_id) ->fetch(); if ($client) { $required_contact_fields = $this->ClientGroups->getSetting( $client->client_group_id, 'required_contact_fields' ); if ($required_contact_fields) { $required_fields = unserialize(base64_decode($required_contact_fields->value)); } } $rules = []; foreach ($required_fields as $field) { $rules[$field]['empty'] = [ 'if_set' => $edit, 'rule' => 'isEmpty', 'negate' => true, 'message' => $this->_('Contacts.!error.' . $field . '.empty') ]; } return $rules; }
Activity
Jonathan Reissmueller
created issue -
Jonathan Reissmueller
made changes -
Field | Original Value | New Value |
---|---|---|
Rank | Ranked higher |
Jonathan Reissmueller
made changes -
Rank | Ranked higher |
Jonathan Reissmueller
made changes -
Fix Version/s | 4.12.3 [ 11700 ] |
Jonathan Reissmueller
made changes -
Sprint | 5.0.0 Sprint 4 [ 121 ] |
Jonathan Reissmueller
made changes -
Rank | Ranked lower |
Jonathan Reissmueller
made changes -
Assignee | Jonathan Reissmueller [ jonathan ] |
Jonathan Reissmueller
made changes -
Description |
* Under Settings > Company > Client Options > General Client Settings, Enable email verification
* Under Settings > Company > Client Options > Required Client Field select Address 1 * Login as a client * Change their email under the account settings * Go back to the client profile in the admin interface and switch them to verified * See that the contact email is not updated To fix: In app/models/contacts.php starting at line 1402 change: $rules = array_merge($rules, $this->getRequiredFieldRules($vars['client_id'])); To $rules = array_merge($rules, $this->getRequiredFieldRules($vars['client_id'], $edit)); Replace the getRequiredFieldRules() with {code:java} /** * Gets the rules for all contact fields that are require by the client group * * @param int $client_id The ID of the client this contact is associated with * @param bool $edit Whether this data is being validated for an edit (optional, default false) * @return array A list of rules with the addition of the client groups required fields */ private function getRequiredFieldRules($client_id, $edit = false) { Loader::loadModels($this, ['ClientGroups']); $required_fields = []; $client = $this->Record->select('client_group_id') ->from('clients') ->where('id', '=', $client_id) ->fetch(); if ($client) { $required_contact_fields = $this->ClientGroups->getSetting( $client->client_group_id, 'required_contact_fields' ); if ($required_contact_fields) { $required_fields = unserialize(base64_decode($required_contact_fields->value)); } } $rules = []; foreach ($required_fields as $field) { $rules[$field]['empty'] = [ 'if_set' => $edit, 'rule' => 'isEmpty', 'negate' => true, 'message' => $this->_('Contacts.!error.' . $field . '.empty') ]; } {code} |
* Under Settings > Company > Client Options > General Client Settings, Enable email verification
* Under Settings > Company > Client Options > Required Client Field select Address 1 * Login as a client * Change their email under the account settings * Go back to the client profile in the admin interface and switch them to verified * See that the contact email is not updated To fix: In app/models/contacts.php starting at line 1400 change: $rules = array_merge($rules, $this->getRequiredFieldRules($vars['client_id'])); To $rules = array_merge($rules, $this->getRequiredFieldRules($vars['client_id'], $edit)); Replace the getRequiredFieldRules() with {code:java} /** * Gets the rules for all contact fields that are require by the client group * * @param int $client_id The ID of the client this contact is associated with * @param bool $edit Whether this data is being validated for an edit (optional, default false) * @return array A list of rules with the addition of the client groups required fields */ private function getRequiredFieldRules($client_id, $edit = false) { Loader::loadModels($this, ['ClientGroups']); $required_fields = []; $client = $this->Record->select('client_group_id') ->from('clients') ->where('id', '=', $client_id) ->fetch(); if ($client) { $required_contact_fields = $this->ClientGroups->getSetting( $client->client_group_id, 'required_contact_fields' ); if ($required_contact_fields) { $required_fields = unserialize(base64_decode($required_contact_fields->value)); } } $rules = []; foreach ($required_fields as $field) { $rules[$field]['empty'] = [ 'if_set' => $edit, 'rule' => 'isEmpty', 'negate' => true, 'message' => $this->_('Contacts.!error.' . $field . '.empty') ]; } {code} |
Jonathan Reissmueller
made changes -
Description |
* Under Settings > Company > Client Options > General Client Settings, Enable email verification
* Under Settings > Company > Client Options > Required Client Field select Address 1 * Login as a client * Change their email under the account settings * Go back to the client profile in the admin interface and switch them to verified * See that the contact email is not updated To fix: In app/models/contacts.php starting at line 1400 change: $rules = array_merge($rules, $this->getRequiredFieldRules($vars['client_id'])); To $rules = array_merge($rules, $this->getRequiredFieldRules($vars['client_id'], $edit)); Replace the getRequiredFieldRules() with {code:java} /** * Gets the rules for all contact fields that are require by the client group * * @param int $client_id The ID of the client this contact is associated with * @param bool $edit Whether this data is being validated for an edit (optional, default false) * @return array A list of rules with the addition of the client groups required fields */ private function getRequiredFieldRules($client_id, $edit = false) { Loader::loadModels($this, ['ClientGroups']); $required_fields = []; $client = $this->Record->select('client_group_id') ->from('clients') ->where('id', '=', $client_id) ->fetch(); if ($client) { $required_contact_fields = $this->ClientGroups->getSetting( $client->client_group_id, 'required_contact_fields' ); if ($required_contact_fields) { $required_fields = unserialize(base64_decode($required_contact_fields->value)); } } $rules = []; foreach ($required_fields as $field) { $rules[$field]['empty'] = [ 'if_set' => $edit, 'rule' => 'isEmpty', 'negate' => true, 'message' => $this->_('Contacts.!error.' . $field . '.empty') ]; } {code} |
* Under Settings > Company > Client Options > General Client Settings, Enable email verification
* Under Settings > Company > Client Options > Required Client Field select Address 1 * Login as a client * Change their email under the account settings * Go back to the client profile in the admin interface and switch them to verified * See that the contact email is not updated To fix: In app/models/contacts.php starting at line 1400 change: $rules = array_merge($rules, $this->getRequiredFieldRules($vars['client_id'])); To $rules = array_merge($rules, $this->getRequiredFieldRules($vars['client_id'], $edit)); Replace the getRequiredFieldRules() with {code:java} /** * Gets the rules for all contact fields that are require by the client group * * @param int $client_id The ID of the client this contact is associated with * @param bool $edit Whether this data is being validated for an edit (optional, default false) * @return array A list of rules with the addition of the client groups required fields */ private function getRequiredFieldRules($client_id, $edit = false) { Loader::loadModels($this, ['ClientGroups']); $required_fields = []; $client = $this->Record->select('client_group_id') ->from('clients') ->where('id', '=', $client_id) ->fetch(); if ($client) { $required_contact_fields = $this->ClientGroups->getSetting( $client->client_group_id, 'required_contact_fields' ); if ($required_contact_fields) { $required_fields = unserialize(base64_decode($required_contact_fields->value)); } } $rules = []; foreach ($required_fields as $field) { $rules[$field]['empty'] = [ 'if_set' => $edit, 'rule' => 'isEmpty', 'negate' => true, 'message' => $this->_('Contacts.!error.' . $field . '.empty') ]; } return $rules; } {code} |
Jonathan Reissmueller
made changes -
Status | Open [ 1 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] |