From 1dd6787e8688dd6ee38eac4894d35adba9eb95fe Mon Sep 17 00:00:00 2001 From: bMancone Date: Tue, 17 Jan 2012 17:13:57 +0000 Subject: [PATCH] // Fixed #PSTEST-501 --- classes/ProductSupplier.php | 5 ++++- controllers/admin/AdminProductsController.php | 6 +++--- controllers/admin/AdminSupplyOrdersController.php | 14 +++++++++++--- install-new/upgrade/sql/1.5.0.4.sql | 11 +++++++++++ themes/default/pdf/lang/fr.php | 2 +- translations/fr/admin.php | 3 +++ 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/classes/ProductSupplier.php b/classes/ProductSupplier.php index 478d7d435..87acb83bc 100644 --- a/classes/ProductSupplier.php +++ b/classes/ProductSupplier.php @@ -157,7 +157,10 @@ class ProductSupplierCore extends ObjectModel return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query); - return $res[0]; + if (isset($res[0])) + return $res[0]; + + return $res; } /** diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index b89fba4a3..21173c2e6 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2356,10 +2356,10 @@ class AdminProductsControllerCore extends AdminController } } // Manage defaut supplier for product - if ($new_default_supplier != 0 && $new_default_supplier != $product->id_supplier && Supplier::supplierExists($new_default_supplier)) + if ($new_default_supplier != $product->id_supplier) { - $product->id_supplier = $new_default_supplier; - $product->update(); + $this->object->id_supplier = $new_default_supplier; + $this->object->update(); } } } diff --git a/controllers/admin/AdminSupplyOrdersController.php b/controllers/admin/AdminSupplyOrdersController.php index 356350350..cddb9434b 100644 --- a/controllers/admin/AdminSupplyOrdersController.php +++ b/controllers/admin/AdminSupplyOrdersController.php @@ -300,6 +300,13 @@ class AdminSupplyOrdersControllerCore extends AdminController //specific discount display $this->object->discount_rate = Tools::ps_round($this->object->discount_rate, 4); + $this->displayInformation( + $this->l('Please note that if you wish to order products, they have to be available for the specified Supplier/Warehouse.') + .' '. + $this->l('See Catalog/Products/Your Product/Suppliers & Warehouses') + .'
'. + $this->l('Also, changing the currency or the supplier will reset the order.') + ); return parent::renderForm(); } @@ -1560,9 +1567,10 @@ class AdminSupplyOrdersControllerCore extends AdminController { $ids = explode('_', $item['id']); $prices = ProductSupplier::getProductSupplierPrice($ids[0], $ids[1], $id_supplier, true); - $item['unit_price_te'] = Tools::convertPriceFull($prices['product_supplier_price_te'], - new Currency((int)$prices['id_currency']), - new Currency($id_currency)); + if (count($prices)) + $item['unit_price_te'] = Tools::convertPriceFull($prices['product_supplier_price_te'], + new Currency((int)$prices['id_currency']), + new Currency($id_currency)); } if ($items) die(Tools::jsonEncode($items)); diff --git a/install-new/upgrade/sql/1.5.0.4.sql b/install-new/upgrade/sql/1.5.0.4.sql index c1a42393d..05b91d678 100644 --- a/install-new/upgrade/sql/1.5.0.4.sql +++ b/install-new/upgrade/sql/1.5.0.4.sql @@ -8,3 +8,14 @@ ALTER TABLE `PREFIX_category` ADD COLUMN `is_root_category` tinyint(1) NOT NULL UPDATE `PREFIX_category` SET `is_root_category` = 1 WHERE `id_category` = 1; ALTER TABLE `PREFIX_image_type` DROP `id_theme`; + +ALTER TABLE `PREFIX_specific_price_rule_condition` CHANGE `id_specific_price_rule_condition` `id_specific_price_rule_condition` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT; +ALTER TABLE `PREFIX_specific_price_rule_condition_group` CHANGE `id_specific_price_rule_condition_group` `id_specific_price_rule_condition_group` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT; + +UPDATE `PREFIX_supply_order_state_lang` +SET `name` = "order canceled" +WHERE `name` = "order fenced" AND (`id_lang` = 1 OR `id_lang` = 3 OR `id_lang` = 4 OR `id_lang` = 5); + +UPDATE `PREFIX_supply_order_state_lang` +SET `name` = "Commande cloturée" +WHERE `name` = "order fenced" AND id_lang = 2; diff --git a/themes/default/pdf/lang/fr.php b/themes/default/pdf/lang/fr.php index 124be7e24..4296ed95c 100644 --- a/themes/default/pdf/lang/fr.php +++ b/themes/default/pdf/lang/fr.php @@ -62,7 +62,7 @@ $_LANGPDF['PDF66f6e4bbd0a0af1af6b54763871dd280'] = 'Produits commandés :'; $_LANGPDF['PDF63d5049791d9d79d86e9a108b0a999ca'] = 'Référence'; $_LANGPDF['PDFf107f5a9ee4ecea58d0f29ae7959baa8'] = 'Nom'; $_LANGPDF['PDFc8ba77264f6e923f5ee35abf3108ae7c'] = 'P.U HT'; -$_LANGPDF['PDF9b8362e5321f70746e9cb8f615c28d05'] = 'Prix HT (HR)'; +$_LANGPDF['PDF9b8362e5321f70746e9cb8f615c28d05'] = 'Prix HT (HR))'; $_LANGPDF['PDF6703aa9936582b4381418f7d523370b4'] = 'Taux de remise'; $_LANGPDF['PDFa86dc2fff006afd2deb243d7e26b30e7'] = 'Prix HT (RC)'; $_LANGPDF['PDF20a34c4e30c5bbe1d3f870ac55f0d831'] = 'Taux TVA'; diff --git a/translations/fr/admin.php b/translations/fr/admin.php index 777fbc139..fb4ae422e 100644 --- a/translations/fr/admin.php +++ b/translations/fr/admin.php @@ -3292,6 +3292,9 @@ $_LANGADM['AdminSupplyOrders50cbe532b5b2f6496f426edaffe954c8'] = 'Charger automa $_LANGADM['AdminSupplyOrders3087c43f492d4127a9e129d86948cdc7'] = 'Cela va ré-initialiser la commande'; $_LANGADM['AdminSupplyOrders170c10b41413aca5c14afad4bf2b187a'] = 'Si spécifié, chaque produit dont la quantité est inférieur ou égale à cette valeur sera chargé.'; $_LANGADM['AdminSupplyOrders4bac509e41b304aae6e91e4d40015c0b'] = 'Enregistrer la commande'; +$_LANGADM['AdminSupplyOrdersfb010d572a73e208307bb7b7037fbd58'] = 'Notez que si vous voulez ajouter des produits à votre commande, ils doivent être disponibles pour le fournisseur et l\'entrepôt spécifiés ci-dessous.'; +$_LANGADM['AdminSupplyOrders76531b34e5462644fa2fd92891d02e30'] = 'Voir Catalogue/Produits/Votre produit/Fournisseurs & Enrepôts.'; +$_LANGADM['AdminSupplyOrdersabae8de803e3505ebf82c0b2be7e6b11'] = 'Par ailleurs, changer de devise ou de fournisseur ré-initialise la commande.'; $_LANGADM['AdminSupplyOrders41e96bfadfdd83863b899b6609b59902'] = 'Exporter les commandes (CSV)'; $_LANGADM['AdminSupplyOrdersb265176ea29e777067908c30b2cf4300'] = 'Exporter le détail des commandes (CSV)'; $_LANGADM['AdminSupplyOrdersef61fb324d729c341ea8ab9901e23566'] = 'Créer une commande';