X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FEvent%2FForm%2FRegistration%2FRegister.php;h=f8690503d06f73a502cfab8c4d49507aa56149ea;hb=e9bb507e97adeaf13192c14ea58f56e1fa29a372;hp=72a8ef6e4217d4af24874a28b3ccaa6cb256bab9;hpb=ba0d74843bc8d374fea628929a5ceaa408b45956;p=civicrm-core.git diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 72a8ef6e42..f8690503d0 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -693,6 +693,12 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { public static function formatFieldsForOptionFull(&$form) { $priceSet = $form->get('priceSet'); $priceSetId = $form->get('priceSetId'); + $defaultPricefieldIds = array(); + if (!empty($form->_values['line_items'])) { + foreach ($form->_values['line_items'] as $lineItem) { + $defaultPricefieldIds[] = $lineItem['price_field_value_id']; + } + } if (!$priceSetId || !is_array($priceSet) || empty($priceSet) || empty($priceSet['optionsMaxValueTotal'])) { @@ -721,6 +727,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { //get the current price event price set options count. $currentOptionsCount = self::getPriceSetOptionCount($form); $recordedOptionsCount = CRM_Event_BAO_Participant::priceSetOptionsCount($form->_eventId, $skipParticipants); + $optionFullTotalAmount = 0; foreach ($form->_feeBlock as & $field) { $optionFullIds = array(); @@ -750,8 +757,17 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { ) { $isFull = TRUE; $optionFullIds[$optId] = $optId; + if ($field['html_type'] != 'Select') { + if (in_array($optId, $defaultPricefieldIds)) { + $optionFullTotalAmount += CRM_Utils_Array::value('amount', $option); + } + } + else { + if (!empty($defaultPricefieldIds) && in_array($optId, $defaultPricefieldIds)) { + unset($optionFullIds[$optId]); + } + } } - //here option is not full, //but we don't want to allow participant to increase //seats at the time of re-walking registration. @@ -777,6 +793,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { //finally get option ids in. $field['option_full_ids'] = $optionFullIds; } + $form->assign('optionFullTotalAmount', $optionFullTotalAmount); } /**