Skip to content

Commit

Permalink
Fix totalOrdered totalToShip should be int
Browse files Browse the repository at this point in the history
  • Loading branch information
fappels committed Aug 25, 2024
1 parent 8a65b95 commit d2d7c3f
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4970,25 +4970,19 @@ public function getTotalWeightVolume()
$totalWeight = 0;
$totalVolume = 0;
// defined for shipment only
$totalOrdered = '';
$totalOrdered = 0;
// defined for shipment only
$totalToShip = '';
$totalToShip = 0;

if (empty($this->lines)) {
return array('weight' => $totalWeight, 'volume' => $totalVolume, 'ordered' => $totalOrdered, 'toship' => $totalToShip);
}

foreach ($this->lines as $line) {
if (isset($line->qty_asked)) {
if (empty($totalOrdered)) {
$totalOrdered = 0; // Avoid warning because $totalOrdered is ''
}
$totalOrdered += $line->qty_asked; // defined for shipment only
}
if (isset($line->qty_shipped)) {
if (empty($totalToShip)) {
$totalToShip = 0; // Avoid warning because $totalToShip is ''
}
$totalToShip += $line->qty_shipped; // defined for shipment only
} elseif ($line->element == 'commandefournisseurdispatch' && isset($line->qty)) {
if (empty($totalToShip)) {
Expand Down

0 comments on commit d2d7c3f

Please sign in to comment.