[-] BO : #PSTEST-769 - The default country must be pre-selected on address list

This commit is contained in:
mDeflotte committed 2012-02-16 14:13:04 +00:00
1 parent 499b6af5b5
commit a52f8c38ee
8 files changed
+42 -17

No files matched your search

@@ -171,20 +171,44 @@
<option value="{$option->$input.options.id}" <option value="{$option->$input.options.id}"
{if isset($input.multiple)} {if isset($input.multiple)}
{foreach $fields_value[$input.name] as $field_value} {foreach $fields_value[$input.name] as $field_value}
{if $field_value == $option->$input.options.id}selected="selected"{/if} {if $field_value == $option->$input.options.id
|| empty($field_value)
&& isset($input.options.preselect_country)
&& isset($input.options.preselect_country)
&& $option->$input.options.id == $default_country}
selected="selected"
{/if}
{/foreach} {/foreach}
{else} {else}
{if $fields_value[$input.name] == $option->$input.options.id}selected="selected"{/if} {if $fields_value[$input.name] == $option->$input.options.id
|| empty($fields_value[$input.name])
&& isset($input.options.preselect_country)
&& isset($input.options.preselect_country)
&& $option->$input.options.id == $default_country}}
selected="selected"
{/if}
{/if} {/if}
>{$option->$input.options.name}</option> >{$option->$input.options.name}</option>
{else} {else}
<option value="{$option[$input.options.id]}" <option value="{$option[$input.options.id]}"
{if isset($input.multiple)} {if isset($input.multiple)}
{foreach $fields_value[$input.name] as $field_value} {foreach $fields_value[$input.name] as $field_value}
{if $field_value == $option[$input.options.id]}selected="selected"{/if} {if $field_value == $option[$input.options.id]
|| empty($field_value)
&& isset($input.options.preselect_country)
&& isset($input.options.preselect_country)
&& $option[$input.options.id] == $default_country}}
selected="selected"
{/if}
{/foreach} {/foreach}
{else} {else}
{if $fields_value[$input.name] == $option[$input.options.id]}selected="selected"{/if} {if $fields_value[$input.name] == $option[$input.options.id]
|| empty($fields_value[$input.name])
&& isset($input.options.preselect_country)
&& isset($input.options.preselect_country)
&& $option[$input.options.id] == $default_country}}
selected="selected"
{/if}
{/if} {/if}
>{$option[$input.options.name]}</option> >{$option[$input.options.name]}</option>
+1
View File
@@ -160,6 +160,7 @@ class HelperFormCore extends Helper
'form_id' => $this->id, 'form_id' => $this->id,
'fields' => $this->fields_form, 'fields' => $this->fields_form,
'fields_value' => $this->fields_value, 'fields_value' => $this->fields_value,
'default_country' => (int)(Configuration::get('PS_SHOP_COUNTRY_ID') ? Configuration::get('PS_SHOP_COUNTRY_ID') : Configuration::get('PS_COUNTRY_DEFAULT')),
'required_fields' => $this->getFieldsRequired(), 'required_fields' => $this->getFieldsRequired(),
'vat_number' => file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php'), 'vat_number' => file_exists(_PS_MODULE_DIR_.'vatnumber/ajax.php'),
'module_dir' => _MODULE_DIR_, 'module_dir' => _MODULE_DIR_,
@@ -257,7 +257,8 @@ class AdminAddressesControllerCore extends AdminController
'options' => array( 'options' => array(
'query' => Country::getCountries($this->context->language->id), 'query' => Country::getCountries($this->context->language->id),
'id' => 'id_country', 'id' => 'id_country',
'name' => 'name' 'name' => 'name',
'preselect_country' => true,
) )
); );
$temp_fields[] = array( $temp_fields[] = array(
@@ -460,7 +460,8 @@ class AdminManufacturersControllerCore extends AdminController
'options' => array( 'options' => array(
'query' => Country::getCountries($this->context->language->id), 'query' => Country::getCountries($this->context->language->id),
'id' => 'id_country', 'id' => 'id_country',
'name' => 'name' 'name' => 'name',
'preselect_country' => true,
) )
); );
$form['input'][] = array( $form['input'][] = array(
+2 -1
View File
@@ -127,7 +127,8 @@ class AdminStatesControllerCore extends AdminController
'options' => array( 'options' => array(
'query' => Country::getCountries($this->context->language->id, false, true), 'query' => Country::getCountries($this->context->language->id, false, true),
'id' => 'id_country', 'id' => 'id_country',
'name' => 'name' 'name' => 'name',
'preselect_country' => true,
), ),
'desc' => $this->l('Country where state, region or city is located') 'desc' => $this->l('Country where state, region or city is located')
), ),
+2 -1
View File
@@ -183,7 +183,8 @@ class AdminStoresControllerCore extends AdminController
'options' => array( 'options' => array(
'query' => Country::getCountries($this->context->language->id), 'query' => Country::getCountries($this->context->language->id),
'id' => 'id_country', 'id' => 'id_country',
'name' => 'name' 'name' => 'name',
'preselect_country' => true,
) )
), ),
array( array(
@@ -141,7 +141,8 @@ class AdminSuppliersControllerCore extends AdminController
'options' => array( 'options' => array(
'query' => Country::getCountries($this->context->language->id, false), 'query' => Country::getCountries($this->context->language->id, false),
'id' => 'id_country', 'id' => 'id_country',
'name' => 'name' 'name' => 'name',
'preselect_country' => true,
), ),
'desc' => $this->l('Country where the state, region or city is located') 'desc' => $this->l('Country where the state, region or city is located')
), ),
@@ -137,12 +137,6 @@ class AdminWarehousesControllerCore extends AdminController
$query->where('active = 1'); $query->where('active = 1');
$employees_array = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); $employees_array = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
// sets countries
$countries = Country::getCountries($this->context->language->id, false);
$id_default_country = Configuration::get('PS_SHOP_COUNTRY_ID');
if (isset($countries[$id_default_country]))
$countries = array($id_default_country => $countries[$id_default_country]) + $countries;
// sets the title of the toolbar // sets the title of the toolbar
$this->toolbar_title = $this->l('Stock : Warehouse management'); $this->toolbar_title = $this->l('Stock : Warehouse management');
@@ -222,9 +216,10 @@ class AdminWarehousesControllerCore extends AdminController
'name' => 'id_country', 'name' => 'id_country',
'required' => true, 'required' => true,
'options' => array( 'options' => array(
'query' => $countries, 'query' => Country::getCountries($this->context->language->id, false),
'id' => 'id_country', 'id' => 'id_country',
'name' => 'name' 'name' => 'name',
'preselect_country' => true,
), ),
'desc' => $this->l('Country where the state, region or city is located') 'desc' => $this->l('Country where the state, region or city is located')
), ),