diff --git a/htdocs/core/lib/fourn.lib.php b/htdocs/core/lib/fourn.lib.php index efc9f60147c..25bbd52e413 100644 --- a/htdocs/core/lib/fourn.lib.php +++ b/htdocs/core/lib/fourn.lib.php @@ -159,6 +159,25 @@ function ordersupplier_prepare_head($object) $langs->load("stocks"); $head[$h][0] = DOL_URL_ROOT.'/fourn/commande/dispatch.php?id='.$object->id; $head[$h][1] = $langs->trans("OrderDispatch"); + + //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') { + $object->fetch_lines(); + $nbLinesOrdered = count($object->lines); + $dispachedLines = $object->getDispachedLines(1); + $nbDispachedLines = count($dispachedLines); + + $sumQtyAllreadyDispatched = 0; + for ($line = 0 ; $line < $nbDispachedLines; $line++) { + $sumQtyAllreadyDispatched = $sumQtyAllreadyDispatched + $dispachedLines[$line]['qty']; + } + $sumQtyOrdered = 0; + for ($line = 0 ; $line < $nbLinesOrdered; $line++) { + $sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty; + } + $head[$h][1] .= ''.$sumQtyAllreadyDispatched.' / '.$sumQtyOrdered.''; + } + $head[$h][2] = 'dispatch'; $h++; } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f5064699eb2..9e16c803b28 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2274,7 +2274,6 @@ class CommandeFournisseur extends CommonOrder return $ret; } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Set a delivery in database for this supplier order