<?php
-
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
public $_drilldownReport = array('contribute/detail' => 'Link to Detail Report');
/**
- *
*/
/**
- *
*/
- function __construct() {
+ public function __construct() {
$this->_columns = array(
'civicrm_contact' => array(
'dao' => 'CRM_Contact_DAO_Contact',
'type' => CRM_Utils_Type::T_MONEY,
'default' => TRUE,
'required' => TRUE,
- 'clause' => '
-contribution_civireport1.total_amount_count as contribution1_total_amount_count,
-contribution_civireport1.total_amount_sum as contribution1_total_amount_sum',
+ 'clause' => 'contribution_civireport1.total_amount_count as contribution1_total_amount_count, contribution_civireport1.total_amount_sum as contribution1_total_amount_sum',
),
'total_amount2' => array(
'name' => 'total_amount',
'type' => CRM_Utils_Type::T_MONEY,
'default' => TRUE,
'required' => TRUE,
- 'clause' => '
-contribution_civireport2.total_amount_count as contribution2_total_amount_count,
-contribution_civireport2.total_amount_sum as contribution2_total_amount_sum',
+ 'clause' => 'contribution_civireport2.total_amount_count as contribution2_total_amount_count, contribution_civireport2.total_amount_sum as contribution2_total_amount_sum',
),
),
'grouping' => 'contri-fields',
parent::__construct();
}
- function preProcess() {
+ public function preProcess() {
parent::preProcess();
}
*
* @return array
*/
- function setDefaultValues($freeze = TRUE) {
+ public function setDefaultValues($freeze = TRUE) {
return parent::setDefaultValues($freeze);
}
- function select() {
+ public function select() {
$select = array();
$append = NULL;
// since contact fields not related to financial type
/**
* @param bool $tableCol
*/
- function groupBy($tableCol = FALSE) {
+ public function groupBy($tableCol = FALSE) {
$this->_groupBy = "";
if (!empty($this->_params['group_bys']) &&
is_array($this->_params['group_bys'])
}
}
- function from() {
+ public function from() {
list($fromTable, $fromAlias, $fromCol) = $this->groupBy(TRUE);
$from = "$fromTable $fromAlias";
ON {$this->_aliases['civicrm_contact']}.id = {$this->_aliases['civicrm_phone']}.contact_id AND {$this->_aliases['civicrm_phone']}.is_primary = 1";
}
- else if ($fromTable == 'civicrm_financial_type') {
+ elseif ($fromTable == 'civicrm_financial_type') {
$contriCol = "financial_type_id";
}
elseif ($fromTable == 'civicrm_contribution') {
*
* @return mixed|string
*/
- function whereContribution($replaceAliasWith = 'contribution1') {
+ public function whereContribution($replaceAliasWith = 'contribution1') {
$clauses = array("is_test" => "{$this->_aliases['civicrm_contribution']}.is_test = 0");
foreach ($this->_columns['civicrm_contribution']['filters'] as $fieldName => $field) {
unset($clauses['receive_date1'], $clauses['total_amount1']);
}
- $whereClause = !empty($clauses) ?
- "WHERE " . implode(' AND ', $clauses) : '';
+ $whereClause = !empty($clauses) ? "WHERE " . implode(' AND ', $clauses) : '';
if ($replaceAliasWith) {
$whereClause = str_replace($this->_aliases['civicrm_contribution'], $replaceAliasWith, $whereClause);
return $whereClause;
}
- function where() {
+ public function where() {
if (!$this->_amountClauseWithAND) {
- $this->_amountClauseWithAND =
- "!({$this->_aliases['civicrm_contribution']}1.total_amount_count IS NULL AND {$this->_aliases['civicrm_contribution']}2.total_amount_count IS NULL)";
+ $this->_amountClauseWithAND
+ = "!({$this->_aliases['civicrm_contribution']}1.total_amount_count IS NULL AND {$this->_aliases['civicrm_contribution']}2.total_amount_count IS NULL)";
}
$clauses = array("atleast_one_amount" => $this->_amountClauseWithAND);
}
}
- $this->_where = !empty($clauses) ?
- "WHERE " . implode(' AND ', $clauses) : '';
+ $this->_where = !empty($clauses) ? "WHERE " . implode(' AND ', $clauses) : '';
}
/**
*
* @return array
*/
- static function formRule($fields, $files, $self) {
+ public static function formRule($fields, $files, $self) {
$errors = $checkDate = $errorCount = array();
if (!$found) {
$erorrGrps = implode(',', $invlidGroups);
$tempErrors[] = ts("Do not select field %1 with Group by %2.", array(
- 1 => $idMapping[$fld_id],
- 2 => $erorrGrps
- ));
+ 1 => $idMapping[$fld_id],
+ 2 => $erorrGrps,
+ ));
}
}
}
if (!empty($tempErrors)) {
- $errors['fields'] = implode("<br>", $tempErrors);
+ $errors['fields'] = implode("<br/>", $tempErrors);
}
}
*
* @return array
*/
- function statistics(&$rows) {
+ public function statistics(&$rows) {
$statistics = parent::statistics($rows);
//fetch contributions for both date ranges from pre-existing temp tables
//store contributions in array 'contact_sums' for comparison
$contact_sums = array();
while ($dao->fetch()) {
- $contact_sums[$dao->contact_id] =
- array(
+ $contact_sums[$dao->contact_id]
+ = array(
'contribution1_total_amount_sum' => $dao->contribution1_total_amount_sum,
- 'contribution2_total_amount_sum' => $dao->contribution2_total_amount_sum
+ 'contribution2_total_amount_sum' => $dao->contribution2_total_amount_sum,
);
}
$count = $count2 = 0;
while ($dao->fetch()) {
if ($dao->amount) {
- $amount[] =
- CRM_Utils_Money::format($dao->amount, $dao->currency) . "(" .
+ $amount[]
+ = CRM_Utils_Money::format($dao->amount, $dao->currency) . "(" .
$dao->count . ")";
$average[] = CRM_Utils_Money::format($dao->avg, $dao->currency);
}
$count += $dao->count;
if ($dao->amount2) {
- $amount2[] =
- CRM_Utils_Money::format($dao->amount2, $dao->currency) . "(" .
+ $amount2[]
+ = CRM_Utils_Money::format($dao->amount2, $dao->currency) . "(" .
$dao->count . ")";
$average2[] = CRM_Utils_Money::format($dao->avg2, $dao->currency);
}
return $statistics;
}
- function postProcess() {
+ public function postProcess() {
$this->beginPostProcess();
$create = $subSelect1 = $subSelect2 = NULL;
list($fromTable, $fromAlias, $fromCol) = $this->groupBy(TRUE);
$rows[$uid]['change'] = ts('New Donor');
}
if ($row['contribution1_total_amount_count']) {
- $rows[$uid]['contribution1_total_amount_sum'] =
- $row['contribution1_total_amount_sum'] .
+ $rows[$uid]['contribution1_total_amount_sum']
+ = $row['contribution1_total_amount_sum'] .
" ({$row['contribution1_total_amount_count']})";
}
if ($row['contribution2_total_amount_count']) {
- $rows[$uid]['contribution2_total_amount_sum'] =
- $row['contribution2_total_amount_sum'] .
+ $rows[$uid]['contribution2_total_amount_sum']
+ = $row['contribution2_total_amount_sum'] .
" ({$row['contribution2_total_amount_count']})";
}
}
/**
* @param $rows
*/
- function alterDisplay(&$rows) {
+ public function alterDisplay(&$rows) {
// custom code to alter rows
list($from1, $to1) = $this->getFromTo(CRM_Utils_Array::value("receive_date1_relative", $this->_params),
CRM_Utils_Array::value("receive_date1_from", $this->_params),
// foreach ends
}
}
-