]> wagnertech.de Git - timetracker.git/commitdiff
Some more work on timesheets.
authorNik Okuntseff <support@anuko.com>
Sat, 2 Mar 2019 17:11:08 +0000 (17:11 +0000)
committerNik Okuntseff <support@anuko.com>
Sat, 2 Mar 2019 17:11:08 +0000 (17:11 +0000)
WEB-INF/lib/ttTimesheetHelper.class.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/timesheet_view.tpl
timesheet_view.php

index d03f8010ab7983e76a85f03c48a5924531d35b41..1fff195549fa69b4a48d2a5a1565e41ec7dc9b69 100644 (file)
@@ -240,10 +240,11 @@ class ttTimesheetHelper {
 
   // getApprovers obtains a list of users who can approve a timesheet for a given user
   // and also have an email to receive a notification about it.
-  static function getApprovers($user_id) {
+  static function getApprovers() {
     global $user;
     $mdb2 = getConnection();
 
+    $user_id = $user->getUser();
     $group_id = $user->getGroup();
     $org_id = $user->org_id;
 
@@ -263,20 +264,22 @@ class ttTimesheetHelper {
     return $approvers;
   }
 
-  // submitTimesheet marks a timesheet as submitted and sends an email to an approver.
+  // submitTimesheet marks a timesheet as submitted and also sends an email
+  // to a selected approver.
   static function submitTimesheet($fields) {
     global $user;
     $mdb2 = getConnection();
 
+    $user_id = $user->getUser();
     $group_id = $user->getGroup();
     $org_id = $user->org_id;
 
-    // First, mark timesheet as submitted.
+    // First, mark timesheet as submitted.
     // Even if mail part below does not work, this will get us a functioning workflow
-    // (without email notifications).
+    // without email notification.
     $timesheet_id = $fields['timesheet_id'];
     $sql = "update tt_timesheets set submit_status = 1".
-      " where id = $timesheet_id and group_id = $group_id and org_id = $org_id";
+      " where id = $timesheet_id and user_id = $user_id and group_id = $group_id and org_id = $org_id";
     $affected = $mdb2->exec($sql);
     if (is_a($affected, 'PEAR_Error')) return false;
 
@@ -291,17 +294,18 @@ class ttTimesheetHelper {
     global $user;
     $mdb2 = getConnection();
 
+    $user_id = $user->getUser();
     $group_id = $user->getGroup();
     $org_id = $user->org_id;
 
-    // First, mark timesheet as approved.
+    // First, mark timesheet as approved.
     // Even if mail part below does not work, this will get us a functioning workflow
-    // (without email notifications).
+    // without email notification.
     $timesheet_id = $fields['timesheet_id'];
     $comment = $fields['comment'];
 
     $sql = "update tt_timesheets set approve_status = 1, approve_comment = ".$mdb2->quote($comment).
-      " where id = $timesheet_id and submit_status = 1 and group_id = $group_id and org_id = $org_id";
+      " where id = $timesheet_id and submit_status = 1 and user_id = $user_id and group_id = $group_id and org_id = $org_id";
     $affected = $mdb2->exec($sql);
     if (is_a($affected, 'PEAR_Error')) return false;
 
@@ -314,17 +318,18 @@ class ttTimesheetHelper {
     global $user;
     $mdb2 = getConnection();
 
+    $user_id = $user->getUser();
     $group_id = $user->getGroup();
     $org_id = $user->org_id;
 
-    // First, mark timesheet as disapproved.
+    // First, mark timesheet as disapproved.
     // Even if mail part below does not work, this will get us a functioning workflow
-    // (without email notifications).
+    // without email notification.
     $timesheet_id = $fields['timesheet_id'];
     $comment = $fields['comment'];
 
     $sql = "update tt_timesheets set approve_status = 0, approve_comment = ".$mdb2->quote($comment).
-      " where id = $timesheet_id and submit_status = 1 and group_id = $group_id and org_id = $org_id";
+      " where id = $timesheet_id and submit_status = 1 and user_id = $user_id and group_id = $group_id and org_id = $org_id";
     $affected = $mdb2->exec($sql);
     if (is_a($affected, 'PEAR_Error')) return false;
 
index c9463c886b0cba12dfb2b18854991b26ebbb5f54..e32cca999de6f5ed29eabb7b726069126d07b730 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.18.50.4809 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.50.4810 | 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 3bd8ddd201a0b5ef62d0127cc185410d466434c7..77cc78bd541249c90ff8c2ebaed89b1d23ab929a 100644 (file)
@@ -49,6 +49,7 @@
         <td class="cellLeftAlignedSubtotal">{$i18n.label.total}</td>
         <td nowrap class="cellRightAlignedSubtotal">{$totals['time']}</td>
       </tr>
+      <tr><td>&nbsp;</td></tr>
       </table>
 
 {$forms.timesheetForm.open}
index e6368a396439687d617f61481592757675b30c4a..d0198c780ca6e51622d8db2d3e55986b43252987 100644 (file)
@@ -60,7 +60,7 @@ $totals = ttReportHelper::getTotals($options);
 // Determine which controls to show and obtain date for them.
 $showSubmit = !$timesheet['submit_status'];
 if ($showSubmit) {
-  $approvers = ttTimesheetHelper::getApprovers($timesheet['user_id']);
+  $approvers = ttTimesheetHelper::getApprovers();
   $showApprovers = count($approvers) >= 1;
 }
 $canApprove = $user->can('approve_timesheets') || $user->can('approve_own_timesheets');