forked from Wavyzz/dolibarr
Add: gestion du volume d'un produit
This commit is contained in:
@@ -2299,25 +2299,39 @@ function weight_convert($weight,&$from_unit,$to_unit)
|
||||
|
||||
return $weight;
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Renvoi le texte d'une unite
|
||||
\param int Unit
|
||||
\return string Unite
|
||||
\param int Unit
|
||||
\param measuring_style Le style de mesure : weight, volume,...
|
||||
\return string Unite
|
||||
\todo gerer les autres unit<69>s de mesure comme la livre, le gallon, le litre, ...
|
||||
*/
|
||||
function weight_units_string($unit)
|
||||
function measuring_units_string($unit,$measuring_style='')
|
||||
{
|
||||
/* Note Rodo aux dev :)
|
||||
* Ne pas ins<6E>rer dans la base de donn<6E>es ces valeurs
|
||||
* cela surchagerait inutilement d'une requete suppl<70>mentaire
|
||||
* pour quelque chose qui est somme toute peu variable
|
||||
*/
|
||||
$weight_string[3] = 'Tonnes';
|
||||
$weight_string[0] = 'kg';
|
||||
$weight_string[-3] = 'g';
|
||||
$weight_string[-6] = 'mg';
|
||||
|
||||
global $langs;
|
||||
|
||||
if ($measuring_style == 'weight')
|
||||
{
|
||||
$measuring_units[3] = $langs->trans("WeightUnitton");
|
||||
$measuring_units[0] = $langs->trans("WeightUnitkg");
|
||||
$measuring_units[-3] = $langs->trans("WeightUnitg");
|
||||
$measuring_units[-6] = $langs->trans("WeightUnitmg");
|
||||
}
|
||||
else if ($measuring_style == 'volume')
|
||||
{
|
||||
$measuring_units[0] = $langs->trans("VolumeUnitm3");
|
||||
$measuring_units[-3] = $langs->trans("VolumeUnitcm3");
|
||||
$measuring_units[-6] = $langs->trans("VolumeUnitmm3");
|
||||
}
|
||||
|
||||
return $weight_string[$unit];
|
||||
return $measuring_units[$unit];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user