}
if ($this->_snippet) {
- // now fix all state country selectors
- CRM_Core_BAO_Address::fixAllStateSelects($this, $this->_defaults);
return $this->_defaults;
}
CRM_Core_BAO_UFGroup::setProfileDefaults($contactID, $fields, $this->_defaults);
}
- // now fix all state country selectors
- CRM_Core_BAO_Address::fixAllStateSelects($this, $this->_defaults);
-
// Set default payment processor as default payment_processor radio button value
if (!empty($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $pid => $value) {
}
}
+ /**
+ * @param $form
+ */
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'])) {
);
// modify options full to respect the selected fields
// options on confirmation.
- $formattedPriceSetDefaults = self::formatPriceSetParams($form, $pricesetDefaultOptions);
+ $formattedPriceSetDefaults = self::formatPriceSetParams($form, $pricesetDefaults);
// to skip current registered participants fields option count on confirmation.
$skipParticipants[] = $form->_participantId;
//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();
) {
$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.
if ($count &&
- $form->_allowConfirmation &&
+ !empty($form->_allowConfirmation) &&
!empty($formattedPriceSetDefaults)
) {
- if (empty($formattedPriceSetDefaults["price_{$field}"]) || empty($formattedPriceSetDefaults["price_{$fieldId}"][$opId])) {
+ if (empty($formattedPriceSetDefaults["price_{$field}"]) || empty($formattedPriceSetDefaults["price_{$fieldId}"][$optId])) {
$optionFullIds[$optId] = $optId;
$isFull = TRUE;
}
//finally get option ids in.
$field['option_full_ids'] = $optionFullIds;
}
+ $form->assign('optionFullTotalAmount', $optionFullTotalAmount);
}
/**
$errors['payment_processor'] = ts('Please select a Payment Method');
}
if (is_array($self->_paymentProcessor)) {
- $payment = CRM_Core_Payment::singleton($self->_mode, $self->_paymentProcessor, $this);
+ $payment = CRM_Core_Payment::singleton($self->_mode, $self->_paymentProcessor);
$error = $payment->checkConfig($self->_mode);
if ($error) {
$errors['_qf_default'] = $error;
if ($greetingType = CRM_Utils_Array::value($greeting, $fields)) {
$customizedValue = CRM_Core_OptionGroup::getValue($greeting, 'Customized', 'name');
if ($customizedValue == $greetingType && empty($fields[$greeting . '_custom'])) {
- $errors[$customizedGreeting] = ts('Custom %1 is a required field if %1 is of type Customized.',
+ $errors[$greeting . '_custom'] = ts('Custom %1 is a required field if %1 is of type Customized.',
array(1 => ucwords(str_replace('_', ' ', $greeting)))
);
}
* access public
*
*/
+ /**
+ * @param $params
+ * @param null $contactID
+ */
public function processRegistration($params, $contactID = NULL) {
$session = CRM_Core_Session::singleton();
$this->_participantInfo = array();