diff --git a/ChangeLog b/ChangeLog index 9db52882dd6..92a5fd5dceb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ For users: - New: For germany, we invert order of address. - New: Add hidden option MAIN_SERVICES_ARE_ECOMMERCE_200238EC. - New: Support NPR in customer product prices. +- New: Add more volume units (ounce, gallon, inch, feet, ...) - Perf: Avoid reading database to determine country code after each page call. - Fix: Better Postgresql compatibility. diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index b3ead2a5612..f706586d1aa 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -96,6 +96,7 @@ VolumeUnitm3=m3 VolumeUnitdm3=dm3 VolumeUnitcm3=cm3 VolumeUnitmm3=mm3 +VolumeUnitounce=ounce VolumeUnitlitre=litre VolumeUnitgallon=gallon Size=size diff --git a/htdocs/langs/fr_FR/other.lang b/htdocs/langs/fr_FR/other.lang index 9f602a2bccf..e907cca6bda 100644 --- a/htdocs/langs/fr_FR/other.lang +++ b/htdocs/langs/fr_FR/other.lang @@ -96,6 +96,7 @@ VolumeUnitm3=m3 VolumeUnitdm3=dm3 (l) VolumeUnitcm3=cm3 (ml) VolumeUnitmm3=mm3 (µl) +VolumeUnitounce=once VolumeUnitlitre=litre VolumeUnitgallon=gallon Size=taille diff --git a/htdocs/lib/product.lib.php b/htdocs/lib/product.lib.php index 16031c348aa..d409696947b 100644 --- a/htdocs/lib/product.lib.php +++ b/htdocs/lib/product.lib.php @@ -272,9 +272,10 @@ function show_stats_for_company($product,$socid) /** * Return translation label of a unit key - * @param int Unit key (-3,0,3,98,99...) - * @param measuring_style Style of unit: weight, volume,... - * @return string Unit string + * @param int Unit key (-3,0,3,98,99...) + * @param measuring_style Style of unit: weight, volume,... + * @return string Unit string + * @see load_measuring_units */ function measuring_units_string($unit,$measuring_style='') { @@ -310,7 +311,8 @@ function measuring_units_string($unit,$measuring_style='') $measuring_units[-3] = $langs->trans("VolumeUnitdm3"); $measuring_units[-6] = $langs->trans("VolumeUnitcm3"); $measuring_units[-9] = $langs->trans("VolumeUnitmm3"); - $measuring_units[98] = $langs->trans("VolumeUnitlitre"); + $measuring_units[97] = $langs->trans("VolumeUnitounce"); + $measuring_units[98] = $langs->trans("VolumeUnitlitre"); $measuring_units[99] = $langs->trans("VolumeUnitgallon"); } diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index f6c96822d08..a01dc04e588 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -149,12 +149,12 @@ class FormProduct } /** - * \brief Return a combo box with list of units - * \param name Name of HTML field - * \param measuring_style Unit to show: weight, size, surface, volume - * \param default Force unit - * \param adddefault Add empty unit called "Default" - * \remarks pour l'instant on ne definit pas les unites dans la base + * Return a combo box with list of units + * @param name Name of HTML field + * @param measuring_style Unit to show: weight, size, surface, volume + * @param default Force unit + * @param adddefault Add empty unit called "Default" + * @see For the moment, units labels are defined in measuring_units_string */ function load_measuring_units($name='measuring_units', $measuring_style='', $default='0', $adddefault=0) { @@ -167,7 +167,7 @@ class FormProduct if ($measuring_style == 'weight') $measuring_units=array(-6=>1,-3=>1,0=>1,3=>1,99=>1); else if ($measuring_style == 'size') $measuring_units=array(-3=>1,-2=>1,-1=>1,0=>1,99=>1,98=>1); else if ($measuring_style == 'surface') $measuring_units=array(-6=>1,-4=>1,-2=>1,0=>1); - else if ($measuring_style == 'volume') $measuring_units=array(-9=>1,-6=>1,-3=>1,0=>1,99=>1,/* 98=>1 */); // Liter is not used as already available with dm3 + else if ($measuring_style == 'volume') $measuring_units=array(-9=>1,-6=>1,-3=>1,0=>1,97=>1,99=>1,/* 98=>1 */); // Liter is not used as already available with dm3 $return.= '