Merge pull request #3349 from eileenmcnaughton/comments
[civicrm-core.git] / CRM / Dedupe / BAO / QueryBuilder.php
1 <?php
2
3 /**
4 * Class CRM_Dedupe_BAO_QueryBuilder
5 */
6 class CRM_Dedupe_BAO_QueryBuilder {
7 static function internalFilters( $rg, $strID1 = 'contact1.id', $strID2 = 'contact2.id' ) {
8 // Add a contact id filter for dedupe by group requests and add logic
9 // to remove duplicate results with opposing orders, i.e. 1,2 and 2,1
10 if( !empty($rg->contactIds) ) {
11 $cids = implode(',',$rg->contactIds);
12 return "($strID1 IN ($cids) AND ( $strID2 NOT IN ($cids) OR ($strID2 IN ($cids) AND $strID1 < $strID2) ))";
13 }
14 else {
15 return "($strID1 < $strID2)";
16 }
17 }
18 };
19
20
21