* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
- public static function batchMerge($rgid, $gid = NULL, $mode = 'safe', $batchLimit = 1, $isSelected = 2, $criteria = [], $checkPermissions = TRUE, $reloadCacheIfEmpty = NULL) {
+ 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);
}