ContributionPivot.php 1.75 KB
Newer Older
bgm's avatar
bgm committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<?php

/**
 * Class CRM_Extendedreport_Form_Report_ContributionPivot
 */
class CRM_Extendedreport_Form_Report_Contribute_ContributionPivot extends CRM_Extendedreport_Form_Report_ExtendedReport {
  protected $_baseTable = 'civicrm_contribution';
  protected $skipACL = FALSE;
  protected $_customGroupAggregates = TRUE;
  protected $_aggregatesIncludeNULL = TRUE;
  protected $_aggregatesAddTotal = TRUE;
  protected $_rollup = 'WITH ROLLUP';
  public $_drilldownReport = array();
  protected $isPivot = TRUE;
  protected $_potentialCriteria = array();
16
  protected $_noFields = TRUE;
bgm's avatar
bgm committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61

  /**
   * Class constructor.
   */
  public function __construct() {
    $this->_customGroupExtended['civicrm_contribution'] = array(
      'extends' => array('Contribution'),
      'filters' => TRUE,
      'title' => ts('Contribution'),
    );

    $this->_columns = $this->getColumns('Contribution', array(
        'fields' => FALSE,
    )) +
    $this->_columns = $this->getColumns('Contact', array(
      'fields' => FALSE,
    )) + $this->_columns = $this->getColumns('Address', array(
       'fields' => FALSE,
    ));

    $this->_aggregateRowFields = array(
      'contribution:contribution_campaign_id' => 'Campaign',
      'address:address_county_id' => 'County',
      'address:address_city' => 'City',
      'contribution:contribution_financial_type_id' => 'Financial Type',
    );
    $this->_aggregateColumnHeaderFields = array(
      'contribution:contribution_financial_type_id' => 'Financial Type',
      'contribution:contribution_campaign_id' => 'Campaign',
    );
    parent::__construct();
  }

  /**
   * Get sql FROM clauses.
   *
   * @return array
   */
  public function fromClauses() {
    return array(
      'contact_from_contribution',
      'address_from_contact',
    );
  }
}