5 +--------------------------------------------------------------------+
6 | CiviCRM version 4.3 |
7 +--------------------------------------------------------------------+
8 | Copyright CiviCRM LLC (c) 2004-2013 |
9 +--------------------------------------------------------------------+
10 | This file is a part of CiviCRM. |
12 | CiviCRM is free software; you can copy, modify, and distribute it |
13 | under the terms of the GNU Affero General Public License |
14 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
16 | CiviCRM is distributed in the hope that it will be useful, but |
17 | WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
19 | See the GNU Affero General Public License for more details. |
21 | You should have received a copy of the GNU Affero General Public |
22 | License and the CiviCRM Licensing Exception along |
23 | with this program; if not, contact CiviCRM LLC |
24 | at info[AT]civicrm[DOT]org. If you have questions about the |
25 | GNU Affero General Public License or the licensing of CiviCRM, |
26 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
27 +--------------------------------------------------------------------+
33 * @copyright CiviCRM LLC (c) 2004-2013
37 class CRM_Report_Form_Contribute_LoggingSummary
extends CRM_Logging_ReportSummary
{
38 function __construct() {
39 $this->_columns
= array(
40 'civicrm_contact_altered_contact' => array(
41 'dao' => 'CRM_Contact_DAO_Contact',
47 'display_name' => array(
49 'title' => ts('Altered Contact'),
51 'is_deleted' => array(
57 'altered_contact' => array(
58 'name' => 'display_name',
59 'title' => ts('Altered Contact'),
60 'type' => CRM_Utils_Type
::T_STRING
,
64 'log_civicrm_contribution' => array(
65 'dao' => 'CRM_Contribute_DAO_Contribution',
71 'contact_id' => array(
75 'log_user_id' => array(
82 'type' => CRM_Utils_Type
::T_TIME
,
83 'title' => ts('When'),
85 'log_conn_id' => array(
89 'log_action' => array(
91 'title' => ts('Action'),
93 'financial_type_id' => array(
97 'contribution_status_id' => array(
101 'aggregate_amount' => array(
103 'name' => 'total_amount',
104 'title' => ts('Aggregate Amount'),
105 'type' => CRM_Utils_Type
::T_MONEY
,
110 'title' => ts('When'),
111 'operatorType' => CRM_Report_Form
::OP_DATE
,
112 'type' => CRM_Utils_Type
::T_DATE
,
114 'log_action' => array(
115 'operatorType' => CRM_Report_Form
::OP_MULTISELECT
,
116 'options' => array('Insert' => ts('Insert'), 'Update' => ts('Update'), 'Delete' => ts('Delete')),
117 'title' => ts('Action'),
118 'type' => CRM_Utils_Type
::T_STRING
,
121 'no_display' => TRUE,
122 'type' => CRM_Utils_Type
::T_INT
,
126 'civicrm_financial_type' => array(
127 'dao' => 'CRM_Financial_DAO_FinancialType',
130 'no_display' => TRUE,
134 'title' => ts('Financial Type'),
135 'type' => CRM_Utils_Type
::T_STRING
,
139 'civicrm_contribution_status' => array(
140 'dao' => 'CRM_Core_DAO_OptionValue',
143 'no_display' => TRUE,
147 'title' => ts('Contribution Status'),
148 'type' => CRM_Utils_Type
::T_STRING
,
152 'civicrm_contact_altered_by' => array(
153 'dao' => 'CRM_Contact_DAO_Contact',
156 'no_display' => TRUE,
159 'display_name' => array(
161 'title' => ts('Altered By'),
165 'altered_by' => array(
166 'name' => 'display_name',
167 'title' => ts('Altered By'),
168 'type' => CRM_Utils_Type
::T_STRING
,
173 parent
::__construct();
176 function alterDisplay(&$rows) {
177 // cache for id → is_deleted mapping
178 $isDeleted = array();
180 foreach ($rows as & $row) {
181 if (!isset($isDeleted[$row['civicrm_contact_is_deleted']])) {
182 $isDeleted[$row['civicrm_contact_is_deleted']] = CRM_Core_DAO
::getFieldValue('CRM_Contact_DAO_Contact', $row['civicrm_contact_altered_contact_id'], 'is_deleted') !== '0';
185 if (!$isDeleted[$row['civicrm_contact_is_deleted']]) {
186 $row['civicrm_contact_altered_contact_display_name_link'] = CRM_Utils_System
::url('civicrm/contact/view', 'reset=1&cid=' . $row['log_civicrm_contribution_contact_id']);
187 $row['civicrm_contact_altered_contact_display_name_hover'] = ts('Go to contact summary');
190 $row['civicrm_contact_altered_by_display_name_link'] = CRM_Utils_System
::url('civicrm/contact/view', 'reset=1&cid=' . $row['log_civicrm_contribution_log_user_id']);
191 $row['civicrm_contact_altered_by_display_name_hover'] = ts('Go to contact summary');
193 if ($row['civicrm_contact_altered_contact_is_deleted'] and ($row['log_civicrm_contribution_log_action'] == 'Update')) {
194 $row['log_civicrm_contribution_log_action'] = ts('Delete');
197 if ($row['log_civicrm_contribution_log_action'] == 'Update') {
198 $q = "reset=1&log_conn_id={$row['log_civicrm_contribution_log_conn_id']}&log_date={$row['log_civicrm_contribution_log_date']}";
200 $q .= '&cid=' . $this->cid
;
203 $url = CRM_Report_Utils_Report
::getNextUrl('logging/contribute/detail', $q, FALSE, TRUE);
204 $row['log_civicrm_contribution_log_action_link'] = $url;
205 $row['log_civicrm_contribution_log_action_hover'] = ts('View details for this update');
206 $row['log_civicrm_contribution_log_action'] = '<div class="icon details-icon"></div> ' . ts('Update');
209 unset($row['log_civicrm_contribute_log_user_id']);
210 unset($row['log_civicrm_contribute_log_conn_id']);
216 FROM `{$this->loggingDB}`.log_civicrm_contribution {$this->_aliases['log_civicrm_contribution']}
217 LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact_altered_by']}
218 ON ({$this->_aliases['log_civicrm_contribution']}.log_user_id = {$this->_aliases['civicrm_contact_altered_by']}.id)
219 LEFT JOIN civicrm_contact {$this->_aliases['civicrm_contact_altered_contact']}
220 ON ({$this->_aliases['log_civicrm_contribution']}.contact_id = {$this->_aliases['civicrm_contact_altered_contact']}.id)
221 LEFT JOIN civicrm_financial_type {$this->_aliases['civicrm_financial_type']}
222 ON ({$this->_aliases['log_civicrm_contribution']}.financial_type_id = {$this->_aliases['civicrm_financial_type']}.id)
223 LEFT JOIN civicrm_option_value {$this->_aliases['civicrm_contribution_status']}
224 ON ({$this->_aliases['log_civicrm_contribution']}.contribution_status_id = {$this->_aliases['civicrm_contribution_status']}.value)
225 INNER JOIN civicrm_option_group
226 ON ({$this->_aliases['civicrm_contribution_status']}.option_group_id = civicrm_option_group.id
227 AND civicrm_option_group.name = 'contribution_status')