X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FEvent%2FForm%2FRegistration%2FRegister.php;h=3e785fdf571b0396327a3b4cd001a07272e01fb5;hb=bfe40b9d5943fe00b74e9f618161f2c4d16cab19;hp=91db147f1ffd7797f4c357ec6c9d20c8eb647b63;hpb=5814c24398cb1414917963edcf0fbbdb469ffbf8;p=civicrm-core.git diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 91db147f1f..3e785fdf57 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -142,17 +142,24 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } $this->_defaults = array(); $contactID = $this->getContactID(); - if ($contactID) { - //@todo CRM-11915 I observed that even when the billing block is not present the routine to retrieve the billing defaults is still called - which seems a bit redundant. - $billingDefaults = $this->getProfileDefaults('Billing', $contactID); - $this->_defaults = array_merge($this->_defaults, $billingDefaults); - } + $billingDefaults = $this->getProfileDefaults('Billing', $contactID); + $this->_defaults = array_merge($this->_defaults, $billingDefaults); + $config = CRM_Core_Config::singleton(); // set default country from config if no country set + // note the effect of this is to set the billing country to default to the site default + // country if the person has an address but no country (for anonymous country is set above) + // this could have implications if the billing profile is filled but hidden. + // this behaviour has been in place for a while but the use of js to hide things has increased if (!CRM_Utils_Array::value("billing_country_id-{$this->_bltID}", $this->_defaults)) { $this->_defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry; } + // set default state/province from config if no state/province set + if (!CRM_Utils_Array::value("billing_state_province_id-{$this->_bltID}", $this->_defaults)) { + $this->_defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince; + } + if ($this->_snippet) { // now fix all state country selectors CRM_Core_BAO_Address::fixAllStateSelects($this, $this->_defaults); @@ -344,8 +351,9 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { if (!$this->_allowConfirmation || $this->_additionalParticipantIds) { // Hardcode maximum number of additional participants here for now. May need to make this configurable per event. // Label is value + 1, since the code sees this is ADDITIONAL participants (in addition to "self") - $additionalOptions = array('' => ts('1'), 1 => ts('2'), 2 => ts('3'), 3 => ts('4'), 4 => ts('5'), - 5 => ts('6'), 6 => ts('7'), 7 => ts('8'), 8 => ts('9'), 9 => ts('10'), + $additionalOptions = array( + '' => '1', 1 => '2', 2 => '3', 3 => '4', 4 => '5', + 5 => '6', 6 => '7', 7 => '8', 8 => '9', 9 => '10', ); $element = $this->add('select', 'additional_participants', ts('How many people are you registering?'), @@ -403,6 +411,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { $pps = array(); //@todo this processor adding fn is another one duplicated on contribute - a shared // common class would make this sort of thing extractable + $onlinePaymentProcessorEnabled = FALSE; if (!empty($this->_paymentProcessors)) { foreach ($this->_paymentProcessors as $key => $name) { if($name['billing_mode'] == 1) { @@ -832,7 +841,7 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { } if ($self->_values['event']['is_monetary']) { - if ($fields['amount'] > 0 && !isset($fields['payment_processor'])) { + if (empty($self->_requireApproval) && $fields['amount'] > 0 && !isset($fields['payment_processor'])) { $errors['payment_processor'] = ts('Please select a Payment Method'); } if (is_array($self->_paymentProcessor)) {