* @return string
*/
public function from() {
+ $this->buildACLClause('contact_a');
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
$targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
LEFT JOIN civicrm_contact contact_c
ON assignment.contact_id = contact_c.id {$this->_aclFrom}";
- if ($this->_aclWhere) {
- $this->_where .= " {$this->_aclWhere} ";
- }
-
return $from;
}
}
}
+ if ($this->_aclWhere) {
+ $clauses[] = " {$this->_aclWhere} ";
+ }
+
return implode(' AND ', $clauses);
}
$this->buildACLClause('contact_a');
$from = $this->_query->_fromClause;
$from .= "{$this->_aclFrom}";
- if ($this->_aclWhere) {
- $this->_where .= " AND {$this->_aclWhere} ";
- }
return $from;
}
*/
public function where($includeContactIDs = FALSE) {
if ($whereClause = $this->_query->whereClause()) {
+ if ($this->_aclWhere) {
+ $whereCluase .= " AND {$this->_aclWhere} ";
+ }
return $whereClause;
}
return ' (1) ';
}
$this->buildACLClause('contact_a');
- if ($this->_aclWhere) {
- $where .= " AND {$this->_aclWhere} ";
- }
$sql = "
SELECT $select
FROM civicrm_contact AS contact_a {$this->_aclFrom}
$clauses[] = " xg.contact_id IS NULL ";
}
+ if ($this->_aclWhere) {
+ $clauses[] .= " {$this->_aclWhere} ";
+ }
return implode(' AND ', $clauses);
}
civicrm_contribution AS contrib,
civicrm_contact AS contact_a {$this->_aclFrom}
";
- if ($this->_aclWhere) {
- $this->_where .= " {$this->_aclWhere} ";
- }
+
return $from;
}
$financial_type_ids = implode(',', array_keys($this->_formValues['financial_type_id']));
$clauses[] = "contrib.financial_type_id IN ($financial_type_ids)";
}
-
- return implode(' AND ', $clauses);
+ if ($this->_aclWhere) {
+ return " {$this->_aclWhere} " . implode(' AND ', $clauses);
+ }
+ else {
+ return implode(' AND ', $clauses);
+ }
}
/**
$from .= " INNER JOIN Ig_{$this->_tableName} temptable1 ON (contact_a.id = temptable1.contact_id)";
}
- if ($this->_aclWhere) {
- $this->_where .= " AND {$this->_aclWhere} ";
- }
-
return $from;
}
* @return string
*/
public function where($includeContactIDs = FALSE) {
- return '(1)';
+ $where = '(1)';
+ if ($this->_aclWhere) {
+ $where = " AND {$this->_aclWhere} ";
+ }
+ return $where;
}
/**
left join civicrm_option_value on
( civicrm_option_value.value = civicrm_event.event_type_id AND civicrm_option_value.option_group_id = 14) {$this->_aclFrom}";
- if ($this->_aclWhere) {
- $this->_where .= "{$this->_aclWhere} ";
- }
return $from;
}
$event_type_ids = implode(',', array_keys($this->_formValues['event_type_id']));
$clauses[] = "civicrm_event.event_type_id IN ( $event_type_ids )";
}
+ if ($this->_aclWhere) {
+ $clauses[] = "{$this->_aclWhere} ";
+ }
return implode(' AND ', $clauses);
}
AND cgc.status = 'Added')";
}
- if ($this->_aclWhere) {
- $this->_where .= " AND {$this->_aclWhere} ";
- }
-
return $from;
}
if ($this->_group) {
$clause[] = "cgc.group_id = {$this->_group}";
}
+ if ($this->_aclWhere) {
+ $clause[] = " AND {$this->_aclWhere} ";
+ }
$where = '( 1 )';
if (!empty($clause)) {
address.is_primary = 1 )
LEFT JOIN civicrm_state_province state_province ON state_province.id = address.state_province_id {$this->_aclFrom}
";
- if ($this->_aclWhere) {
- $this->_where .= " {$this->_aclWhere} ";
- }
return $from;
}
(select cr.contact_id_b from civicrm_relationship cr where (cr.contact_id_a = cgc.contact_id AND (cr.relationship_type_id = 7 OR cr.relationship_type_id = 6))),
cgc.contact_id )";
$clause[] = "contact_a.contact_type IN ('Individual','Household')";
-
+
+ if ($this->_aclWhere) {
+ $clause[] = " {$this->_aclWhere} ";
+ }
+
if (!empty($clause)) {
$where = implode(' AND ', $clause);
}
FROM civicrm_contact contact_a
INNER JOIN {$this->_tableName} tempTable ON ( tempTable.contact_id = contact_a.id ) {$this->_aclFrom}
";
- if ($this->_aclWhere) {
- $this->_where .= " AND {$this->_aclWhere} ";
- }
-
return $from;
}
* @return string
*/
public function where($includeContactIDs = FALSE) {
- return ' ( 1 ) ';
+ $where = ' ( 1 ) ';
+ if ($this->_aclWhere) {
+ $where = " AND {$this->_aclWhere} ";
+ }
+ return $where;
}
/**
";
}
- if ($this->_aclWhere) {
- $this->_where .= " AND {$this->_aclWhere} ";
- }
-
return $f;
}
$where .= " AND contact_a.is_deleted != 1 ";
$where .= "{$this->_where}";
-
+
+ if ($this->_aclWhere) {
+ $where .= " AND {$this->_aclWhere} ";
+ }
+
return $this->whereClause($where, $params);
}
$from .= " $fromTail";
- if ($this->_aclWhere) {
- $this->_where .= " AND {$this->_aclWhere} ";
- }
-
return $from;
}
* @return string
*/
public function where($includeContactIDs = FALSE) {
+ $where = '(1)';
+
+ if ($this->_aclWhere) {
+ $where = " AND {$this->_aclWhere} ";
+ }
+
return '(1)';
}
civicrm_email.is_primary = 1 )
LEFT JOIN civicrm_state_province state_province ON state_province.id = address.state_province_id {$this->_aclFrom}
";
- if ($this->_aclWhere) {
- $this->_where .= " AND {$this->_aclWhere} ";
- }
return $from;
}
$params[$count] = array($state, 'Integer');
$clause[] = "state_province.id = %{$count}";
}
+
+ if ($this->_aclWhere) {
+ $clause[] = " AND {$this->_aclWhere} ";
+ }
if (!empty($clause)) {
$where .= ' AND ' . implode(' AND ', $clause);
civicrm_entity_tag.entity_id = contact_a.id )
LEFT JOIN civicrm_tag ON civicrm_tag.id = civicrm_entity_tag.tag_id {$this->_aclFrom}
";
- if ($this->_aclWhere) {
- $this->_where .= " {$this->_aclWhere} ";
- }
return $from;
}
$clauses[] = "contact_a.id IN ( $contactIDs )";
}
}
+ if ($this->_aclWhere) {
+ $clauses[] = " {$this->_aclWhere} ";
+ }
return implode(' AND ', $clauses);
}
LEFT JOIN civicrm_email email ON ( email.contact_id = contact_a.id AND
email.is_primary = 1 ) {$this->_aclFrom}
";
- if ($this->_aclWhere) {
- $this->_where .= " {$this->_aclWhere} ";
- }
return $from;
}
2 => array(trim($high), 'Integer'),
);
+ if ($this->_aclWhere) {
+ $where .= " AND {$this->_aclWhere} ";
+ }
+
return $this->whereClause($where, $params);
}