From ebc8dcbc5a4121a68fd04048bfc78429f6689207 Mon Sep 17 00:00:00 2001 From: yashodha Date: Tue, 2 Apr 2019 13:53:58 +0530 Subject: [PATCH] (dev/core#835) Expose Registered by Participant Name field to participant report --- CRM/Report/Form/Event/ParticipantListing.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/CRM/Report/Form/Event/ParticipantListing.php b/CRM/Report/Form/Event/ParticipantListing.php index c9be9e8143..2becb22fce 100644 --- a/CRM/Report/Form/Event/ParticipantListing.php +++ b/CRM/Report/Form/Event/ParticipantListing.php @@ -155,6 +155,10 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form { 'registered_by_id' => array( 'title' => ts('Registered by Participant ID'), ), + 'registered_by_name' => array( + 'title' => ts('Registered by Participant Name'), + 'name' => 'registered_by_id' + ), 'source' => array( 'title' => ts('Source'), ), @@ -645,7 +649,6 @@ ORDER BY cv.label public function alterDisplay(&$rows) { $entryFound = FALSE; $eventType = CRM_Core_OptionGroup::values('event_type'); - $financialTypes = CRM_Contribute_PseudoConstant::financialType(); $contributionStatus = CRM_Contribute_PseudoConstant::contributionStatus(); $paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument(); @@ -694,7 +697,18 @@ ORDER BY cv.label $entryFound = TRUE; } - // Handel value seperator in Fee Level + // Handle registered by name + if (array_key_exists('civicrm_participant_registered_by_name', $row)) { + $registeredById = $row['civicrm_participant_registered_by_name']; + if ($registeredById) { + $registeredByContactId = CRM_Core_DAO::getFieldValue("CRM_Event_DAO_Participant", $registeredById, 'contact_id', 'id'); + $rows[$rowNum]['civicrm_participant_registered_by_name'] = CRM_Contact_BAO_Contact::displayName($registeredByContactId); + $rows[$rowNum]['civicrm_participant_registered_by_name_link'] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $registeredByContactId, $this->_absoluteUrl); + $rows[$rowNum]['civicrm_participant_registered_by_name_hover'] = ts('View Contact Summary for Contact that registered the participant.'); + } + } + + // Handle value seperator in Fee Level if (array_key_exists('civicrm_participant_participant_fee_level', $row)) { $feeLevel = $row['civicrm_participant_participant_fee_level']; if ($feeLevel) { -- 2.25.1