[-] BO : #PSTEST-769 - The default country must be pre-selected on address list
This commit is contained in:
@@ -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>
|
||||||
|
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
@@ -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')
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
@@ -29,19 +29,19 @@ class AdminSuppliersControllerCore extends AdminController
|
|||||||
{
|
{
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->table = 'supplier';
|
$this->table = 'supplier';
|
||||||
$this->className = 'Supplier';
|
$this->className = 'Supplier';
|
||||||
|
|
||||||
$this->addRowAction('view');
|
$this->addRowAction('view');
|
||||||
$this->addRowAction('edit');
|
$this->addRowAction('edit');
|
||||||
$this->addRowAction('delete');
|
$this->addRowAction('delete');
|
||||||
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
|
||||||
|
|
||||||
$this->_select = 'COUNT(ps.`id_product`) AS products';
|
$this->_select = 'COUNT(ps.`id_product`) AS products';
|
||||||
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product_supplier` ps ON (a.`id_supplier` = ps.`id_supplier`)';
|
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'product_supplier` ps ON (a.`id_supplier` = ps.`id_supplier`)';
|
||||||
$this->_group = 'GROUP BY a.`id_supplier`';
|
$this->_group = 'GROUP BY a.`id_supplier`';
|
||||||
|
|
||||||
$this->fieldImageSettings = array('name' => 'logo', 'dir' => 'su');
|
$this->fieldImageSettings = array('name' => 'logo', 'dir' => 'su');
|
||||||
|
|
||||||
$this->fieldsDisplay = array(
|
$this->fieldsDisplay = array(
|
||||||
'id_supplier' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
'id_supplier' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
|
||||||
@@ -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')
|
||||||
),
|
),
|
||||||
@@ -292,8 +293,8 @@ class AdminSuppliersControllerCore extends AdminController
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$product_infos = Supplier::getProductInformationsBySupplier($this->object->id,
|
$product_infos = Supplier::getProductInformationsBySupplier($this->object->id,
|
||||||
$products[$i]->id,
|
$products[$i]->id,
|
||||||
0);
|
0);
|
||||||
$products[$i]->product_supplier_reference = $product_infos['product_supplier_reference'];
|
$products[$i]->product_supplier_reference = $product_infos['product_supplier_reference'];
|
||||||
$products[$i]->product_supplier_price_te = Tools::displayPrice($product_infos['product_supplier_price_te'], new Currency($product_infos['id_currency']));
|
$products[$i]->product_supplier_price_te = Tools::displayPrice($product_infos['product_supplier_price_te'], new Currency($product_infos['id_currency']));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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')
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user