Refactored FloatField.class.php.
authoranuko <support@anuko.com>
Sun, 5 Feb 2017 19:53:32 +0000 (19:53 +0000)
committeranuko <support@anuko.com>
Sun, 5 Feb 2017 19:53:32 +0000 (19:53 +0000)
WEB-INF/lib/form/FloatField.class.php
WEB-INF/templates/footer.tpl

index 14c30df..9cd38bf 100644 (file)
 // +----------------------------------------------------------------------+
 
 import('form.TextField');
-       
+
 class FloatField extends TextField {
-       var $mDelimiter = '.';
-       var $mFFormat;
-       var $cClassName = "FloatField";
 
-       function __construct($name) {
-               $this->mName    = $name;
-       }
-       
-       function setLocalization($i18n) {
-               FormElement::setLocalization($i18n);
-               global $user;
-               $this->mDelimiter = $user->decimal_mark;
-       }
-       
-       function setFormat($format)     {
-               $this->mFFormat = $format;
-       }
-       
-       function setValue($value) {
-               if (isset($this->mFFormat) && isset($value) && strlen($value)) {
-                       $value = str_replace($this->mDelimiter,".",$value);
-                       $value = sprintf("%".$this->mFFormat."f",$value);
-                       $value = str_replace(".",$this->mDelimiter,$value);
-               }
-               $this->mValue = $value;
-       }
-       
-       function setValueSafe($value)   {
-               // '.' to ',' , apply localisation 
-               if (strlen($value)>0)
-                       $this->mValue = str_replace(".",$this->mDelimiter,$value);
-       }
-       
-       function getValueSafe() {
-               // ',' to '.'
-               if (strlen($this->mValue)>0) {
-                       return str_replace($this->mDelimiter,".",$this->mValue);
-               } else {
-                       return null;
-               }
-       }
+  var $mDelimiter = '.';
+  var $mFFormat;
+  var $cClassName = 'FloatField';
+
+  function __construct($name) {
+    $this->mName = $name;
+  }
+
+  function setLocalization($i18n) {
+    FormElement::setLocalization($i18n);
+    global $user;
+    $this->mDelimiter = $user->decimal_mark;
+  }
+
+  function setFormat($format) {
+    $this->mFFormat = $format;
+  }
+
+  function setValue($value) {
+    if (isset($this->mFFormat) && isset($value) && strlen($value)) {
+      $value = str_replace($this->mDelimiter, '.', $value);
+      $value = sprintf('%'.$this->mFFormat.'f', $value);
+      $value = str_replace('.', $this->mDelimiter, $value);
+    }
+    $this->mValue = $value;
+  }
+
+  function setValueSafe($value)        {
+    // '.' to ',' , apply delimiter
+    if (strlen($value) > 0)
+      $this->mValue = str_replace('.', $this->mDelimiter, $value);
+  }
+
+  function getValueSafe() {
+    // ',' to '.'
+    if (strlen($this->mValue) > 0)
+      return str_replace($this->mDelimiter, '.', $this->mValue);
+    return null;
+  }
 }
index c07d43b..81a8092 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.9.36.3565 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.9.36.3566 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>