Add 'Registered by Contact ID' to civireport
authorMatthew Wire <mjw@mjwconsult.co.uk>
Fri, 14 Oct 2022 13:52:46 +0000 (14:52 +0100)
committerMatthew Wire <mjw@mjwconsult.co.uk>
Fri, 14 Oct 2022 13:52:58 +0000 (14:52 +0100)
CRM/Report/Form/Event/ParticipantListing.php

index 6dfe2a946ccd9a26bacbeebf88d7954df346c34c..612744a1b03da381cb312555a7a0421eba46050b 100644 (file)
@@ -144,6 +144,13 @@ class CRM_Report_Form_Event_ParticipantListing extends CRM_Report_Form {
             'title' => ts('Registered by Participant Name'),
             'name' => 'registered_by_id',
           ),
+          'created_id' => array(
+            'title' => ts('Registered by Contact ID'),
+          ),
+          'registered_by_contact_name' => array(
+            'title' => ts('Registered by Contact Name'),
+            'name' => 'created_id',
+          ),
           'source' => array(
             'title' => ts('Source'),
           ),
@@ -638,6 +645,16 @@ ORDER BY  cv.label
         }
       }
 
+      // Handle registered by contact name
+      if (array_key_exists('civicrm_participant_registered_by_contact_name', $row)) {
+        $registeredByContactId = $row['civicrm_participant_registered_by_contact_name'];
+        if ($registeredByContactId) {
+          $rows[$rowNum]['civicrm_participant_registered_by_contact_name'] = CRM_Contact_BAO_Contact::displayName($registeredByContactId);
+          $rows[$rowNum]['civicrm_participant_registered_by_contact_name_link'] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $registeredByContactId, $this->_absoluteUrl);
+          $rows[$rowNum]['civicrm_participant_registered_by_contact_name_hover'] = ts('View Contact Summary for Contact that registered the participant.');
+        }
+      }
+
       // Handle value separator in Fee Level
       if (array_key_exists('civicrm_participant_participant_fee_level', $row)) {
         $feeLevel = $row['civicrm_participant_participant_fee_level'];