Merge pull request #7024 from defrance/patch-14
Introduce weight conversion lb & oz
This commit is contained in:
commit
b73228899a
@ -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)
|
||||
{
|
||||
|
||||
@ -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')
|
||||
{
|
||||
|
||||
@ -124,6 +124,7 @@ WeightUnitkg=kg
|
||||
WeightUnitg=g
|
||||
WeightUnitmg=mg
|
||||
WeightUnitpound=pound
|
||||
WeightUnitounce=ounce
|
||||
Length=Length
|
||||
LengthUnitm=m
|
||||
LengthUnitdm=dm
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user