From: JKingsnorth Date: Tue, 17 Nov 2015 12:36:22 +0000 (+0000) Subject: Align order of location fields between main and other contact X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b932e89e25a6f1282211987a47f14e3ade636ff7;p=civicrm-core.git Align order of location fields between main and other contact --- diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 59d7f6d5fc..eee850e32e 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -1058,7 +1058,27 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m $blockName = strtolower($block); foreach (array('main' => $mainId, 'other' => $otherId) as $moniker => $cid) { $cnt = 1; - $values = civicrm_api($blockName, 'get', array('contact_id' => $cid, 'version' => 3)); + $searchParams = array( + 'version' => 3, + 'contact_id' => $cid, + ); + // CRM-17556 Order by location and type + // @todo Temporary fix for websites (no location, only type) + if ($blockName == 'website') { + $searchParams['options'] = array('sort' => 'website_type_id'); + } + // Sort by location and type + elseif ($blockName == 'phone') { + $searchParams['options'] = array('sort' => 'location_type_id,phone_type_id'); + } + elseif ($blockName == 'im') { + $searchParams['options'] = array('sort' => 'location_type_id,provider_id'); + } + // Sort by just location + else { + $searchParams['options'] = array('sort' => 'location_type_id'); + } + $values = civicrm_api($blockName, 'get', $searchParams); $count = $values['count']; if ($count) { if ($count > $cnt) {