From: Brian Shaughnessy Date: Sat, 23 Jan 2016 19:37:13 +0000 (-0500) Subject: CRM-17865: set participant custom field defaults on additional reg form X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dde86037ea108ab32357675a978ee040cf07102a;p=civicrm-core.git CRM-17865: set participant custom field defaults on additional reg form --- 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; }