X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FEvent%2FForm%2FParticipantFeeSelection.php;h=7e4498c81b39a58b37380c34993eba33318e0047;hb=af8b12dbd37b41a0fec3db2b5d1f23e0b0430649;hp=1573307296a55a4bd74797c59d4de3d079fd9091;hpb=71f4f2c6d8bd9e3a4a121bf47d0cc86aa8af0f33;p=civicrm-core.git diff --git a/CRM/Event/Form/ParticipantFeeSelection.php b/CRM/Event/Form/ParticipantFeeSelection.php index 1573307296..7e4498c81b 100644 --- a/CRM/Event/Form/ParticipantFeeSelection.php +++ b/CRM/Event/Form/ParticipantFeeSelection.php @@ -129,10 +129,17 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { $priceSetId = CRM_Price_BAO_PriceSet::getFor('civicrm_event', $this->_eventId); $priceSetValues = CRM_Event_Form_EventFees::setDefaultPriceSet($this->_participantId, $this->_eventId, FALSE); + $priceFieldId = (array_keys($this->_values['fee'])); if (!empty($priceSetValues)) { $defaults[$this->_participantId] = array_merge($defaults[$this->_participantId], $priceSetValues); } - + else { + foreach($priceFieldId as $key => $value) { + if (!empty($value) && ($this->_values['fee'][$value]['html_type'] == 'Radio' || $this->_values['fee'][$value]['html_type'] == 'Select') && !$this->_values['fee'][$value]['is_required']) { + $defaults[$this->_participantId]['price_'.array_keys($this->_values['fee'])[$key]] = 0; + } + } + } $this->assign('totalAmount', CRM_Utils_Array::value('fee_amount', $defaults[$this->_participantId])); if ($this->_action == CRM_Core_Action::UPDATE) { $fee_level = $defaults[$this->_participantId]['fee_level']; @@ -213,7 +220,14 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { $this->addFormRule(array('CRM_Event_Form_ParticipantFeeSelection', 'formRule'), $this); } - static function formRule($fields, $files, $self) { + /** + * @param $fields + * @param $files + * @param $self + * + * @return array + */ + public static function formRule($fields, $files, $self) { $errors = array(); return $errors; } @@ -256,7 +270,12 @@ class CRM_Event_Form_ParticipantFeeSelection extends CRM_Core_Form { } } - function emailReceipt(&$params) { + /** + * @param array $params + * + * @return mixed + */ + public function emailReceipt(&$params) { $updatedLineItem = CRM_Price_BAO_LineItem::getLineItems($this->_participantId, 'participant', NULL, FALSE); $lineItem = array(); if ($updatedLineItem) {