From 5320ebc0515e865553004f2febe718b3a46b9620 Mon Sep 17 00:00:00 2001 From: BENKE Charlene <charles.fr@benke.fr> Date: Sat, 17 Jun 2017 10:16:52 +0200 Subject: [PATCH] getTotalWeightVolume : add conversion Lb & oz to KG New conversion value : Oz once Little az a wizzard... --- htdocs/core/class/commonobject.class.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3ac7cb6ffb3..bd5d8a6b831 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -3097,9 +3097,18 @@ abstract class CommonObject $trueWeightUnit=pow(10, $weightUnit); $totalWeight += $weight * $qty * $trueWeightUnit; } - else - { - $totalWeight += $weight * $qty; // This may be wrong if we mix different units + else { + if ($weight_units == 99) { + // conversion 1 Livre = 0.45359237 KG + $trueWeightUnit = 0.45359237; + $totalWeight += $weight * $qty * $trueWeightUnit; + } elseif ($weight_units == 98) { + // conversion 1 once = 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) { -- GitLab