diff --git a/CRM/Profile/Form.php b/CRM/Profile/Form.php index 70aff916cf06..6912994ce9b2 100644 --- a/CRM/Profile/Form.php +++ b/CRM/Profile/Form.php @@ -219,9 +219,7 @@ protected static function handleDuplicateChecking(&$errors, $fields, $form) { CRM_Core_Session::setStatus(ts('Note: this contact may be a duplicate of an existing record.'), ts('Possible Duplicate Detected'), 'alert'); } elseif ($form->_isUpdateDupe == 1) { - if (!$form->_id) { - $form->_id = $ids[0]; - } + $form->_id = $ids[0]; } else { if ($form->_context == 'dialog') { @@ -1002,7 +1000,12 @@ public static function formRule($fields, $files, $form) { $register = NULL; // hack we use a -1 in options to indicate that its registration + // ... and I can't remove that comment because even though it's clear as mud + // perhaps someone will find it helpful in the absence of ANY OTHER EXPLANATION + // as to what it means.... if ($form->_id) { + // @todo - wonder if it ever occurred to someone that if they didn't document this param + // it might not be crystal clear why we have it.... $form->_isUpdateDupe = 1; } @@ -1022,7 +1025,9 @@ public static function formRule($fields, $files, $form) { $fields['phone-Primary'] = $fields['phone-Primary-1']; } - self::handleDuplicateChecking($errors, $fields, $form); + if (!$form->_id) { + self::handleDuplicateChecking($errors, $fields, $form); + } } foreach ($fields as $key => $value) {