// merge 1.4 (5397)
This commit is contained in:
@@ -59,7 +59,35 @@ class AdminCountries extends AdminTab
|
||||
if (isset($_GET['delete'.$this->table]) OR Tools::getValue('submitDel'.$this->table))
|
||||
$this->_errors[] = Tools::displayError('You cannot delete a country. If you do not want it available for customers, please disable it.');
|
||||
else
|
||||
{
|
||||
if (Tools::getValue('submitAdd'.$this->table))
|
||||
{
|
||||
$id_country = Tools::getValue('id_country');
|
||||
$tmp_addr_format = new AddressFormat($id_country);
|
||||
|
||||
$save_status = false;
|
||||
|
||||
$is_new = is_null($tmp_addr_format->id_country);
|
||||
if ($is_new)
|
||||
{
|
||||
$tmp_addr_format = new AddressFormat();
|
||||
$tmp_addr_format->id_country = $id_country;
|
||||
}
|
||||
|
||||
$tmp_addr_format->format = Tools::getValue('address_layout');
|
||||
if (strlen($tmp_addr_format->format) > 0)
|
||||
{
|
||||
if ($tmp_addr_format->checkFormatFields())
|
||||
$save_status = ($is_new) ? $tmp_addr_format->save(): $tmp_addr_format->update();
|
||||
|
||||
if (!$save_status)
|
||||
$this->_errors[] = Tools::displayError('Invalid address layout'.Db::getInstance()->getMsgError());
|
||||
}
|
||||
unset($tmp_addr_format);
|
||||
}
|
||||
|
||||
return parent::postProcess();
|
||||
}
|
||||
}
|
||||
|
||||
public function displayForm($isMainTab = true)
|
||||
@@ -113,6 +141,7 @@ class AdminCountries extends AdminTab
|
||||
$zones = Zone::getZones();
|
||||
foreach ($zones AS $zone)
|
||||
echo ' <option value="'.(int)($zone['id_zone']).'"'.(($this->getFieldValue($obj, 'id_zone') == $zone['id_zone']) ? ' selected="selected"' : '').'>'.$zone['name'].'</option>';
|
||||
$address_layout = AddressFormat::getAddressCountryFormat($obj->id);
|
||||
echo ' </select>
|
||||
<p>'.$this->l('Geographical zone where country is located').'</p>
|
||||
</div>
|
||||
@@ -128,6 +157,12 @@ class AdminCountries extends AdminTab
|
||||
<input type="text" name="zip_code_format" id="zip_code_format" value="'.$this->getFieldValue($obj, 'zip_code_format').'" onkeyup="$(\'#zip_code_format\').val($(\'#zip_code_format\').val().toUpperCase());" /> <sup>*</sup>
|
||||
<p>'.$this->l('National zip code (L for a letter, N for a number and C for the Iso code), e.g., NNNNN for France. No verification if undefined').'.</p>
|
||||
</div>
|
||||
<label class="address_layout">'.$this->l('Address layout:').' </label>
|
||||
<div class="margin-form" style="vertical-align: top;">
|
||||
<p style="float: left;"><textarea id="ordered_fields" name="address_layout" style="width: 300px;height: 120px;">'.$address_layout.'</textarea></p>
|
||||
<p style="float: left;margin-left: 10px;"><a href="#" onClick="$(\'textarea#ordered_fields\').val(unescape(\''.urlencode($address_layout).'\'.replace(/\+/g, \' \')));return false;" class="button">'.$this->l('Reset address layout').'</a></p>
|
||||
<p class="clear">'.$this->l('Possible fields :').' '.implode(', ', (Address::getDispFieldsValidate())).'</p>
|
||||
</div>
|
||||
<label>'.$this->l('Status:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="active" id="active_on" value="1" '.((!$obj->id OR $this->getFieldValue($obj, 'active')) ? 'checked="checked" ' : '').'/>
|
||||
@@ -150,6 +185,14 @@ class AdminCountries extends AdminTab
|
||||
<input type="radio" name="need_identification_number" id="need_identification_number_off" value="0" '.((!$this->getFieldValue($obj, 'need_identification_number') AND $obj->id) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="need_identification_number_off"> <img src="../img/admin/disabled.gif" alt="" title="" />'.$this->l('No').'</label>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<label>'.$this->l('Display tax label:').' </label>
|
||||
<div class="margin-form">
|
||||
<input type="radio" name="display_tax_label" id="display_tax_label_on" value="1" '.((!$obj->id OR $this->getFieldValue($obj, 'display_tax_label')) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="display_tax_label_on"> <img src="../img/admin/enabled.gif" alt="" title="" />'.$this->l('Yes').'</label>
|
||||
<input type="radio" name="display_tax_label" id="display_tax_label_off" value="0" '.((!$this->getFieldValue($obj, 'display_tax_label') AND $obj->id) ? 'checked="checked" ' : '').'/>
|
||||
<label class="t" for="display_tax_label_off"> <img src="../img/admin/disabled.gif" alt="" title="" />'.$this->l('No').'</label>
|
||||
</div>
|
||||
<div class="margin-form">
|
||||
<input type="submit" value="'.$this->l(' Save ').'" name="submitAdd'.$this->table.'" class="button" />
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user