From dde86037ea108ab32357675a978ee040cf07102a Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Sat, 23 Jan 2016 14:37:13 -0500 Subject: [PATCH] CRM-17865: set participant custom field defaults on additional reg form --- .../Form/Registration/AdditionalParticipant.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/CRM/Event/Form/Registration/AdditionalParticipant.php b/CRM/Event/Form/Registration/AdditionalParticipant.php index 4b30cbc9f1..d8429d6691 100644 --- a/CRM/Event/Form/Registration/AdditionalParticipant.php +++ b/CRM/Event/Form/Registration/AdditionalParticipant.php @@ -148,6 +148,19 @@ class CRM_Event_Form_Registration_AdditionalParticipant extends CRM_Event_Form_R $defaults['participant_campaign_id'] = CRM_Utils_Array::value('campaign_id', $this->_values['event']); } + //CRM-17865 set custom field defaults + if (!empty($this->_fields)) { + foreach ($this->_fields as $name => $field) { + if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) { + if (!isset($defaults[$name])) { + CRM_Core_BAO_CustomField::setProfileDefaults($customFieldID, $name, $defaults, + NULL, CRM_Profile_Form::MODE_REGISTER + ); + } + } + } + } + return $defaults; } -- 2.25.1