var $projectMap = array(); // Project ids.
var $clientMap = array(); // Client ids.
var $invoiceMap = array(); // Invoice ids.
+ var $logMap = array(); // Time log ids.
// Constructor.
function __construct($group_id, $file, $indentation) {
}
fwrite($this->file, $this->indentation." </invoices>\n");
+ // Write time log entries and build logMap at the same time.
+ fwrite($this->file, $this->indentation." <log>\n");
+ $key = 0;
+ foreach ($users as $user_item) {
+ $records = ttTimeHelper::getAllRecords($user_item['id']);
+ foreach ($records as $record) {
+ $key++;
+ $this->logMap[$record['id']] = $key;
+ $log_part = $this->indentation.' '."<log_item id=\"$key\"";
+ $log_part .= " user_id=\"".$this->userMap[$record['user_id']]."\"";
+ $log_part .= " date=\"".$record['date']."\"";
+ $log_part .= " start=\"".$record['start']."\"";
+ $log_part .= " finish=\"".$record['finish']."\"";
+ $log_part .= " duration=\"".($record['start']?"":$record['duration'])."\"";
+ $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 .= " invoice_id=\"".$this->invoiceMap[$record['invoice_id']]."\"";
+ $log_part .= " comment=\"".htmlentities($record['comment'])."\"";
+ $log_part .= " billable=\"".$record['billable']."\"";
+ $log_part .= " paid=\"".$record['paid']."\"";
+ $log_part .= " status=\"".$record['status']."\"";
+ $log_part .= "></log_item>\n";
+ fwrite($this->file, $log_part);
+ }
+ }
+ fwrite($this->file, $this->indentation." </log>\n");
+ unset($records);
+
// Call self recursively for all subgroups.
foreach ($this->subgroups as $subgroup) {
$subgroup_helper = new ttGroupExportHelper($subgroup['id'], $this->file, $this->indentation.' ');
var $currentGroupClientMap = array();
var $currentGroupUserMap = array();
var $currentGroupInvoiceMap = array();
+ var $currentGroupLogMap = array();
// Constructor.
function __construct(&$errors) {
$this->currentGroupInvoiceMap[$attrs['ID']] = $invoice_id;
} else $this->errors->add($i18n->get('error.db'));
}
+
+ if ($name == 'LOG') {
+ // If we get here, we have to recycle $currentGroupLogMap.
+ unset($this->currentGroupLogMap);
+ $this->currentGroupLogMap = array();
+ // Log map is reconstructed after processing <log_item> elements in XML. See below.
+ }
+
+ if ($name == 'LOG_ITEM') {
+ // We get here when processing <log_item> tags for the current group.
+ $log_item_id = ttTimeHelper::insert(array(
+ 'user_id' => $this->currentGroupUserMap[$attrs['USER_ID']],
+ 'group_id' => $this->current_group_id,
+ 'org_id' => $this->org_id,
+ 'date' => $attrs['DATE'],
+ 'start' => $attrs['START'],
+ 'finish' => $attrs['FINISH'],
+ 'duration' => $attrs['DURATION'],
+ 'client' => $this->currentGroupClientMap[$attrs['CLIENT_ID']],
+ 'project' => $this->currentGroupProjectMap[$attrs['PROJECT_ID']],
+ 'task' => $this->currentGroupTaskMap[$attrs['TASK_ID']],
+ 'invoice' => $this->currentGroupInvoiceMap[$attrs['INVOICE_ID']],
+ 'note' => (isset($attrs['COMMENT']) ? $attrs['COMMENT'] : ''),
+ 'billable' => $attrs['BILLABLE'],
+ 'paid' => $attrs['PAID'],
+ 'status' => $attrs['STATUS']));
+ if ($log_item_id) {
+ // Add a mapping.
+ $this->currentGroupLogMap[$attrs['ID']] = $log_item_id;
+ } else $this->errors->add($i18n->get('error.db'));
+ }
}
}
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.12.4410 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.12.4411 | Copyright © <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>