let hook override autoFilp flag if required
authorDeepak Srivastava <deepak.srivastava.0303@gmail.com>
Thu, 3 Apr 2014 08:23:57 +0000 (13:53 +0530)
committerDeepak Srivastava <deepak.srivastava.0303@gmail.com>
Thu, 3 Apr 2014 08:23:57 +0000 (13:53 +0530)
CRM/Dedupe/Merger.php

index 0e543f1d0aea116f8ec1fb7628bca483b592a17f..e5ead18a83cbd427b720340b2d4135e61f6835aa 100644 (file)
@@ -622,8 +622,9 @@ INNER JOIN  civicrm_membership membership2 ON membership1.membership_type_id = m
         CRM_Utils_Hook::merge('flip', $dupes, $dupes['dstID'], $dupes['srcID']);
         $mainId = $dupes['dstID'];
         $otherId = $dupes['srcID'];
-        // make sure that $mainId is the one with lower id number
-        if ($autoFlip && ($mainId > $otherId)) {
+        $isAutoFlip = CRM_Utils_Array::value('auto_flip', $dupes, $autoFlip);
+        // if we can, make sure that $mainId is the one with lower id number
+        if ($isAutoFlip && ($mainId > $otherId)) {
           $mainId = $dupes['srcID'];
           $otherId = $dupes['dstID'];
         }