From 10f1a846b7bda4aa234561d853e4995f97f2afda Mon Sep 17 00:00:00 2001 From: dSevere Date: Fri, 2 Dec 2011 16:22:45 +0000 Subject: [PATCH] // Some bugs fix git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10872 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/themes/template/products/suppliers.tpl | 2 +- classes/ProductSupplier.php | 4 +++- classes/stock/Stock.php | 2 ++ classes/stock/StockManager.php | 3 ++- controllers/admin/AdminProductsController.php | 4 ++-- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/admin-dev/themes/template/products/suppliers.tpl b/admin-dev/themes/template/products/suppliers.tpl index c8e69be3f..28ba1cd86 100644 --- a/admin-dev/themes/template/products/suppliers.tpl +++ b/admin-dev/themes/template/products/suppliers.tpl @@ -49,7 +49,7 @@ - {l s='product name'} + {l s='Product name'} {l s='Supplier reference'} {l s='Unit price tax excluded'} {l s='Unit price currency'} diff --git a/classes/ProductSupplier.php b/classes/ProductSupplier.php index 41c571b60..ef88d62af 100644 --- a/classes/ProductSupplier.php +++ b/classes/ProductSupplier.php @@ -166,7 +166,9 @@ class ProductSupplierCore extends ObjectModel { $suppliers = new Collection('ProductSupplier'); $suppliers->where('a.id_product = '.(int)$id_product); - $suppliers->groupBy('a.id_supplier'); + + if ($group_by_supplier) + $suppliers->groupBy('a.id_supplier'); return $suppliers; } diff --git a/classes/stock/Stock.php b/classes/stock/Stock.php index 9b3a8dabe..434128e4a 100644 --- a/classes/stock/Stock.php +++ b/classes/stock/Stock.php @@ -90,6 +90,7 @@ class StockCore extends ObjectModel public function getFields() { $this->validateFields(); + $fields['id_warehouse'] = (int)$this->id_warehouse; $fields['id_product'] = (int)$this->id_product; $fields['id_product_attribute'] = (int)$this->id_product_attribute; @@ -99,6 +100,7 @@ class StockCore extends ObjectModel $fields['physical_quantity'] = (int)$this->physical_quantity; $fields['usable_quantity'] = (int)$this->usable_quantity; $fields['price_te'] = (float)round($this->price_te, 6); + return $fields; } diff --git a/classes/stock/StockManager.php b/classes/stock/StockManager.php index e5e65c526..4c3ebf40c 100644 --- a/classes/stock/StockManager.php +++ b/classes/stock/StockManager.php @@ -210,7 +210,8 @@ class StockManagerCore implements StockManagerInterface $products_pack = Pack::getItems($id_product, (int)Configuration::get('PS_LANG_DEFAULT')); foreach ($products_pack as $product_pack) { - $pack_id_product_attribute = Product::getDefaultAttribute($id_product_attribute, 1); //@TODO is there a better way to retrieve the product attribute assciated to the pack ? + //@TODO is there a better way to retrieve the product attribute assciated to the pack ? + $pack_id_product_attribute = Product::getDefaultAttribute($id_product_attribute, 1); $this->removeProduct($product_pack->id, $pack_id_product_attribute, $product_pack->pack_quantity * $quantity, $warehouse, $id_order); } } diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 07210c5cf..f7b3ce9fe 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -1994,7 +1994,7 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $suppliers_to_associate[] = $supplier['id_supplier']; // Delete already associated suppliers if needed - foreach ($associated_suppliers as $key => &$associated_supplier) + foreach ($associated_suppliers as $key => $associated_supplier) if (!in_array($associated_supplier->id_supplier, $suppliers_to_associate)) { $associated_supplier->delete(); @@ -3266,7 +3266,7 @@ public function getList($id_lang, $orderBy = null, $orderWay = null, $start = 0, $supplier['is_selected'] = false; $supplier['is_default'] = false; - foreach ($associated_suppliers as &$associated_supplier) + foreach ($associated_suppliers as $associated_supplier) if ($associated_supplier->id_supplier == $supplier['id_supplier']) { $associated_supplier->name = $supplier['name'];