Avoid function calls in a FOR loop test part
This commit is contained in:
parent
85372a7083
commit
85776f7529
@ -162,14 +162,17 @@ function ordersupplier_prepare_head($object)
|
|||||||
|
|
||||||
//If dispach process running we add the number of item to dispatch into the head
|
//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') {
|
if ($object->statut == '3' OR $object->statut == '4' OR $object->statut == '5') {
|
||||||
$lines = $object->fetch_lines();
|
$object->fetch_lines();
|
||||||
|
$nbLinesOrdered = count($object->lines);
|
||||||
$dispachedLines = $object->getDispachedLines(1);
|
$dispachedLines = $object->getDispachedLines(1);
|
||||||
|
$nbDispachedLines = count($dispachedLines);
|
||||||
|
|
||||||
$sumQtyAllreadyDispatched = 0;
|
$sumQtyAllreadyDispatched = 0;
|
||||||
for ($line = 0 ; $line < count($dispachedLines); $line++) {
|
for ($line = 0 ; $line < $nbDispachedLines; $line++) {
|
||||||
$sumQtyAllreadyDispatched = $sumQtyAllreadyDispatched + $dispachedLines[$line]['qty'];
|
$sumQtyAllreadyDispatched = $sumQtyAllreadyDispatched + $dispachedLines[$line]['qty'];
|
||||||
}
|
}
|
||||||
$sumQtyOrdered = 0;
|
$sumQtyOrdered = 0;
|
||||||
for ($line = 0 ; $line < count($object->lines); $line++) {
|
for ($line = 0 ; $line < $nbLinesOrdered; $line++) {
|
||||||
$sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty;
|
$sumQtyOrdered = $sumQtyOrdered + $object->lines[$line]->qty;
|
||||||
}
|
}
|
||||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$sumQtyAllreadyDispatched.' / '.$sumQtyOrdered.'</span>';
|
$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$sumQtyAllreadyDispatched.' / '.$sumQtyOrdered.'</span>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user