Eileen has uploaded a new change for review.
https://gerrit.wikimedia.org/r/282095
Change subject: CRM-18214 Add link to detail report for contact merge
activities, with oid if applicable
......................................................................
CRM-18214 Add link to detail report for contact merge activities, with oid if
applicable
After merging all my other changes the only thing needed for the dedupe merge
report was it to be linked from the summary report and
to redirect after merge to the comparison of the 2 contacts, covered in this
commit
Change-Id: Ifbdbfd33cb19b85b40a46a9307f821f671a4f235
---
M CRM/Logging/ReportDetail.php
M CRM/Report/Form/Contact/LoggingSummary.php
2 files changed, 36 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm/civicrm
refs/changes/95/282095/1
diff --git a/CRM/Logging/ReportDetail.php b/CRM/Logging/ReportDetail.php
index f5c32f6..ed7ee23 100644
--- a/CRM/Logging/ReportDetail.php
+++ b/CRM/Logging/ReportDetail.php
@@ -32,6 +32,15 @@
*/
class CRM_Logging_ReportDetail extends CRM_Report_Form {
protected $cid;
+
+ /**
+ * Other contact ID.
+ *
+ * This would be set if we are viewing a merge of 2 contacts.
+ *
+ * @var int
+ */
+ protected $oid;
protected $db;
protected $log_conn_id;
protected $log_date;
@@ -248,6 +257,9 @@
$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}";
+ if ($this->oid) {
+ $q .= '&oid=' . $this->oid;
+ }
$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?'));
}
@@ -264,6 +276,7 @@
$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);
+ $this->oid = CRM_Utils_Request::retrieve('oid', 'Integer');
}
/**
@@ -332,7 +345,18 @@
$reverter->revert();
CRM_Core_Session::setStatus(ts('The changes have been reverted.'),
ts('Reverted'), 'success');
if ($this->cid) {
- CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view',
"reset=1&selectedChild=log&cid={$this->cid}", FALSE, NULL, FALSE));
+ if ($this->oid) {
+ CRM_Utils_System::redirect(CRM_Utils_System::url(
+ 'civicrm/contact/merge',
+ "reset=1&cid={$this->cid}&oid={$this->oid}",
+ FALSE,
+ NULL,
+ FALSE)
+ );
+ }
+ else {
+
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/view',
"reset=1&selectedChild=log&cid={$this->cid}", FALSE, NULL, FALSE));
+ }
}
else {
CRM_Utils_System::redirect(CRM_Report_Utils_Report::getNextUrl($this->summary,
'reset=1', FALSE, TRUE));
diff --git a/CRM/Report/Form/Contact/LoggingSummary.php
b/CRM/Report/Form/Contact/LoggingSummary.php
index 5fa106d..030191a 100644
--- a/CRM/Report/Form/Contact/LoggingSummary.php
+++ b/CRM/Report/Form/Contact/LoggingSummary.php
@@ -204,6 +204,17 @@
$row['log_civicrm_entity_altered_contact'] =
$row['log_civicrm_entity_altered_contact'] . " [{$entity}]";
}
if ($entity == 'Contact Merged') {
+ $deletedID = CRM_Core_DAO::singleValueQuery('
+ SELECT GROUP_CONCAT(contact_id) FROM civicrm_activity_contact ac
+ INNER JOIN civicrm_activity a
+ ON a.id = ac.activity_id AND a.parent_id = ' .
$row['log_civicrm_entity_id']
+ .' AND ac.record_type_id = ' .
CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact',
'record_type_id', 'Activity Targets')
+ );
+ if ($deletedID && !stristr($deletedID, ',')) {
+ $baseQueryCriteria .= '&oid=' . $deletedID;
+ }
+ $row['log_civicrm_entity_log_action'] = ts('Contact Merge');
+ $row = $this->addDetailReportLinksToRow($baseQueryCriteria, $row);
$isMerge = 1;
}
--
To view, visit https://gerrit.wikimedia.org/r/282095
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbdbfd33cb19b85b40a46a9307f821f671a4f235
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm/civicrm
Gerrit-Branch: master
Gerrit-Owner: Eileen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits