diff --git a/CRM/ConstituentsOnly/BAO/APIWrapper.php b/CRM/ConstituentsOnly/BAO/APIWrapper.php deleted file mode 100644 index 7819b4f..0000000 --- a/CRM/ConstituentsOnly/BAO/APIWrapper.php +++ /dev/null @@ -1,23 +0,0 @@ -_params)) { + $query->_params[] = [ + 'entryURL', + '=', + 0, + 0, + 1, + ]; + } + $query->_paramLookup['entryURL'] = [ + 'entryURL', + '=', + 0, + 0, + 1, + ]; + } } /** @@ -21,6 +41,7 @@ class CRM_ConstituentsOnly_BAO_Query extends CRM_Contact_BAO_Query_Interface { if (empty($query->_paramLookup['entryURL'])) { return; } + if (CRM_Utils_Array::value('civicrm_contact', $query->_tables)) { $query->_where[0][] = "( contact_a.do_not_trade IS NULL OR contact_a.do_not_trade = 0)"; } diff --git a/constituentsonly.php b/constituentsonly.php index 6749d8b..cf3d251 100644 --- a/constituentsonly.php +++ b/constituentsonly.php @@ -134,17 +134,6 @@ function constituentsonly_civicrm_queryObjects(&$queryObjects, $type) { } } -/** - * Implements hook_civicrm_apiWrappers(). - * - * @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_apiWrappers - */ -function constituentsonly_civicrm_apiWrappers(&$wrappers, $apiRequest) { - if ($apiRequest['entity'] == 'Contact' && strtolower($apiRequest['action']) == 'getlist') { - $wrappers[] = new CRM_ConstituentsOnly_BAO_APIWrapper(); - } -} - /** * Implements hook_civicrm_contactListQuery(). *