/** * Modifies the default address form fields * * @param bool $withUpdate Execute update method of decorators? * * @return array */ public function getFormFields($withUpdate = true) { parent::getFormFields(false); if (!array_key_exists('InvoiceAddressAsShippingAddress', $this->formFields)) { foreach ($this->formFields as $fieldName => $fieldData) { $this->formFields['Invoice_' . $fieldName] = $fieldData; $this->formFields['Shipping_' . $fieldName] = $fieldData; unset($this->formFields[$fieldName]); } if (array_key_exists('Invoice_IsPackstation', $this->formFields)) { unset($this->formFields['Invoice_PostNumber']); unset($this->formFields['Invoice_Packstation']); unset($this->formFields['Invoice_IsPackstation']); } $this->formFields['InvoiceAddressAsShippingAddress'] = array('type' => 'CheckboxField', 'title' => _t('SilvercartAddress.InvoiceAddressAsShippingAddress'), 'value' => '1', 'jsEvents' => array('setEventHandler' => array('type' => 'click', 'callFunction' => 'toggleShippingAddressSection'))); $this->formFields['Email'] = array('type' => 'TextField', 'title' => _t('SilvercartAddress.EMAIL'), 'checkRequirements' => array('isEmailAddress' => true, 'isFilledIn' => true)); if ($this->UseMinimumAgeToOrder()) { $days = array('' => ''); for ($day = 1; $day <= 31; $day++) { $days[$day] = $day; } $this->formFields = array_merge($this->formFields, array('BirthdayDay' => array('type' => 'DropdownField', 'title' => _t('SilvercartPage.BIRTHDAY'), 'value' => $days, 'checkRequirements' => array('isFilledIn' => true)), 'BirthdayMonth' => array('type' => 'DropdownField', 'title' => _t('SilvercartPage.MONTH'), 'value' => SilvercartTools::getMonthMap(''), 'checkRequirements' => array('isFilledIn' => true)), 'BirthdayYear' => array('type' => 'TextField', 'title' => _t('SilvercartPage.YEAR'), 'maxLength' => 4, 'checkRequirements' => array('isFilledIn' => true, 'isNumbersOnly' => true, 'hasLength' => 4)))); } } if ($this->EnableBusinessCustomers()) { $this->formFields['Invoice_TaxIdNumber']['checkRequirements']['isFilledInDependantOn']['field'] = 'Invoice_IsBusinessAccount'; $this->formFields['Shipping_TaxIdNumber']['checkRequirements']['isFilledInDependantOn']['field'] = 'Shipping_IsBusinessAccount'; $this->formFields['Invoice_Company']['checkRequirements']['isFilledInDependantOn']['field'] = 'Invoice_IsBusinessAccount'; $this->formFields['Shipping_Company']['checkRequirements']['isFilledInDependantOn']['field'] = 'Shipping_IsBusinessAccount'; } if ($this->InvoiceAddressIsAlwaysShippingAddress()) { $this->formFields['InvoiceAddressAsShippingAddress']['type'] = 'HiddenField'; unset($this->formFields['InvoiceAddressAsShippingAddress']['jsEvents']); } if ($withUpdate && !empty($this->class)) { $this->extend('updateFormFields', $this->formFields); } return $this->formFields; }