From 7b88f1da3fea112919f0c61bf9cb894323cbfbab Mon Sep 17 00:00:00 2001 From: Benjamin Chantalat <74144396+PyroShape@users.noreply.github.com> Date: Mon, 1 Nov 2021 19:56:55 +0100 Subject: [PATCH] Change to have number of item dispached on number of total item --- htdocs/core/lib/fourn.lib.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index e81bdb5e9d0..7fc903db72b 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -157,12 +157,24 @@ function ordersupplier_prepare_head($object) if (!empty($conf->stock->enabled) && (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE))) { $langs->load("stocks"); - $nbLineToDispatch = count($object->getNotCompletlyDispatchedLines()); $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id; $head[$h][1] = $langs->trans("OrderDispatch"); - if ($nbLineToDispatch > 0) { - $head[$h][1] .= ''.$nbLineToDispatch.''; + + //If dispach process running we add the number of item to dispatch into the head + if ($object->statut == '3' OR $object->statut == '4' OR $object->statut == '5') { + $lines = $object->fetch_lines(); + $dispachedLines = $object->getDispachedLines(1); + $sumQtyAllreadyDispatched = 0; + for ($line = 0 ; $line < count($dispachedLines) ; $line++) { + $sumQtyAllreadyDispatched = $sumQtyAllreadyDispatched + $dispachedLines[$line]['qty']; + } + $sumQtyOrdered = 0; + for ($line = 0 ; $line < count($object->lines) ; $line++) { + $sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty; + } + $head[$h][1] .= ''.$sumQtyAllreadyDispatched.' / '.$sumQtyOrdered.''; } + $head[$h][2] = 'dispatch'; $h++; }