]> wagnertech.de Git - timetracker.git/commitdiff
Usability improvement of the monthly quota config form.
authorNik Okuntseff <support@anuko.com>
Sun, 28 Jan 2018 22:28:16 +0000 (22:28 +0000)
committerNik Okuntseff <support@anuko.com>
Sun, 28 Jan 2018 22:28:16 +0000 (22:28 +0000)
WEB-INF/resources/en.lang.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/quotas.tpl
quotas.php

index 37d9bedf09927ce591b211cafebd3c8d0826bffa..d682cc8f0dea12345b7cb2ad678ac8c9c9b7f5fe 100644 (file)
@@ -440,6 +440,6 @@ $i18n_key_words = array(
 'form.quota.year' => 'Year',
 'form.quota.month' => 'Month',
 'form.quota.quota' => 'Quota',
 'form.quota.year' => 'Year',
 'form.quota.month' => 'Month',
 'form.quota.quota' => 'Quota',
-'form.quota.workday_hours' => 'Hours in work day',
+'form.quota.workday_hours' => 'Hours in work day',
 'form.quota.hint' => 'If values are empty, quotas are calculated automatically based on workday hours and holidays.',
 );
 'form.quota.hint' => 'If values are empty, quotas are calculated automatically based on workday hours and holidays.',
 );
index a9a59c7a967414e7c48ab463259d1db138023333..814420ce47625b6143e1f96ae37d898fa7eb0736 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.17.8.3815 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.17.9.3816 | 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>
             <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 6ce26a91325af78218ef4279ca4af60c2b18d436..67707d38adc2f80a06832ea445370dfcda900f6b 100644 (file)
@@ -11,7 +11,6 @@
           <tr>
             <td>{$i18n.form.quota.workday_hours}:</td>
             <td>{$forms.monthlyQuotasForm.workdayHours.control}</td>
           <tr>
             <td>{$i18n.form.quota.workday_hours}:</td>
             <td>{$forms.monthlyQuotasForm.workdayHours.control}</td>
-            <td><input type="submit" name="btn_hours" value="{$i18n.button.save}"></td>
           </tr>
         </table>
       </td>
           </tr>
         </table>
       </td>
index 0336d44c38fccd3b3bd5fd0a9df8a4acd3a93286..375d8a781c3e2fb2f567e8cb7fc8290eb08cd9b8 100644 (file)
@@ -80,27 +80,24 @@ if ($request->isPost()){
 
   if ($err->no()) {
 
 
   if ($err->no()) {
 
-    $res = false;
-    if ($_POST['btn_hours']){
-
-      // User changed workday hours for team.
-      $hours = (int)$request->getParameter('workdayHours');
-      $res = ttTeamHelper::update($user->team_id, array('name'=>$user->team,'workday_hours'=>$hours));
+    // Handle workday hours.
+    $hours = (int)$request->getParameter('workdayHours');
+    if ($hours != $user->workday_hours) {
+      if (!ttTeamHelper::update($user->team_id, array('name'=>$user->team,'workday_hours'=>$hours)))
+        $err->add($i18n->getKey('error.db'));
     }
     }
-    if ($_POST['btn_submit']){
-      // User pressed the Save button under monthly quotas table.
-      $postedYear = $request->getParameter('year');
-      $selectedYear = intval($postedYear);
-      for ($i = 0; $i < count($months); $i++){
-        $res = $quota->update($postedYear, $i+1, $request->getParameter($months[$i]));
-      }
+
+    // Handle monthly quotas for a selected year.
+    $selectedYear = intval($request->getParameter('year'));
+    for ($i = 0; $i < count($months); $i++){
+      if (!$quota->update($selectedYear, $i+1, $request->getParameter($months[$i])))
+        $err->add($i18n->getKey('error.db'));
     }
     }
-    if ($res) {
-      // header('Location: profile_edit.php');
-      header('Location: quotas.php'); // For debugging.
+
+    if ($err->no()) {
+      // Redisplay the form.
+      header('Location: quotas.php?year='.$selectedYear);
       exit();
       exit();
-    } else {
-      $err->add($i18n->getKey('error.db'));
     }
   }
 }
     }
   }
 }