Skip to content

Commit

Permalink
Merge pull request #13606 from eileenmcnaughton/profile_perf
Browse files Browse the repository at this point in the history
Fix (sometimes serious) performance problem on submitting profiles for specified contacts
  • Loading branch information
colemanw authored Feb 17, 2019
2 parents c9f0d44 + 7c06861 commit 094707c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions CRM/Profile/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down Expand Up @@ -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;
}

Expand All @@ -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) {
Expand Down

0 comments on commit 094707c

Please sign in to comment.