// pull section aliases out of $this->_sections
$sectionAliases = array_keys($this->_sections);
+ // hack alert - but it's tested so go forth & make pretty, or whack the new mole that popped up with gay abandon.
+ if (in_array('civicrm_contribution_total_amount', $this->_selectAliases)) {
+ $keyToHack = array_search('civicrm_contribution_total_amount', $this->_selectAliases);
+ $this->_selectAliases[$keyToHack] = 'civicrm_contribution_total_amount_sum';
+ }
+
$ifnulls = array();
foreach (array_merge($sectionAliases, $this->_selectAliases) as $alias) {
$ifnulls[] = "ifnull($alias, '') as $alias";
$addtotals = '';
- if (array_search("civicrm_contribution_total_amount", $this->_selectAliases) !==
+ if (array_search("civicrm_contribution_total_amount_sum", $this->_selectAliases) !==
FALSE
) {
- $addtotals = ", sum(civicrm_contribution_total_amount) as sumcontribs";
+ $addtotals = ", sum(civicrm_contribution_total_amount_sum) as sumcontribs";
$showsumcontribs = TRUE;
}
]);
}
+ /**
+ * Test the group filter works on the contribution summary.
+ */
+ public function testContributionDetailTotalHeader() {
+ $contactID = $this->individualCreate();
+ $contactID2 = $this->individualCreate();
+ $this->contributionCreate(['contact_id' => $contactID, 'api.ContributionSoft.create' => ['amount' => 5, 'contact_id' => $contactID2]]);
+ $template = 'contribute/detail';
+ $rows = $this->callAPISuccess('report_template', 'getrows', array(
+ 'report_id' => $template,
+ 'contribution_or_soft_value' => 'contributions_only',
+ 'fields' => [
+ 'sort_name' => '1',
+ 'age' => '1',
+ 'email' => '1',
+ 'phone' => '1',
+ 'financial_type_id' => '1',
+ 'receive_date' => '1',
+ 'total_amount' => '1',
+ ],
+ 'order_bys' => [['column' => 'sort_name', 'order' => 'ASC', 'section' => '1']],
+ 'options' => array('metadata' => array('sql')),
+ ));
+ }
+
}