Commit 50ac2bb4 authored by sluc23's avatar sluc23

Merge branch '1.x-reports' into '1.x'

1.x reports

See merge request civicrm/com.ixiam.modules.reportplus!4
parents a9f85dc0 f87edefb
......@@ -600,6 +600,38 @@ class CRM_Reportplus_Form extends CRM_Report_Form {
parent::limit($rowCount);
}
/**
* Alter display of rows.
*
* Iterate through the rows retrieved via SQL and make changes for display purposes,
* such as rendering contacts as links.
*
* @param array $rows
* Rows generated by SQL, with an array for each row.
*/
public function alterDisplay(&$rows) {
$entryFound = FALSE;
foreach ($rows as $rowNum => $row) {
// If using campaigns, convert campaign_id to campaign title
if (array_key_exists('civicrm_contribution_campaign_id', $row)) {
if ($value = $row['civicrm_contribution_campaign_id']) {
if (array_key_exists($value, $this->_disabledCampaigns)) {
$rows[$rowNum]['civicrm_contribution_campaign_id'] = '<font color="#FF0000">' . $this->_disabledCampaigns[$value] . '</font>';
}
else{
$rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->_activeCampaigns[$value];
}
}
$entryFound = TRUE;
}
// skip looking further in rows, if first row itself doesn't
// have the column we need
if (!$entryFound) {
break;
}
}
}
/**
* The intent is to add a tab for developers to view the sql.
*
......
......@@ -298,9 +298,7 @@ class CRM_Reportplus_Form_Contribute_Detail extends CRM_Reportplus_Form {
);
$this->_columns['civicrm_contribution']['order_bys']['campaign_id'] = array('title' => ts('Campaign'));
}
$this->_currencyColumn = 'civicrm_contribution_currency';
}
public function select() {
......@@ -608,6 +606,8 @@ UNION ALL
* Rows generated by SQL, with an array for each row.
*/
public function alterDisplay(&$rows) {
parent::alterDisplay($rows);
$checkList = array();
$entryFound = FALSE;
$display_flag = $prev_cid = $cid = 0;
......@@ -708,14 +708,6 @@ UNION ALL
$entryFound = TRUE;
}
// convert campaign_id to campaign title
if (array_key_exists('civicrm_contribution_campaign_id', $row)) {
if ($value = $row['civicrm_contribution_campaign_id']) {
$rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->_activeCampaigns[$value];
$entryFound = TRUE;
}
}
// soft credits
if (array_key_exists('civicrm_contribution_soft_credits', $row) &&
'Contribution' ==
......
......@@ -704,6 +704,8 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
* Rows generated by SQL, with an array for each row.
*/
public function alterDisplay(&$rows) {
parent::alterDisplay($rows);
$entryFound = FALSE;
$contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus();
......@@ -784,19 +786,6 @@ ROUND(AVG({$this->_aliases['civicrm_contribution_soft']}.amount), 2) as civicrm_
$entryFound = TRUE;
}
// If using campaigns, convert campaign_id to campaign title
if (array_key_exists('civicrm_contribution_campaign_id', $row)) {
if ($value = $row['civicrm_contribution_campaign_id']) {
if (array_key_exists($value, $this->_disabledCampaigns)) {
$rows[$rowNum]['civicrm_contribution_campaign_id'] = '<font color="#FF0000">' . $this->_disabledCampaigns[$value] . '</font>';
}
else{
$rows[$rowNum]['civicrm_contribution_campaign_id'] = $this->_activeCampaigns[$value];
}
}
$entryFound = TRUE;
}
$entryFound = $this->alterDisplayAddressFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s) for this ') ? TRUE : $entryFound;
$entryFound = $this->alterDisplayContactFields($row, $rows, $rowNum, 'contribute/detail', 'List all contribution(s) for this ') ? TRUE : $entryFound;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment