From e03ee8d840baa69724c414f0e821ec8f710f45b5 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 28 Sep 2023 10:37:04 +1300 Subject: [PATCH] Simplify check for additional participants --- CRM/Event/Form/Participant/Delete.php | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/CRM/Event/Form/Participant/Delete.php b/CRM/Event/Form/Participant/Delete.php index 1ff6f7cce5..39c08340e3 100644 --- a/CRM/Event/Form/Participant/Delete.php +++ b/CRM/Event/Form/Participant/Delete.php @@ -16,8 +16,6 @@ * @copyright CiviCRM LLC https://civicrm.org/licensing */ -use Civi\API\EntityLookupTrait; - /** * Back office participant delete form. */ @@ -103,12 +101,10 @@ class CRM_Event_Form_Participant_Delete extends CRM_Contribute_Form_AbstractEdit * @throws \CRM_Core_Exception */ public function buildQuickForm(): void { - $additionalParticipant = count(CRM_Event_BAO_Event::buildCustomProfile($this->getParticipantID(), - NULL, - $this->getParticipantValue('contact_id'), - FALSE, - TRUE - )) - 1; + $additionalParticipant = (int) CRM_Core_DAO::singleValueQuery( + 'SELECT count(*) FROM civicrm_participant WHERE registered_by_id = %1 AND id <> registered_by_id', + [1 => [$this->getParticipantID(), 'Integer']] + ); if ($additionalParticipant) { $deleteParticipants = [ 1 => ts('Delete this participant record along with associated participant record(s).'), -- 2.25.1