From b21026cbd5d93257f159dc8b5348baa5e2416f18 Mon Sep 17 00:00:00 2001 From: Jaap Jansma Date: Wed, 10 Nov 2021 14:10:46 +0100 Subject: [PATCH] Fix for dev/core#2948 --- CRM/Event/Form/Registration.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 12d1cfbecc4f..5ccb819dc5b9 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -686,12 +686,6 @@ public function confirmPostProcess($contactID = NULL, $contribution = NULL) { $this->set('primaryParticipant', $this->_params); } - CRM_Core_BAO_CustomValueTable::postProcess($this->_params, - 'civicrm_participant', - $participant->id, - 'Participant' - ); - $createPayment = (CRM_Utils_Array::value('amount', $this->_params, 0) != 0) ? TRUE : FALSE; // force to create zero amount payment, CRM-5095 @@ -828,6 +822,15 @@ protected function addParticipant(&$form, $contactID) { $participantParams['discount_id'] = "null"; } + $participantParams['custom'] = []; + foreach ($form->_params as $paramName => $paramValue) { + if (strpos($paramName, 'custom_') === 0) { + list($customFieldID, $customValueID) = CRM_Core_BAO_CustomField::getKeyID($paramName, TRUE); + CRM_Core_BAO_CustomField::formatCustomField($customFieldID, $participantParams['custom'], $paramValue, 'Participant', $customValueID); + + } + } + $participant = CRM_Event_BAO_Participant::create($participantParams); $transaction->commit();