X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/e88a31092d2dbcd535a1704ed4410e92ca3be914..56f1fd19f2c9c72878395b3275f03f192ccca082:/WEB-INF/lib/ttOrgImportHelper.class.php?ds=inline diff --git a/WEB-INF/lib/ttOrgImportHelper.class.php b/WEB-INF/lib/ttOrgImportHelper.class.php index 01566880..622b3fec 100644 --- a/WEB-INF/lib/ttOrgImportHelper.class.php +++ b/WEB-INF/lib/ttOrgImportHelper.class.php @@ -54,6 +54,7 @@ class ttOrgImportHelper { var $currentGroupClientMap = array(); var $currentGroupUserMap = array(); var $currentGroupInvoiceMap = array(); + var $currentGroupLogMap = array(); // Constructor. function __construct(&$errors) { @@ -279,6 +280,37 @@ class ttOrgImportHelper { $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 elements in XML. See below. + } + + if ($name == 'LOG_ITEM') { + // We get here when processing 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')); + } } }