);
$query->_distinctComponentClause = '( civicrm_activity.id )';
$query->_groupByComponentClause = " GROUP BY civicrm_activity.id ";
- $result = $query->searchQuery(0, 0, NULL);
+
+ // CRM-12675
+ $activityClause = NULL;
+ if (! CRM_Core_Permission::check('access CiviContribute')) {
+ $activityClause = ' (activity_type.component_id IS NULL OR activity_type.component_id <> 2) ';
+ }
+
+ $result = $query->searchQuery(0, 0, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, $activityClause);
while ($result->fetch()) {
if (!empty($result->activity_id)) {
$this->_activityClause = $activityClause;
+ // CRM-12675
+ if (! CRM_Core_Permission::check('access CiviContribute')) {
+ $componentRestriction = ' (activity_type.component_id IS NULL OR activity_type.component_id <> 2) ';
+ if (empty($this->_activityClause)) {
+ $this->_activityClause = $componentRestriction;
+ }
+ else {
+ $this->_activityClause .= ' AND ' . $componentRestriction;
+ }
+ }
+
// type of selector
$this->_action = $action;
$this->_query = new CRM_Contact_BAO_Query($this->_queryParams,