2
0
forked from Wavyzz/dolibarr

FIX Better compatible fix for the trouble of weight / size units

This commit is contained in:
Laurent Destailleur
2019-10-22 18:36:36 +02:00
parent b88968520b
commit e7e9898e0d
17 changed files with 82 additions and 74 deletions

View File

@@ -3823,17 +3823,18 @@ abstract class CommonObject
$totalWeight += $weight * $qty * $trueWeightUnit;
}
else {
if ($weight_units == 99) {
// conversion 1 Pound = 0.45359237 KG
$trueWeightUnit = 0.45359237;
$totalWeight += $weight * $qty * $trueWeightUnit;
} elseif ($weight_units == 98) {
// conversion 1 Ounce = 0.0283495 KG
$trueWeightUnit = 0.0283495;
$totalWeight += $weight * $qty * $trueWeightUnit;
}
else
if ($weight_units == 99) {
// conversion 1 Pound = 0.45359237 KG
$trueWeightUnit = 0.45359237;
$totalWeight += $weight * $qty * $trueWeightUnit;
} elseif ($weight_units == 98) {
// conversion 1 Ounce = 0.0283495 KG
$trueWeightUnit = 0.0283495;
$totalWeight += $weight * $qty * $trueWeightUnit;
}
else {
$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)
{