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