From b183432e22534682ec468bc1ebbb3c71ff6e09da Mon Sep 17 00:00:00 2001 From: bMancone Date: Mon, 30 Jan 2012 16:29:17 +0000 Subject: [PATCH] // Warehouses & supply orders : default country / lang / currency are now loaded by default in the forms --- controllers/admin/AdminSupplyOrdersController.php | 8 ++++++++ controllers/admin/AdminWarehousesController.php | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php index 46a94029a..ec0a72118 100644 --- a/controllers/admin/AdminSupplyOrdersController.php +++ b/controllers/admin/AdminSupplyOrdersController.php @@ -185,12 +185,20 @@ class AdminSupplyOrdersControllerCore extends AdminController //get currencies list $currencies = Currency::getCurrencies(); + $id_default_currency = Configuration::get('PS_CURRENCY_DEFAULT'); + $default_currency = Currency::getCurrency($id_default_currency); + if ($default_currency) + $currencies = array_merge(array($default_currency, '-'), $currencies); //get suppliers list $suppliers = Supplier::getSuppliers(); //get languages list $languages = Language::getLanguages(true); + $id_default_lang = Configuration::get('PS_LANG_DEFAULT'); + $default_lang = Language::getLanguage($id_default_lang); + if ($default_lang) + $languages = array_merge(array($default_lang, '-'), $languages); $this->fields_form = array( 'legend' => array( diff --git a/controllers/admin/AdminWarehousesController.php b/controllers/admin/AdminWarehousesController.php index 7adb79f6d..919072aff 100644 --- a/controllers/admin/AdminWarehousesController.php +++ b/controllers/admin/AdminWarehousesController.php @@ -137,6 +137,13 @@ class AdminWarehousesControllerCore extends AdminController $query->where('active = 1'); $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 $this->toolbar_title = $this->l('Stock : Warehouse management'); @@ -216,7 +223,7 @@ class AdminWarehousesControllerCore extends AdminController 'name' => 'id_country', 'required' => true, 'options' => array( - 'query' => Country::getCountries($this->context->language->id, false), + 'query' => $countries, 'id' => 'id_country', 'name' => 'name' ),