예제 #1
0
 /**
  * Generate where clause.
  *
  * We are overriding this primarily for 'before-after' handling of the receive_date placeholder field.
  *
  * We call this twice. The first time we are generating a temp table and we want to do an IS NULL on the
  * join that draws in contributions from this year. The second time we are filtering elsewhere (contacts via
  * the temp table & contributions via selective addition of contributions in the select function).
  *
  * If lifetime total is NOT selected we can add a further filter here to possibly improve performance
  * but the benefit if unproven as yet.
  * $clause = $this->whereClauseLastYear("{$this->_aliases['civicrm_contribution']}.receive_date");
  *
  * @param array $field Field specifications
  * @param string $op Query operator (not an exact match to sql)
  * @param mixed $value
  * @param float $min
  * @param float $max
  *
  * @return null|string
  */
 public function whereClause(&$field, $op, $value, $min, $max)
 {
     if ($field['name'] == 'receive_date') {
         $clause = 1;
         if (empty($this->contactTempTable)) {
             $this->_whereClauses[] = "cont_exclude.id IS NULL";
         }
     } else {
         $clause = parent::whereClause($field, $op, $value, $min, $max);
     }
     return $clause;
 }
예제 #2
0
 /**
  * Generate where clause.
  *
  * We are overriding this primarily for 'before-after' handling of the receive_date placeholder field.
  *
  * We call this twice. The first time we are generating a temp table and we want to do an IS NULL on the
  * join that draws in contributions from this year. The second time we are filtering elsewhere (contacts via
  * the temp table & contributions via selective addition of contributions in the select function).
  *
  * If lifetime total is NOT selected we can add a further filter here to possibly improve performance
  * but the benefit if unproven as yet.
  * $clause = $this->whereClauseLastYear("{$this->_aliases['civicrm_contribution']}.receive_date");
  *
  * @param array $field Field specifications
  * @param string $op Query operator (not an exact match to sql)
  * @param mixed $value
  * @param float $min
  * @param float $max
  *
  * @return null|string
  */
 public function whereClause(&$field, $op, $value, $min, $max)
 {
     if ($field['name'] == 'receive_date') {
         $clause = 1;
         if (empty($this->contactTempTable)) {
             $this->_whereClauses[] = "cont_exclude.id IS NULL";
         }
     } else {
         $clause = parent::whereClause($field, $op, $value, $min, $max);
     }
     if ($field['name'] == 'contribution_status_id' || $field['name'] == 'financial_type_id') {
         $this->_statusClause .= " AND " . $clause;
     }
     return $clause;
 }