diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 3ac7cb6ffb377fa641149b10be3f18c9b37c6558..b87b3d28ea8f1a8793142e17f6884e4fb02a1c4c 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 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) { diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 5aec64f3ce02ae797d58a2a6a18d8b347acad96c..7048b8570c6a78b55ee988b3c081a60daee47560 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -441,7 +441,8 @@ function measuring_units_string($unit,$measuring_style='') $measuring_units[0] = $langs->transnoentitiesnoconv("WeightUnitkg"); $measuring_units[-3] = $langs->transnoentitiesnoconv("WeightUnitg"); $measuring_units[-6] = $langs->transnoentitiesnoconv("WeightUnitmg"); - $measuring_units[99] = $langs->transnoentitiesnoconv("WeightUnitpound"); + $measuring_units[98] = $langs->transnoentitiesnoconv("WeightUnitounce"); + $measuring_units[99] = $langs->transnoentitiesnoconv("WeightUnitpound"); } else if ($measuring_style == 'size') { diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index b151614ce3cc55448fb9024aa35df06db666de71..e15d490c0f274e8d4a35751993b6f36b058f3d08 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -124,6 +124,7 @@ WeightUnitkg=kg WeightUnitg=g WeightUnitmg=mg WeightUnitpound=pound +WeightUnitounce=ounce Length=Length LengthUnitm=m LengthUnitdm=dm diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 01064c8ffa33bf213c1f43d5e438481d2067a6e6..1dbfbc7662f6506ba28e60f6f9255d4e7ee51ba8 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -307,7 +307,7 @@ class FormProduct $return=''; $measuring_units=array(); - if ($measuring_style == 'weight') $measuring_units=array(-6=>1,-3=>1,0=>1,3=>1,99=>1); + if ($measuring_style == 'weight') $measuring_units=array(-6=>1,-3=>1,0=>1,3=>1,98=>1,99=>1); else if ($measuring_style == 'size') $measuring_units=array(-3=>1,-2=>1,-1=>1,0=>1,98=>1,99=>1); else if ($measuring_style == 'surface') $measuring_units=array(-6=>1,-4=>1,-2=>1,0=>1,98=>1,99=>1); else if ($measuring_style == 'volume') $measuring_units=array(-9=>1,-6=>1,-3=>1,0=>1,88=>1,89=>1,97=>1,99=>1,/* 98=>1 */); // Liter is not used as already available with dm3