// Fixed revision 13573

This commit is contained in:
bMancone
2012-02-28 13:13:47 +00:00
parent 7b5ddd5039
commit 362258ede6
14 changed files with 85 additions and 45 deletions

View File

@@ -51,7 +51,7 @@ class AdminAddressesControllerCore extends AdminController
$countries = Country::getCountries($this->context->language->id);
foreach ($countries as $country)
$this->countries_array[$country['id_country']] = $country['name'];
$this->fieldsDisplay = array(
'id_address' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'firstname' => array('title' => $this->l('First name'), 'width' => 120, 'filter_key' => 'a!firstname'),
@@ -187,24 +187,42 @@ class AdminAddressesControllerCore extends AdminController
}
else if ($addr_field_item == 'lastname')
{
if (isset($customer) &&
!Tools::isSubmit('submit'.strtoupper($this->table)) &&
Validate::isLoadedObject($customer) &&
!Validate::isLoadedObject($this->object))
$default_value = $customer->lastname;
else
$default_value = '';
$temp_fields[] = array(
'type' => 'text',
'label' => $this->l('Last name'),
'name' => 'lastname',
'size' => 33,
'required' => true,
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer">&nbsp;</span>'
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer">&nbsp;</span>',
'default_value' => $default_value,
);
}
else if ($addr_field_item == 'firstname')
{
if (isset($customer) &&
!Tools::isSubmit('submit'.strtoupper($this->table)) &&
Validate::isLoadedObject($customer) &&
!Validate::isLoadedObject($this->object))
$default_value = $customer->firstname;
else
$default_value = '';
$temp_fields[] = array(
'type' => 'text',
'label' => $this->l('First name'),
'name' => 'firstname',
'size' => 33,
'required' => true,
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer">&nbsp;</span>'
'hint' => $this->l('Invalid characters:').' 0-9!<>,;?=+()@#"<22>{}_$%:<span class="hint-pointer">&nbsp;</span>',
'default_value' => $default_value,
);
}
else if ($addr_field_item == 'address1')
@@ -254,11 +272,11 @@ class AdminAddressesControllerCore extends AdminController
'label' => $this->l('Country:'),
'name' => 'id_country',
'required' => false,
'default_value' => (int)$this->context->country->id,
'options' => array(
'query' => Country::getCountries($this->context->language->id),
'id' => 'id_country',
'name' => 'name',
'preselect_country' => true,
)
);
$temp_fields[] = array(
@@ -272,17 +290,9 @@ class AdminAddressesControllerCore extends AdminController
'name' => 'name',
)
);
$this->fields_value['id_country'] = Configuration::get('PS_COUNTRY_DEFAULT');
}
}
if (isset($customer) && !Tools::isSubmit('submit'.strtoupper($this->table)) && Validate::isLoadedObject($customer) && !Validate::isLoadedObject($this->object))
{
$this->fields_value['lastname'] = $customer->lastname;
$this->fields_value['firstname'] = $customer->firstname;
}
// merge address format with the rest of the form
array_splice($this->fields_form['input'], 3, 0, $temp_fields);
@@ -373,7 +383,7 @@ class AdminAddressesControllerCore extends AdminController
Tools::redirectAdmin(Tools::getValue('back').'&conf=4');
}
}
public function processAdd($token)
{
if (Tools::getValue('submitFormAjax'))