Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | class test_extension_manager_reporttest extends CRM_Core_Report { | |
4 | function __construct() { | |
5 | $logging = new CRM_Logging_Schema; | |
6 | $this->tables[] = 'civicrm_contact'; | |
7 | $this->tables = array_merge($this->tables, array_keys($logging->customDataLogTables())); | |
8 | $this->tables[] = 'civicrm_email'; | |
9 | $this->tables[] = 'civicrm_phone'; | |
10 | $this->tables[] = 'civicrm_im'; | |
11 | $this->tables[] = 'civicrm_openid'; | |
12 | $this->tables[] = 'civicrm_website'; | |
13 | $this->tables[] = 'civicrm_address'; | |
14 | $this->tables[] = 'civicrm_note'; | |
15 | $this->tables[] = 'civicrm_relationship'; | |
16 | ||
17 | $this->detail = 'logging/contact/detail'; | |
18 | $this->summary = 'logging/contact/summary'; | |
19 | ||
20 | parent::__construct(); | |
21 | } | |
22 | ||
23 | function buildQuickForm() { | |
24 | $layout = CRM_Utils_Request::retrieve('layout', 'String', $this); | |
25 | $this->assign('layout', $layout); | |
26 | ||
27 | parent::buildQuickForm(); | |
28 | ||
29 | if ($this->cid) { | |
30 | // link back to contact summary | |
31 | $this->assign('backURL', CRM_Utils_System::url('civicrm/contact/view', "reset=1&selectedChild=log&cid={$this->cid}", FALSE, NULL, FALSE)); | |
32 | $this->assign('revertURL', self::$_template->get_template_vars('revertURL') . "&cid={$this->cid}"); | |
33 | } | |
34 | else { | |
35 | // link back to summary report | |
36 | $this->assign('backURL', CRM_Report_Utils_Report::getNextUrl('logging/contact/summary', 'reset=1', FALSE, TRUE)); | |
37 | } | |
38 | } | |
39 | ||
4cbe18b8 EM |
40 | /** |
41 | * @return string | |
42 | */ | |
6a488035 TO |
43 | protected function whoWhomWhenSql() { |
44 | return " | |
45 | SELECT who.id who_id, who.display_name who_name, whom.id whom_id, whom.display_name whom_name, l.is_deleted | |
46 | FROM `{$this->db}`.log_civicrm_contact l | |
47 | JOIN civicrm_contact who ON (l.log_user_id = who.id) | |
48 | JOIN civicrm_contact whom ON (l.id = whom.id) | |
49 | WHERE log_action = 'Update' AND log_conn_id = %1 AND log_date = %2 ORDER BY log_date DESC LIMIT 1 | |
50 | "; | |
51 | } | |
52 | } |