Skip to content
Snippets Groups Projects
Commit 36bd63c1 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

NEW PHP 7.1 compatibility

parent a05132d2
No related branches found
No related tags found
No related merge requests found
...@@ -3017,9 +3017,16 @@ abstract class CommonObject ...@@ -3017,9 +3017,16 @@ abstract class CommonObject
foreach ($this->lines as $line) 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 $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 $totalToShip+=$line->qty_shipped; // 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') $qty=$line->qty_shipped; // for shipments
...@@ -3034,8 +3041,11 @@ abstract class CommonObject ...@@ -3034,8 +3041,11 @@ abstract class CommonObject
if (! empty($weight_units)) $weightUnit = $weight_units; if (! empty($weight_units)) $weightUnit = $weight_units;
if (! empty($volume_units)) $volumeUnit = $volume_units; if (! empty($volume_units)) $volumeUnit = $volume_units;
if (empty($totalWeight)) $totalWeight=0; // Avoid warning because $totalWeight is ''
if (empty($totalVolume)) $totalVolume=0; // Avoid warning because $totalVolume is ''
//var_dump($line->volume_units); //var_dump($line->volume_units);
if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch)
{ {
$trueWeightUnit=pow(10, $weightUnit); $trueWeightUnit=pow(10, $weightUnit);
$totalWeight += $weight * $qty * $trueWeightUnit; $totalWeight += $weight * $qty * $trueWeightUnit;
...@@ -3044,7 +3054,7 @@ abstract class CommonObject ...@@ -3044,7 +3054,7 @@ abstract class CommonObject
{ {
$totalWeight += $weight * $qty; // This may be wrong if we mix different units $totalWeight += $weight * $qty; // This may be wrong if we mix different units
} }
if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch)
{ {
//print $line->volume."x".$line->volume_units."x".($line->volume_units < 50)."x".$volumeUnit; //print $line->volume."x".$line->volume_units."x".($line->volume_units < 50)."x".$volumeUnit;
$trueVolumeUnit=pow(10, $volumeUnit); $trueVolumeUnit=pow(10, $volumeUnit);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment