*/
public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $batchLimit = 1, $isSelected = 2, $criteria = [], $checkPermissions = TRUE, $reloadCacheIfEmpty = NULL, $searchLimit = 0) {
$redirectForPerformance = ($batchLimit > 1) ? TRUE : FALSE;
-
+ if ($mode === 'aggressive' && $checkPermissions && !CRM_Core_Permission::check('force merge duplicate contacts')) {
+ throw new CRM_Core_Exception(ts('Insufficient permissions for aggressive mode batch merge'));
+ }
if (!isset($reloadCacheIfEmpty)) {
$reloadCacheIfEmpty = (!$redirectForPerformance && $isSelected == 2);
}
// explicitly set to NULL if not 1 or 0 as part of grandfathering out the mystical '2' value.
$isSelected = NULL;
}
- $dupePairs = self::getDuplicatePairs($rgid, $gid, $reloadCacheIfEmpty, $batchLimit, $isSelected, ($mode == 'aggressive'), $criteria, $checkPermissions);
+ $dupePairs = self::getDuplicatePairs($rgid, $gid, $reloadCacheIfEmpty, $batchLimit, $isSelected, ($mode == 'aggressive'), $criteria, $checkPermissions, $searchLimit);
$cacheParams = [
'cache_key_string' => self::getMergeCacheKeyString($rgid, $gid, $criteria, $checkPermissions, $searchLimit),
$locations[$moniker][$blockName][$cnt] = $value;
// Fix address display
if ($blockName == 'address') {
+ // For performance avoid geocoding while merging https://issues.civicrm.org/jira/browse/CRM-21786
+ // we can expect existing geocode values to be retained.
+ $value['skip_geocode'] = TRUE;
CRM_Core_BAO_Address::fixAddress($value);
+ unset($value['skip_geocode']);
$locations[$moniker][$blockName][$cnt]['display'] = CRM_Utils_Address::format($value);
}
// Fix email display