From 324b14583327b1da8e4d3380bb09f81ac93ffb13 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Mon, 27 Jun 2022 08:42:33 +0200 Subject: [PATCH 1/7] FIX - php V8 expedition card --- htdocs/expedition/card.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 781a5c690cf..3c33c913384 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -982,7 +982,7 @@ if ($action == 'create') { print "\n"; // Other attributes - $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'cols' => '3', 'socid' => $socid); + $parameters = array('objectsrc' => isset($objectsrc) ? $objectsrc : '', 'colspan' => ' colspan="3"', 'cols' => '3', 'socid' => $socid); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $expe, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; @@ -1178,7 +1178,7 @@ if ($action == 'create') { // Qty already shipped print ''; - $quantityDelivered = $object->expeditions[$line->id]; + $quantityDelivered = isset($object->expeditions[$line->id]) ? $object->expeditions[$line->id] : ''; print $quantityDelivered; print ''; print ''.$unit_order.''; @@ -1188,14 +1188,16 @@ if ($action == 'create') { if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $quantityToBeDelivered = 0; } else { - $quantityToBeDelivered = $quantityAsked - $quantityDelivered; + if (isset($quantityAsked) and isset($quantityDelivered)) { + $quantityToBeDelivered = is_float($quantityAsked) - is_float($quantityDelivered); + } } $warehouseObject = null; if (count($warehousePicking) == 1 || !($line->fk_product > 0) || empty($conf->stock->enabled)) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection print ''; //ship from preselected location - $stock = + $product->stock_warehouse[$warehouse_id]->real; // Convert to number + $stock = + isSET($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0; // Convert to number $deliverableQty = min($quantityToBeDelivered, $stock); if ($deliverableQty < 0) { $deliverableQty = 0; From e8202894fb19f5ffa6556e261debb1c34429b64c Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Mon, 27 Jun 2022 08:54:26 +0200 Subject: [PATCH 2/7] Recursive call if there is childs to child --- htdocs/product/class/product.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 5a7990cd0a7..f3ba9692d52 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4633,7 +4633,7 @@ class Product extends CommonObject ); // Recursive call if there is childs to child - if (is_array($desc_pere['childs'])) { + if (isset($desc_pere['childs']) and is_array($desc_pere['childs'])) { //print 'YYY We go down for '.$desc_pere[3]." -> \n"; $this->fetch_prod_arbo($desc_pere['childs'], $compl_path.$desc_pere[3]." -> ", $desc_pere[1] * $multiply, $level + 1, $id, $ignore_stock_load); } From b046d92efb6f6140ef5b7f598c6118fd58cffef4 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Mon, 27 Jun 2022 09:00:57 +0200 Subject: [PATCH 3/7] STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT --- htdocs/expedition/class/expedition.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 77620585b98..2de87f93666 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -933,7 +933,7 @@ class Expedition extends CommonObject return -1; } - if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) { + if (!empty($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT)) { $product = new Product($this->db); $product->fetch($fk_product); From 6a80d81d4a9e59bee3fdaff9687148a7a29601b8 Mon Sep 17 00:00:00 2001 From: BB2A Anthony Berton Date: Mon, 27 Jun 2022 09:11:33 +0200 Subject: [PATCH 4/7] FIX --- htdocs/core/class/commonobject.class.php | 2 +- htdocs/expedition/card.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4a95bb7d345..be7e8f2ec6e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -4291,7 +4291,7 @@ abstract class CommonObject if ($elementTable == 'commande_fournisseur_dispatch') { $fieldstatus = "status"; } - if (is_array($this->fields) && array_key_exists('status', $this->fields)) { + if (isset($this->fields) && is_array($this->fields) && array_key_exists('status', $this->fields)) { $fieldstatus = 'status'; } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3c33c913384..384f2cdde3d 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -429,10 +429,10 @@ if (empty($reshook)) { if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { $outputlangs = $langs; $newlang = ''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang) && GETPOST('lang_id', 'aZ09')) { $newlang = GETPOST('lang_id', 'aZ09'); } - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) { + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) { $newlang = $object->thirdparty->default_lang; } if (!empty($newlang)) { From 3a8f479db7df5fdcb5af8c45a23050c5aebb9d1f Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 27 Jun 2022 11:16:50 +0200 Subject: [PATCH 5/7] Update card.php --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 384f2cdde3d..f79e4becd9d 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1197,7 +1197,7 @@ if ($action == 'create') { if (count($warehousePicking) == 1 || !($line->fk_product > 0) || empty($conf->stock->enabled)) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection print ''; //ship from preselected location - $stock = + isSET($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0; // Convert to number + $stock = + isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0; // Convert to number $deliverableQty = min($quantityToBeDelivered, $stock); if ($deliverableQty < 0) { $deliverableQty = 0; From bcdbcf5070d80b0925b72c41a4f686044b5d865e Mon Sep 17 00:00:00 2001 From: Anthony Berton <34568357+bb2a@users.noreply.github.com> Date: Mon, 27 Jun 2022 11:18:38 +0200 Subject: [PATCH 6/7] Update card.php --- htdocs/expedition/card.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index f79e4becd9d..ef1405e54b6 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1188,8 +1188,10 @@ if ($action == 'create') { if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $quantityToBeDelivered = 0; } else { - if (isset($quantityAsked) and isset($quantityDelivered)) { - $quantityToBeDelivered = is_float($quantityAsked) - is_float($quantityDelivered); + if (is_numeric($quantityDelivered)) { + $quantityToBeDelivered = $quantityAsked - $quantityDelivered; + } else { + $quantityToBeDelivered = $quantityAsked; } } From cf34d07d5d78564ce9d1f978cfe1923776781ef3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 27 Jun 2022 12:22:46 +0200 Subject: [PATCH 7/7] Update card.php --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index ef1405e54b6..0508c51dfae 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1199,7 +1199,7 @@ if ($action == 'create') { if (count($warehousePicking) == 1 || !($line->fk_product > 0) || empty($conf->stock->enabled)) { // If warehouse was already selected or if product is not a predefined, we go into this part with no multiwarehouse selection print ''; //ship from preselected location - $stock = + isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0; // Convert to number + $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0); // Convert to number $deliverableQty = min($quantityToBeDelivered, $stock); if ($deliverableQty < 0) { $deliverableQty = 0;