Import from SVN (r45945, r596)
[civicrm-core.git] / CRM / Report / Form / Contribute / LoggingDetail.php
1 <?php
2 // $Id$
3
4 /*
5 +--------------------------------------------------------------------+
6 | CiviCRM version 4.3 |
7 +--------------------------------------------------------------------+
8 | Copyright CiviCRM LLC (c) 2004-2013 |
9 +--------------------------------------------------------------------+
10 | This file is a part of CiviCRM. |
11 | |
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. |
15 | |
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. |
20 | |
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 +--------------------------------------------------------------------+
28 */
29
30 /**
31 *
32 * @package CRM
33 * @copyright CiviCRM LLC (c) 2004-2013
34 * $Id$
35 *
36 */
37 class CRM_Report_Form_Contribute_LoggingDetail extends CRM_Logging_ReportDetail {
38 function __construct() {
39 $logging = new CRM_Logging_Schema;
40 $this->tables[] = 'civicrm_contribution';
41 $this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables()));
42
43 $this->detail = 'logging/contribute/detail';
44 $this->summary = 'logging/contribute/summary';
45
46 parent::__construct();
47 }
48
49 function buildQuickForm() {
50 parent::buildQuickForm();
51
52 // link back to summary report
53 $this->assign('backURL', CRM_Report_Utils_Report::getNextUrl('logging/contribute/summary', 'reset=1', FALSE, TRUE));
54 }
55
56 protected function whoWhomWhenSql() {
57 return "
58 SELECT who.id who_id, who.display_name who_name, whom.id whom_id, whom.display_name whom_name
59 FROM `{$this->db}`.log_civicrm_contribution l
60 LEFT JOIN civicrm_contact who ON (l.log_user_id = who.id)
61 LEFT JOIN civicrm_contact whom ON (l.contact_id = whom.id)
62 WHERE log_action = 'Update' AND log_conn_id = %1 AND log_date = %2 ORDER BY log_date DESC LIMIT 1
63 ";
64 }
65 }
66