// CRM-12675
$activityClause = NULL;
+
if (! CRM_Core_Permission::check('access CiviContribute')) {
- $activityClause = ' (activity_type.component_id IS NULL OR activity_type.component_id <> 2) ';
+ $components = CRM_Core_Component::getNames();
+ $contribute = CRM_Utils_Array::key('CiviContribute', $components);
+ $activityClause = " (activity_type.component_id IS NULL OR activity_type.component_id <> {$contribute}) ";
}
$result = $query->searchQuery(0, 0, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, $activityClause);
// CRM-12675
if (! CRM_Core_Permission::check('access CiviContribute')) {
- $componentRestriction = ' (activity_type.component_id IS NULL OR activity_type.component_id <> 2) ';
+ $components = CRM_Core_Component::getNames();
+ $contribute = CRM_Utils_Array::key('CiviContribute', $components);
+ $componentRestriction = " (activity_type.component_id IS NULL OR activity_type.component_id <> {$contribute}) ";
if (empty($this->_activityClause)) {
$this->_activityClause = $componentRestriction;
}
// CRM-12675
if (! CRM_Core_Permission::check('access CiviContribute')) {
- $clauses[] = " ({$this->_aliases['civicrm_option_value']}.component_id IS NULL OR {$this->_aliases['civicrm_option_value']}.component_id <> 2) ";
+ $components = CRM_Core_Component::getNames();
+ $contribute = CRM_Utils_Array::key('CiviContribute', $components);
+ $clauses[] = " ({$this->_aliases['civicrm_option_value']}.component_id IS NULL OR {$this->_aliases['civicrm_option_value']}.component_id <> {$contribute}) ";
}
if (empty($clauses)) {