Some fixes to export/import of timesheets.
authorNik Okuntseff <support@anuko.com>
Sat, 2 Mar 2019 15:16:55 +0000 (15:16 +0000)
committerNik Okuntseff <support@anuko.com>
Sat, 2 Mar 2019 15:16:55 +0000 (15:16 +0000)
WEB-INF/lib/ttGroupExportHelper.class.php
WEB-INF/lib/ttOrgImportHelper.class.php
WEB-INF/templates/footer.tpl

index ac35cd8..59bdc8c 100644 (file)
@@ -333,8 +333,10 @@ class ttGroupExportHelper {
         $timesheet_part .= " client_id=\"".$this->clientMap[$timesheet_item['client_id']]."\"";
         $timesheet_part .= " project_id=\"".$this->projectMap[$timesheet_item['project_id']]."\"";
         $timesheet_part .= " name=\"".htmlspecialchars($timesheet_item['name'])."\"";
-        $timesheet_part .= " submit_status=\"".$timesheet_item['submit_status']."\"";
         $timesheet_part .= " comment=\"".htmlspecialchars($timesheet_item['comment'])."\"";
+        $timesheet_part .= " start_date=\"".$timesheet_item['start_date']."\"";
+        $timesheet_part .= " end_date=\"".$timesheet_item['end_date']."\"";
+        $timesheet_part .= " submit_status=\"".$timesheet_item['submit_status']."\"";
         $timesheet_part .= " approve_status=\"".$timesheet_item['approve_status']."\"";
         $timesheet_part .= " approve_comment=\"".htmlspecialchars($timesheet_item['approve_comment'])."\"";
         $timesheet_part .= " status=\"".$timesheet_item['status']."\"";
index edd59b6..0efb6b0 100644 (file)
@@ -286,9 +286,8 @@ class ttOrgImportHelper {
           'project_id' => $this->currentGroupProjectMap[$attrs['PROJECT_ID']],
           'name' => $attrs['NAME'],
           'comment' => $attrs['COMMENT'],
-  // TODO: add handling of these.
-  //`start_date` date NOT NULL,                      # timesheet start date
-  //`end_date` date NOT NULL,                        # timesheet end date
+          'start_date' => $attrs['START_DATE'],
+          'end_date' => $attrs['END_DATE'],
           'submit_status' => $attrs['SUBMIT_STATUS'],
           'approve_status' => $attrs['APPROVE_STATUS'],
           'approve_comment' => $attrs['APPROVE_COMMENT'],
@@ -916,19 +915,23 @@ class ttOrgImportHelper {
     $group_id = (int) $fields['group_id'];
     $org_id = (int) $fields['org_id'];
     $client_id = $fields['client_id'];
+    $project_id = $fields['project_id'];
     $name = $fields['name'];
+    $comment = $fields['comment'];
+    $start_date = $fields['start_date'];
+    $end_date = $fields['end_date'];
     $submit_status = $fields['submit_status'];
-    $submitter_comment = $fields['submitter_comment'];
-    $approval_status = $fields['approval_status'];
-    $manager_comment = $fields['manager_comment'];
+    $approve_status = $fields['approve_status'];
+    $approve_comment = $fields['approve_comment'];
     $status = $fields['status'];
 
     // Insert a new timesheet record.
-    $sql = "insert into tt_timesheets (user_id, group_id, org_id, client_id, name,".
-      " submit_status, submitter_comment, approval_status, manager_comment, status)".
-      " values($user_id, $group_id, $org_id, ".$mdb2->quote($client_id).", ".$mdb2->quote($name).", ".
-      $mdb2->quote($fields['submit_status']).", ".$mdb2->quote($fields['submiter_comment']).", ".
-      $mdb2->quote($fields['approval_status']).", ".$mdb2->quote($fields['manager_comment']).", ".$mdb2->quote($fields['status']).")";
+    $sql = "insert into tt_timesheets (user_id, group_id, org_id, client_id, project_id, name,".
+      " comment, start_date, end_date, submit_status, approve_status, approve_comment, status)".
+      " values($user_id, $group_id, $org_id, ".$mdb2->quote($client_id).", ".$mdb2->quote($project_id).", ".$mdb2->quote($name).", ".
+      $mdb2->quote($comment).", ".$mdb2->quote($start_date).", ".$mdb2->quote($end_date).", ".
+      $mdb2->quote($submit_status).", ".$mdb2->quote($approve_status).", ".
+      $mdb2->quote($approve_comment).", ".$mdb2->quote($status).")";
     $affected = $mdb2->exec($sql);
     if (is_a($affected, 'PEAR_Error')) return false;
 
index 02b5b04..ac521a4 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.4805 | 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.4806 | 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>