Eileen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/311597

Change subject: Further fix on address merging to support form override
......................................................................

Further fix on address merging to support form override

When merging from a form the address change hook should not kick in ideally.

The batch merge will only merge higher into lower, the form will by default 
offer lower
into higher, so an early exist based on id order is one way to avoid this.

There is still an edge case where someone has manually flipped the merge screen
to merge higher into lower AND the higher has the more recent address
where the merge would kick in.

This does rule out the more common merge case where the hook is
still kicking in inappropriately due to the lower id contact being the last 
donor
due to previous merges & hence their address being copied over
despite the logged in user having not selected it.

I think I should keep looking for a follow up fix to pass context to the hook

Bug: T144440
Change-Id: I3608f16bc0d21c02408b5774f7db00e094c64f1d
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
1 file changed, 5 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/97/311597/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index 41825e1..2da5cb9 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -2263,6 +2263,11 @@
  */
 function wmf_civicrm_civicrm_alterLocationMergeData(&$blocksDAO, $mainId, 
$otherId, $migrationInfo) {
 
+  // In a batch merge the highest will always merge into the lowest. If the 
merge is reversed
+  // we are dealing with a manual merge and should not intervene.
+  if ($mainId > $otherId) {
+    return;
+  }
   $lastDonor = civicrm_api3('Contribution', 'get', array(
     'return' => 'contact_id',
     'contact_id' => array('IN' => array($mainId, $otherId)),

-- 
To view, visit https://gerrit.wikimedia.org/r/311597
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3608f16bc0d21c02408b5774f7db00e094c64f1d
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to