As suggested in PR#33, allowed entry of decimal values with a comma for teams with...
authoranuko <support@anuko.com>
Mon, 10 Jul 2017 00:01:34 +0000 (00:01 +0000)
committeranuko <support@anuko.com>
Mon, 10 Jul 2017 00:01:34 +0000 (00:01 +0000)
WEB-INF/lib/ttClientHelper.class.php
WEB-INF/lib/ttTimeHelper.class.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/time.tpl
WEB-INF/templates/time_edit.tpl

index c77dae0..14788ae 100644 (file)
@@ -286,7 +286,7 @@ class ttClientHelper {
     $sql = "select distinct c.id, c.name, c.projects from tt_user_project_binds upb
       inner join tt_client_project_binds cpb on (cpb.project_id = upb.project_id)
       inner join tt_clients c on (c.id = cpb.client_id and c.status = 1)
-      where upb.user_id = $user_id and upb.status = 1 order by c.name";
+      where upb.user_id = $user_id and upb.status = 1 order by upper(c.name)";
 
     $res = $mdb2->query($sql);
     if (!is_a($res, 'PEAR_Error')) {
index a2dade9..13a2d83 100644 (file)
@@ -92,7 +92,10 @@ class ttTimeHelper {
     if (preg_match('/^([0-1]{0,1}[0-9]|2[0-4])h?$/', $value )) { // 0, 1 ... 24
       return true;
     }
-    if (preg_match('/^([0-1]{0,1}[0-9]|2[0-3])?[.][0-9]{1,4}h?$/', $value )) { // decimal values like 0.5, 1.25h, ... .. 23.9999h
+
+    global $user;
+    $localizedPattern = '/^([0-1]{0,1}[0-9]|2[0-3])?['.$user->decimal_mark.'][0-9]{1,4}h?$/';
+    if (preg_match($localizedPattern, $value )) { // decimal values like 0.5, 1.25h, ... .. 23.9999h (or with comma)
       return true;
     }
 
@@ -104,6 +107,10 @@ class ttTimeHelper {
     $time_value = $value;
 
     // If we have a decimal format - convert to time format 00:00.
+    global $user;
+    if ($user->decimal_mark == ',')
+      $time_value = str_replace (',', '.', $time_value);
+
     if((strpos($time_value, '.') !== false) || (strpos($time_value, 'h') !== false)) {
       $val = floatval($time_value);
       $mins = round($val * 60);
index 24c305e..3ea7a01 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.11.44.3639 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.11.44.3640 | 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>
index 8328ab4..25fc81c 100644 (file)
@@ -59,7 +59,7 @@
 {if (($smarty.const.TYPE_DURATION == $user->record_type) || ($smarty.const.TYPE_ALL == $user->record_type))}
         <tr>
           <td align="right">{$i18n.label.duration}:</td>
-          <td>{$forms.timeRecordForm.duration.control}&nbsp;{$i18n.form.time.duration_format}</td>
+          <td>{$forms.timeRecordForm.duration.control}&nbsp;{if $user->decimal_mark == ','}{str_replace('.', ',', $i18n.form.time.duration_format)}{else}{$i18n.form.time.duration_format}{/if}</td>
         </tr>
 {/if}
       </table>
index f693215..9a13d4c 100644 (file)
@@ -50,7 +50,7 @@
 {if (($smarty.const.TYPE_DURATION == $user->record_type) || ($smarty.const.TYPE_ALL == $user->record_type))}
     <tr>
       <td align="right">{$i18n.label.duration}:</td>
-      <td>{$forms.timeRecordForm.duration.control}&nbsp;{$i18n.form.time.duration_format}</td>
+      <td>{$forms.timeRecordForm.duration.control}&nbsp;{if $user->decimal_mark == ','}{str_replace('.', ',', $i18n.form.time.duration_format)}{else}{$i18n.form.time.duration_format}{/if}</td>
     </tr>
 {/if}
     <tr>