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()
{
$weightUnit=0;
$volumeUnit=0;
$totalWeight = '';
$totalVolume = '';
$totalOrdered = ''; // defined for shipment only
$totalToShip = ''; // defined for shipment only
$totalWeight = 0;
$totalVolume = 0;
// defined for shipment only
$totalOrdered = 0;
// defined for shipment only
$totalToShip = 0;
foreach ($this->lines as $line)
{
$totalOrdered+=$line->qty_asked; // defined for shipment only
$totalToShip+=$line->qty_shipped; // defined for shipment only
$totalOrdered+=$line->qty_asked ?: 0; // defined for shipment only
$totalToShip+= $line->qty_shipped ?: 0; // defined for shipment only
// Define qty, weight, volume, weight_units, volume_units
if ($this->element == 'shipping') {
// for shipments
$qty = $line->qty_shipped ?: 0;
}
else {
$qty = $line->qty ?: 0;
}
$weight = $line->weight ?: 0;
$volume = $line->volume ?: 0;
// Define qty, weight, volume, weight_units, volume_units
if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments
else $qty=$line->qty;
$weight=$line->weight;
$volume=$line->volume;
$weight_units=$line->weight_units;
$volume_units=$line->volume_units;