Another fix in week view for negative hours.
authorNik Okuntseff <support@anuko.com>
Tue, 23 Apr 2019 19:10:27 +0000 (19:10 +0000)
committerNik Okuntseff <support@anuko.com>
Tue, 23 Apr 2019 19:10:27 +0000 (19:10 +0000)
WEB-INF/lib/ttWeekViewHelper.class.php
WEB-INF/templates/footer.tpl

index a790268..1144cea 100644 (file)
@@ -354,7 +354,7 @@ class ttWeekViewHelper {
     }
     // Convert minutes to hh:mm for display.
     foreach($dayHeaders as $dayHeader) {
-      $dayTotals[$dayHeader] = ttTimeHelper::minutesToDuration($dayTotals[$dayHeader]); // This breaks for negative hours.
+      $dayTotals[$dayHeader] = ttTimeHelper::minutesToDuration($dayTotals[$dayHeader]);
     }
     return $dayTotals;
   }
@@ -579,8 +579,14 @@ class ttWeekViewHelper {
     }
 
     // We do have start time.
-    // Quick test if new duration is less then already existing.
     $newMinutes = ttTimeHelper::toMinutes($new_duration);
+    if ($newMinutes < 0) {
+      // Negative durations are not supported when start time is defined.
+      $err->add($i18n->get('error.field'), $i18n->get('label.duration'));
+      return false;
+    }
+
+    // Quick test if new duration is less than already existing.
     $oldMinutes = ttTimeHelper::toMinutes($oldDuration);
     if ($newMinutes < $oldMinutes)
       return true; // Safe to modify.
index 5e5dd18..3e0c4c8 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.19.3.4980 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.19.3.4981 | 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>