Fixed export by adding approved status and timesheets to output.
authorNik Okuntseff <support@anuko.com>
Mon, 25 Feb 2019 19:54:48 +0000 (19:54 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 25 Feb 2019 19:54:48 +0000 (19:54 +0000)
WEB-INF/lib/ttGroupExportHelper.class.php
WEB-INF/templates/footer.tpl

index 1ab501e..aa9ec8c 100644 (file)
@@ -42,6 +42,7 @@ class ttGroupExportHelper {
   var $taskMap    = array();
   var $projectMap = array();
   var $clientMap  = array();
+  var $timesheetMap = array();
   var $invoiceMap = array();
   var $logMap     = array();
   var $customFieldMap = array();
@@ -174,6 +175,11 @@ class ttGroupExportHelper {
     foreach ($clients as $key=>$client_item)
       $this->clientMap[$client_item['id']] = $key + 1;
 
+    // Prepare timesheet map.
+    $timesheets = $this->getRecordsFromTable('tt_timesheets');
+    foreach ($timesheets as $key=>$timesheet_item)
+      $this->timesheetMap[$timesheet_item['id']] = $key + 1;
+
     // Prepare invoice map.
     $invoices = ttTeamHelper::getAllInvoices();
     foreach ($invoices as $key=>$invoice_item)
@@ -318,6 +324,27 @@ class ttGroupExportHelper {
       unset($bind_part);
     }
 
+    // Write timesheets.
+    if (count($timesheets) > 0) {
+      fwrite($this->file, $this->indentation."  <timesheets>\n");
+      foreach ($timesheets as $timesheet_item) {
+        $timesheet_part = $this->indentation.'    '."<timesheet id=\"".$this->timesheetMap[$timesheet_item['id']]."\"";
+        $timesheet_part .= " user_id=\"".$this->userMap[$timesheet_item['user_id']]."\"";
+        $timesheet_part .= " client_id=\"".$this->clientMap[$timesheet_item['client_id']]."\"";
+        $timesheet_part .= " name=\"".htmlspecialchars($timesheet_item['name'])."\"";
+        $timesheet_part .= " submit_status=\"".$timesheet_item['submit_status']."\"";
+        $timesheet_part .= " submitter_comment=\"".htmlspecialchars($timesheet_item['submitter_name'])."\"";
+        $timesheet_part .= " approval_status=\"".$timesheet_item['approval_status']."\"";
+        $timesheet_part .= " manager_comment=\"".htmlspecialchars($timesheet_item['manager_comment'])."\"";
+        $timesheet_part .= " status=\"".$timesheet_item['status']."\"";
+        $timesheet_part .= "></timesheet>\n";
+        fwrite($this->file, $timesheet_part);
+      }
+      fwrite($this->file, $this->indentation."  </timesheets>\n");
+      unset($timesheets);
+      unset($timesheet_part);
+    }
+
     // Write invoices.
     if (count($invoices) > 0) {
       fwrite($this->file, $this->indentation."  <invoices>\n");
@@ -355,9 +382,11 @@ class ttGroupExportHelper {
         $log_part .= " client_id=\"".$this->clientMap[$record['client_id']]."\"";
         $log_part .= " project_id=\"".$this->projectMap[$record['project_id']]."\"";
         $log_part .= " task_id=\"".$this->taskMap[$record['task_id']]."\"";
+        $log_part .= " timesheet_id=\"".$this->timesheetMap[$record['timesheet_id']]."\"";
         $log_part .= " invoice_id=\"".$this->invoiceMap[$record['invoice_id']]."\"";
         $log_part .= " comment=\"".htmlspecialchars($record['comment'])."\"";
         $log_part .= " billable=\"".$record['billable']."\"";
+        $log_part .= " approved=\"".$record['approved']."\"";
         $log_part .= " paid=\"".$record['paid']."\"";
         $log_part .= " status=\"".$record['status']."\"";
         $log_part .= "></log_item>\n";
index 32d68a0..f61c6cf 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.44.4779 | 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.44.4780 | 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>