X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FLogging%2FReportDetail.php;h=5a8e09b3af4eddbe821cbc7114a566021ec542ac;hb=4014394ebf74035cc7cc8bee5b37e8057f2c96b2;hp=9ea2c484c826a9cb32ea909f5ecab2b0691b6cc2;hpb=af28befddd8f5e9c91a0560138fbba2654c0acc2;p=civicrm-core.git diff --git a/CRM/Logging/ReportDetail.php b/CRM/Logging/ReportDetail.php index 9ea2c484c8..5a8e09b3af 100644 --- a/CRM/Logging/ReportDetail.php +++ b/CRM/Logging/ReportDetail.php @@ -1,9 +1,9 @@ _add2groupSupported = FALSE; @@ -57,6 +64,10 @@ class CRM_Logging_ReportDetail extends CRM_Report_Form { $this->cid = CRM_Utils_Request::retrieve('cid', 'Integer', CRM_Core_DAO::$_nullObject); $this->raw = CRM_Utils_Request::retrieve('raw', 'Boolean', CRM_Core_DAO::$_nullObject); + $this->altered_name = CRM_Utils_Request::retrieve('alteredName', 'String', CRM_Core_DAO::$_nullObject); + $this->altered_by = CRM_Utils_Request::retrieve('alteredBy', 'String', CRM_Core_DAO::$_nullObject); + $this->altered_by_id = CRM_Utils_Request::retrieve('alteredById', 'Integer', CRM_Core_DAO::$_nullObject); + parent::__construct(); CRM_Utils_System::resetBreadCrumb(); @@ -101,8 +112,15 @@ class CRM_Logging_ReportDetail extends CRM_Report_Form { ); } + /** + * @param bool $applyLimit + */ function buildQuery($applyLimit = TRUE) {} + /** + * @param $sql + * @param $rows + */ function buildRows($sql, &$rows) { // safeguard for when there aren’t any log entries yet if (!$this->log_conn_id or !$this->log_date) { @@ -120,6 +138,11 @@ class CRM_Logging_ReportDetail extends CRM_Report_Form { } } + /** + * @param $table + * + * @return array + */ protected function diffsInTable($table) { $rows = array(); @@ -152,20 +175,24 @@ class CRM_Logging_ReportDetail extends CRM_Report_Form { continue; } - // CRM-7251: special-case preferred_communication_method - if ($field == 'preferred_communication_method') { - $froms = array(); - $tos = array(); - foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $from) as $val) $froms[] = CRM_Utils_Array::value($val, $values[$field]); - foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, $to) as $val) $tos[] = CRM_Utils_Array::value($val, $values[$field]); + // special-case for multiple values. Also works for CRM-7251: preferred_communication_method + if ((substr($from, 0, 1) == CRM_Core_DAO::VALUE_SEPARATOR && + substr($from, -1, 1) == CRM_Core_DAO::VALUE_SEPARATOR) || + (substr($to, 0, 1) == CRM_Core_DAO::VALUE_SEPARATOR && + substr($to, -1, 1) == CRM_Core_DAO::VALUE_SEPARATOR)) { + $froms = $tos = array(); + foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($from, CRM_Core_DAO::VALUE_SEPARATOR)) as $val) { + $froms[] = CRM_Utils_Array::value($val, $values[$field]); + } + foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($to, CRM_Core_DAO::VALUE_SEPARATOR)) as $val) { + $tos[] = CRM_Utils_Array::value($val, $values[$field]); + } $from = implode(', ', array_filter($froms)); - $to = implode(', ', array_filter($tos)); + $to = implode(', ', array_filter($tos)); } if (isset($values[$field][$from])) { - $from = $values[$field][$from]; - } if (isset($values[$field][$to])) { $to = $values[$field][$to]; @@ -195,22 +222,16 @@ class CRM_Logging_ReportDetail extends CRM_Report_Form { 2 => array($this->log_date, 'String'), ); - // let the template know who updated whom when - $dao = CRM_Core_DAO::executeQuery($this->whoWhomWhenSql(), $params); - if ($dao->fetch()) { - $this->assign('who_url', CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$dao->who_id}")); - $this->assign('whom_url', CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$dao->whom_id}")); - $this->assign('who_name', $dao->who_name); - $this->assign('whom_name', $dao->whom_name); - } + $this->assign('whom_url', CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->cid}")); + $this->assign('who_url', CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->altered_by_id}")); + $this->assign('whom_name', $this->altered_name); + $this->assign('who_name', $this->altered_by); + $this->assign('log_date', CRM_Utils_Date::mysqlToIso($this->log_date)); $q = "reset=1&log_conn_id={$this->log_conn_id}&log_date={$this->log_date}"; $this->assign('revertURL', CRM_Report_Utils_Report::getNextUrl($this->detail, "$q&revert=1", FALSE, TRUE)); $this->assign('revertConfirm', ts('Are you sure you want to revert all these changes?')); } - - // redefine this accordingly in ancestors for buildQuickForm()’s sake - protected function whoWhomWhenSql() {} }