From: Jaap Jansma Date: Wed, 10 Nov 2021 13:10:46 +0000 (+0100) Subject: Fix for dev/core#2948 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b21026cbd5d93257f159dc8b5348baa5e2416f18;p=civicrm-core.git Fix for dev/core#2948 --- diff --git a/CRM/Event/Form/Registration.php b/CRM/Event/Form/Registration.php index 12d1cfbecc..5ccb819dc5 100644 --- a/CRM/Event/Form/Registration.php +++ b/CRM/Event/Form/Registration.php @@ -686,12 +686,6 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $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 @@ class CRM_Event_Form_Registration extends CRM_Core_Form { $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();