diff --git a/controllers/admin/AdminAddressesController.php b/controllers/admin/AdminAddressesController.php index 21309cd14..477287530 100644 --- a/controllers/admin/AdminAddressesController.php +++ b/controllers/admin/AdminAddressesController.php @@ -207,237 +207,11 @@ class AdminAddressesControllerCore extends AdminController } } - public function displayForm($isMainTab = true) - { - $content = parent::displayForm(); - if (!($obj = $this->loadObject(true))) - return; - - $content .= ' -
- '.((int)($obj->id) ? '' : '').' - '.(($id_order = (int)(Tools::getValue('id_order'))) ? '' : '').' - '.(($address_type = (int)(Tools::getValue('address_type'))) ? '' : '').' - '.(Tools::getValue('realedit') ? '' : '').' -
- '.$this->l('Addresses').''; - - if ($obj->id) - { - $customer = new Customer($obj->id_customer); - $tokenCustomer = Tools::getAdminToken('AdminCustomers'.(int)(Tab::getIdFromClassName('AdminCustomers')).(int)$this->context->employee->id); - $content .= ' - - - - '; - } - else - { - $content .= - ' -
- * -
'; - } - $content .= ' - -
- -

'.$this->l('DNI / NIF / NIE').'

-
'; - - $content .= ' -
- * - '.$this->l('Invalid characters:').' <>;=#{}  -
'; - - - $addresses_fields = $this->processAddressFormat(); - $addresses_fields = $addresses_fields["dlv_all_fields"]; // we use delivery address - - foreach($addresses_fields as $addr_field_item) - { - if ($addr_field_item == 'company') - { - $content .= ' -
- - '.$this->l('Invalid characters:').' <>;=#{}  -
'; - - if ((Configuration::get('VATNUMBER_MANAGEMENT') AND file_exists(_PS_MODULE_DIR_.'vatnumber/vatnumber.php')) && VatNumber::isApplicable(Configuration::get('PS_COUNTRY_DEFAULT'))) - $content .= '
'; - else if(Configuration::get('VATNUMBER_MANAGEMENT')) - $content .= '
'; - else - $content .='
'; - - $content .= ' -
- -
-
'; - } - elseif ($addr_field_item == 'lastname') - { - $content .= ' - -
- * - '.$this->l('Invalid characters:').' 0-9!<>,;?=+()@#"�{}_$%:  -
'; - } - elseif ($addr_field_item == 'firstname') - { - - $content .= ' - -
- * - '.$this->l('Invalid characters:').' 0-9!<>,;?=+()@#"�{}_$%:  -
'; - } - elseif ($addr_field_item == 'address1') - { - - $content .= ' - -
- * -
'; - } - elseif ($addr_field_item == 'address2') - { - - $content .= ' - -
- -
'; - } - elseif ($addr_field_item == 'postcode') - { - - $content .= ' - -
- -
'; - } - elseif ($addr_field_item == 'city') - { - - $content .= ' - -
- * -
'; - } - elseif ($addr_field_item == 'country' || $addr_field_item == 'Country:name') - { - - $content .= ' - -
- * -
'; - - - $content .= ' -
- -
- - * -
-
'; - - - $id_country_ajax = (int)$this->getFieldValue($obj, 'id_country'); - - $content .= ' - '; - } - - } // End foreach - $content .= ' - -
- -
'; - - $content .= ' - -
- -
'; - - - $content .= ' - -
- - '.$this->l('Forbidden characters:').' <>;=#{}  -
'; - - $content .= ' -
- -
-
* '.$this->l('Required field').'
-
'; - $content .= ' -
'; - - return $content; - } - + /** + * Get Address formats used by the country where the address id retrieved from POST/GET is. + * + * @return array address formats + */ protected function processAddressFormat() { $tmp_addr = new Address((int)Tools::getValue("id_address")); @@ -492,7 +266,7 @@ class AdminAddressesControllerCore extends AdminController 'tokenCustomer' => isset ($tokenCustomer) ? $tokenCustomer : null )); - // Order address fields depending on country norm + // Order address fields depending on country format $addresses_fields = $this->processAddressFormat(); $addresses_fields = $addresses_fields["dlv_all_fields"]; // we use delivery address @@ -614,7 +388,6 @@ class AdminAddressesControllerCore extends AdminController parent::initContent(); } - }