diff --git a/doc/conf/LSattribute/LSattr_html/LSattr_html_valueWithUnit.docbook b/doc/conf/LSattribute/LSattr_html/LSattr_html_valueWithUnit.docbook
index d3765129..7e0d1ef7 100644
--- a/doc/conf/LSattribute/LSattr_html/LSattr_html_valueWithUnit.docbook
+++ b/doc/conf/LSattribute/LSattr_html/LSattr_html_valueWithUnit.docbook
@@ -11,9 +11,12 @@
'[facteur2]' => '[label unit2]',
[...]
),
+ 'translate_labels' => [booléen],
'nb_decimals' => [number of decimals],
'dec_point' => '[decimals point]',
- 'thousands_sep' => '[thousands separator]'
+ 'thousands_sep' => '[thousands separator]',
+ 'store_integer' => [booléen],
+ 'round_down' => [booléen],
)
),]]>
...
@@ -29,6 +32,13 @@
+
+ translate_labels
+
+ Booléen permettant d'activer/désactiver la traduction des labels (Par defaut : Vrai).
+
+
+
nb_decimals
@@ -50,6 +60,22 @@
+
+ store_integer
+
+ Booléen permettant d'activer/désactiver le stockage de valeurs entières (Par defaut :
+ Vrai).
+
+
+
+
+ round_down
+
+ Booléen permettant d'arrondir à l'entier inférieur (et non à l'entier supérieur
+ par défaut) en cas de stockage de valeurs entières.
+
+
+
diff --git a/public_html/includes/class/class.LSformElement_valueWithUnit.php b/public_html/includes/class/class.LSformElement_valueWithUnit.php
index c793150e..1c369d97 100644
--- a/public_html/includes/class/class.LSformElement_valueWithUnit.php
+++ b/public_html/includes/class/class.LSformElement_valueWithUnit.php
@@ -44,7 +44,7 @@ class LSformElement_valueWithUnit extends LSformElement {
if (isset($this -> params['html_options']['units']) && is_array($this -> params['html_options']['units'])) {
$units=array();
foreach($this -> params['html_options']['units'] as $sill => $label) {
- $units[$sill]=__($label);
+ $units[$sill]=((!isset($this -> params['html_options']['translate_labels']) || $this -> params['html_options']['translate_labels'])?__($label):$label);
}
krsort($units);
return $units;
@@ -162,8 +162,18 @@ class LSformElement_valueWithUnit extends LSformElement {
$f = 1;
if (isset($_POST[$this -> name.'_unitFact'][$key]) && ($_POST[$this -> name.'_unitFact'][$key]!=1)) {
$f = $_POST[$this -> name.'_unitFact'][$key];
- }
- $return[$this -> name][$key] = ($val*$f);
+ }
+ if (isset($this -> params['html_options']['store_integer']) && $this -> params['html_options']['store_integer']) {
+ if (isset($this -> params['html_options']['round_down']) && $this -> params['html_options']['round_down']) {
+ $return[$this -> name][$key] = floor($val*$f);
+ }
+ else {
+ $return[$this -> name][$key] = ceil($val*$f);
+ }
+ }
+ else {
+ $return[$this -> name][$key] = ($val*$f);
+ }
}
}
}