Corrected PHP7 warnings for function CommonObject::getTotalWeightVolume

This commit is contained in:
Marcos García de La Fuente 2017-05-02 14:00:27 +02:00
parent fd72977505
commit 166f2d262d

View File

@ -2953,24 +2953,31 @@ abstract class CommonObject
*/ */
function getTotalWeightVolume() function getTotalWeightVolume()
{ {
$weightUnit=0; $totalWeight = 0;
$volumeUnit=0; $totalVolume = 0;
$totalWeight = ''; // defined for shipment only
$totalVolume = ''; $totalOrdered = 0;
$totalOrdered = ''; // defined for shipment only // defined for shipment only
$totalToShip = ''; // defined for shipment only $totalToShip = 0;
foreach ($this->lines as $line) foreach ($this->lines as $line)
{ {
$totalOrdered+=$line->qty_asked; // defined for shipment only $totalOrdered+=$line->qty_asked ?: 0; // defined for shipment only
$totalToShip+=$line->qty_shipped; // defined for shipment only $totalToShip+= $line->qty_shipped ?: 0; // defined for shipment only
// Define qty, weight, volume, weight_units, volume_units // Define qty, weight, volume, weight_units, volume_units
if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments if ($this->element == 'shipping') {
else $qty=$line->qty; // for shipments
$weight=$line->weight; $qty = $line->qty_shipped ?: 0;
$volume=$line->volume; }
else {
$qty = $line->qty ?: 0;
}
$weight = $line->weight ?: 0;
$volume = $line->volume ?: 0;
$weight_units=$line->weight_units; $weight_units=$line->weight_units;
$volume_units=$line->volume_units; $volume_units=$line->volume_units;