From: Nik Okuntseff Date: Mon, 25 Feb 2019 19:54:48 +0000 (+0000) Subject: Fixed export by adding approved status and timesheets to output. X-Git-Tag: timetracker_1.19-1~266 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=9fa13d0babab9e51a19824ec7ef64830cf530fb2;p=timetracker.git Fixed export by adding approved status and timesheets to output. --- diff --git a/WEB-INF/lib/ttGroupExportHelper.class.php b/WEB-INF/lib/ttGroupExportHelper.class.php index 1ab501ea..aa9ec8cf 100644 --- a/WEB-INF/lib/ttGroupExportHelper.class.php +++ b/WEB-INF/lib/ttGroupExportHelper.class.php @@ -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." \n"); + foreach ($timesheets as $timesheet_item) { + $timesheet_part = $this->indentation.' '."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 .= ">\n"; + fwrite($this->file, $timesheet_part); + } + fwrite($this->file, $this->indentation." \n"); + unset($timesheets); + unset($timesheet_part); + } + // Write invoices. if (count($invoices) > 0) { fwrite($this->file, $this->indentation." \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 .= ">\n"; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 32d68a09..f61c6cfb 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.44.4779 | Copyright © Anuko | +  Anuko Time Tracker 1.18.44.4780 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve}