jenkins-bot has submitted this change and it was merged. Change subject: CRM-18193 do not require log_date ......................................................................
CRM-18193 do not require log_date Log_date should be an optional report parameter reflecting the changes in CRM-18193 to make the connection_id unique Change-Id: I998ad45b44e37ec0607481270dba7f201230d792 --- M CRM/Logging/Differ.php M CRM/Logging/ReportDetail.php 2 files changed, 16 insertions(+), 8 deletions(-) Approvals: Ejegg: Looks good to me, approved jenkins-bot: Verified diff --git a/CRM/Logging/Differ.php b/CRM/Logging/Differ.php index 5ed8dff..b6f32f8 100644 --- a/CRM/Logging/Differ.php +++ b/CRM/Logging/Differ.php @@ -269,11 +269,16 @@ } /** - * @param $table + * Get the titles & metadata option values for the table. + * + * For custom fields the titles may change so we use the ones as at the reference date. + * + * @param string $table + * @param string $referenceDate * * @return array */ - public function titlesAndValuesForTable($table) { + public function titlesAndValuesForTable($table, $referenceDate) { // static caches for subsequent calls with the same $table static $titles = array(); static $values = array(); @@ -325,7 +330,7 @@ } } elseif (substr($table, 0, 14) == 'civicrm_value_') { - list($titles[$table], $values[$table]) = $this->titlesAndValuesForCustomDataTable($table); + list($titles[$table], $values[$table]) = $this->titlesAndValuesForCustomDataTable($table, $referenceDate); } else { $titles[$table] = $values[$table] = array(); @@ -348,17 +353,20 @@ } /** - * @param $table + * Get the field titles & option group values for the custom table as at the reference date. + * + * @param string $table + * @param string $referenceDate * * @return array */ - private function titlesAndValuesForCustomDataTable($table) { + private function titlesAndValuesForCustomDataTable($table, $referenceDate) { $titles = array(); $values = array(); $params = array( 1 => array($this->log_conn_id, 'String'), - 2 => array($this->log_date, 'String'), + 2 => array($referenceDate, 'String'), 3 => array($table, 'String'), ); diff --git a/CRM/Logging/ReportDetail.php b/CRM/Logging/ReportDetail.php index edd24f1..f5c32f6 100644 --- a/CRM/Logging/ReportDetail.php +++ b/CRM/Logging/ReportDetail.php @@ -127,7 +127,7 @@ */ public function buildRows($sql, &$rows) { // safeguard for when there aren’t any log entries yet - if (!$this->log_conn_id or !$this->log_date) { + if (!$this->log_conn_id && !$this->log_date) { return; } $this->getDiffs(); @@ -177,7 +177,7 @@ foreach ($this->diffs as $diff) { $table = $diff['table']; if (empty($metadata[$table])) { - list($metadata[$table]['titles'], $metadata[$table]['values']) = $this->differ->titlesAndValuesForTable($table); + list($metadata[$table]['titles'], $metadata[$table]['values']) = $this->differ->titlesAndValuesForTable($table, $diff['log_date']); } $values = CRM_Utils_Array::value('values', $metadata[$diff['table']], array()); $titles = $metadata[$diff['table']]['titles']; -- To view, visit https://gerrit.wikimedia.org/r/282092 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I998ad45b44e37ec0607481270dba7f201230d792 Gerrit-PatchSet: 2 Gerrit-Project: wikimedia/fundraising/crm/civicrm Gerrit-Branch: master Gerrit-Owner: Eileen <emcnaugh...@wikimedia.org> Gerrit-Reviewer: Awight <awi...@wikimedia.org> Gerrit-Reviewer: Ejegg <eeggles...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits