Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
4c6ce474 EM |
2 | |
3 | /** | |
4 | * Class CRM_Dedupe_BAO_QueryBuilder | |
5 | */ | |
6a488035 | 6 | class CRM_Dedupe_BAO_QueryBuilder { |
e0ef6999 EM |
7 | /** |
8 | * @param $rg | |
9 | * @param string $strID1 | |
10 | * @param string $strID2 | |
11 | * | |
12 | * @return string | |
13 | */ | |
00be9182 | 14 | public static function internalFilters( $rg, $strID1 = 'contact1.id', $strID2 = 'contact2.id' ) { |
6a488035 TO |
15 | // Add a contact id filter for dedupe by group requests and add logic |
16 | // to remove duplicate results with opposing orders, i.e. 1,2 and 2,1 | |
17 | if( !empty($rg->contactIds) ) { | |
18 | $cids = implode(',',$rg->contactIds); | |
19 | return "($strID1 IN ($cids) AND ( $strID2 NOT IN ($cids) OR ($strID2 IN ($cids) AND $strID1 < $strID2) ))"; | |
20 | } | |
21 | else { | |
22 | return "($strID1 < $strID2)"; | |
23 | } | |
24 | } | |
25 | }; |