From 945de6d7a3fcfce7787c7aecc5e71c8da402b9d2 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Fri, 4 Aug 2023 10:22:40 +1200 Subject: [PATCH] Enotice fix --- CRM/Event/Form/ParticipantView.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/CRM/Event/Form/ParticipantView.php b/CRM/Event/Form/ParticipantView.php index bbb20b45ca..22065995e1 100644 --- a/CRM/Event/Form/ParticipantView.php +++ b/CRM/Event/Form/ParticipantView.php @@ -59,26 +59,22 @@ class CRM_Event_Form_ParticipantView extends CRM_Core_Form { $this->assign('componentId', $participantID); $this->assign('component', 'event'); - if ($parentParticipantId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', - $participantID, 'registered_by_id' - ) - ) { - $parentHasPayment = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', - $parentParticipantId, 'id', 'participant_id' - ); - $this->assign('parentHasPayment', $parentHasPayment); - } + $parentParticipantID = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', + $participantID, 'registered_by_id'); + $this->assign('parentHasPayment', !$parentParticipantID ? NULL : CRM_Core_DAO::getFieldValue('CRM_Event_DAO_ParticipantPayment', + $parentParticipantID, 'id', 'participant_id' + )); $statusId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $participantID, 'status_id', 'id'); $status = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_ParticipantStatusType', $statusId, 'name', 'id'); - if ($status == 'Transferred') { + if ($status === 'Transferred') { $transferId = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $participantID, 'transferred_to_contact_id', 'id'); $pid = CRM_Core_DAO::getFieldValue('CRM_Event_BAO_Participant', $transferId, 'id', 'contact_id'); $transferName = current(CRM_Contact_BAO_Contact::getContactDetails($transferId)); $this->assign('pid', $pid); $this->assign('transferId', $transferId); - $this->assign('transferName', $transferName); } + $this->assign('transferName', $transferName ?? NULL); // CRM-20879: Show 'Transfer or Cancel' option beside 'Change fee selection' // only if logged in user have 'edit event participants' permission and -- 2.25.1