From ada530274e0c67051bc881697b7fff85987a6deb Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Thu, 13 Apr 2017 13:58:57 +0200 Subject: [PATCH 1/2] fix --- modules/labelgenerate/AdminLabelGenerate.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/labelgenerate/AdminLabelGenerate.php b/modules/labelgenerate/AdminLabelGenerate.php index 51c2934c..b90bdc52 100644 --- a/modules/labelgenerate/AdminLabelGenerate.php +++ b/modules/labelgenerate/AdminLabelGenerate.php @@ -576,8 +576,6 @@ class AdminLabelGenerate extends AdminTab { }); '; - $this->_html .= $helperForm->renderScript(); - $this->_html .= $helperForm->renderScript(); echo $this->_html; } From 32822dbe49b0cc781dcc9a019d3b735f0a105129 Mon Sep 17 00:00:00 2001 From: Marion Muszynski Date: Thu, 13 Apr 2017 14:10:43 +0200 Subject: [PATCH 2/2] fix when order is not valid --- modules/labelgenerate/AdminLabelGenerate.php | 28 ++++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/modules/labelgenerate/AdminLabelGenerate.php b/modules/labelgenerate/AdminLabelGenerate.php index b90bdc52..d43e4f55 100644 --- a/modules/labelgenerate/AdminLabelGenerate.php +++ b/modules/labelgenerate/AdminLabelGenerate.php @@ -57,8 +57,10 @@ class AdminLabelGenerate extends AdminTab { $result_quantities = Db::getInstance()->executeS(' SELECT od.`product_quantity`,od.`product_quantity_reinjected` FROM '._DB_PREFIX_.'order_detail od + LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`) WHERE od.`product_id` = ' . (int)$combination['id_product'] .' - AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'] + AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'].' + AND o.valid != 0' ); $quantity = 0; foreach ($result_quantities as $od) { @@ -72,7 +74,8 @@ class AdminLabelGenerate extends AdminTab { $result_quantities = Db::getInstance()->executeS(' SELECT od.`product_quantity`,od.`product_quantity_reinjected` FROM '._DB_PREFIX_.'order_detail od - WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0' + LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`) + WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0 AND o.valid != 0' ); $quantity = 0; foreach ($result_quantities as $od) { @@ -171,8 +174,10 @@ class AdminLabelGenerate extends AdminTab { $result_quantities = Db::getInstance()->executeS(' SELECT od.`product_quantity`,od.`product_quantity_reinjected` FROM '._DB_PREFIX_.'order_detail od + LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`) WHERE od.`product_id` = ' . (int)$combination['id_product'] .' - AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'] + AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'].' + AND o.`valid` != 0' ); foreach ($result_quantities as $od) { $quantity += ((int)$od['product_quantity'] - (int)$od['product_quantity_reinjected']); @@ -206,7 +211,8 @@ class AdminLabelGenerate extends AdminTab { $result_quantities = Db::getInstance()->executeS(' SELECT od.`product_quantity`,od.`product_quantity_reinjected` FROM '._DB_PREFIX_.'order_detail od - WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0' + LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`) + WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0 AND o.`valid` != 0' ); foreach ($result_quantities as $od) { $quantity += ((int)$od['product_quantity'] - (int)$od['product_quantity_reinjected']); @@ -279,8 +285,10 @@ class AdminLabelGenerate extends AdminTab { $result_quantities = Db::getInstance()->executeS(' SELECT od.`product_quantity`,od.`product_quantity_reinjected` FROM '._DB_PREFIX_.'order_detail od + LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`) WHERE od.`product_id` = ' . (int)$combination['id_product'] .' - AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'] + AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'].' + AND o.`valid` != 0' ); foreach ($result_quantities as $od) { $quantity += ((int)$od['product_quantity'] - (int)$od['product_quantity_reinjected']); @@ -311,7 +319,8 @@ class AdminLabelGenerate extends AdminTab { $result_quantities = Db::getInstance()->executeS(' SELECT od.`product_quantity`,od.`product_quantity_reinjected` FROM '._DB_PREFIX_.'order_detail od - WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0' + LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`) + WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0 AND o.`valid` != 0' ); foreach ($result_quantities as $od) { $quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']); @@ -381,8 +390,10 @@ class AdminLabelGenerate extends AdminTab { $result_quantities = Db::getInstance()->executeS(' SELECT od.`product_quantity`,od.`product_quantity_reinjected` FROM '._DB_PREFIX_.'order_detail od + LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`) WHERE od.`product_id` = ' . (int)$combination['id_product'] .' - AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'] + AND od.`product_attribute_id`= ' . (int)$combination['id_product_attribute'].' + AND o.`valid` != 0' ); $quantity = 0; foreach ($result_quantities as $od) { @@ -413,7 +424,8 @@ class AdminLabelGenerate extends AdminTab { $result_quantities = Db::getInstance()->executeS(' SELECT od.`product_quantity`,od.`product_quantity_reinjected` FROM '._DB_PREFIX_.'order_detail od - WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0' + LEFT JOIN '._DB_PREFIX_.'orders o ON (o.`id_order` = od.`id_order`) + WHERE od.`product_id` = ' . (int)$product->id . ' AND `product_attribute_id` = 0 AND o.`valid` != 0' ); $quantity = 0; foreach ($result_quantities as $od) {