From 5774b54f47445de233daa85672ce4f793dff347a Mon Sep 17 00:00:00 2001 From: Patrick Figel Date: Fri, 14 Jun 2019 20:26:45 +0200 Subject: [PATCH] Fix row ID input not being added for delete form This fixes an issue where the hidden "id" element wasn't added because the CRM_Core_Action::DELETE handler has an early return. --- CRM/Contribute/Form/Contribution.php | 5 ++++- CRM/Event/Form/Participant.php | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index d7149e5d09..79a4db615d 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -466,6 +466,10 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP * Build the form object. */ public function buildQuickForm() { + if ($this->_id) { + $this->add('hidden', 'id', $this->_id); + } + if ($this->_action & CRM_Core_Action::DELETE) { $this->addButtons([ [ @@ -824,7 +828,6 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP // if contribution is related to membership or participant freeze Financial Type, Amount if ($this->_id) { - $this->add('hidden', 'id', $this->_id); $componentDetails = CRM_Contribute_BAO_Contribution::getComponentDetails($this->_id); $isCancelledStatus = ($this->_values['contribution_status_id'] == CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Cancelled')); diff --git a/CRM/Event/Form/Participant.php b/CRM/Event/Form/Participant.php index a1b1c61c17..fc7b0547f3 100644 --- a/CRM/Event/Form/Participant.php +++ b/CRM/Event/Form/Participant.php @@ -594,6 +594,10 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment * @throws \CiviCRM_API3_Exception */ public function buildQuickForm() { + if ($this->_id) { + $this->add('hidden', 'id', $this->_id); + } + $participantStatuses = CRM_Event_PseudoConstant::participantStatus(); $partiallyPaidStatusId = array_search('Partially paid', $participantStatuses); $this->assign('partiallyPaidStatusId', $partiallyPaidStatusId); @@ -689,7 +693,6 @@ class CRM_Event_Form_Participant extends CRM_Contribute_Form_AbstractEditPayment if ($this->_id) { $this->assign('entityID', $this->_id); - $this->add('hidden', 'id', $this->_id); } $this->addSelect('role_id', ['multiple' => TRUE, 'class' => 'huge'], TRUE); -- 2.25.1