From 3b5e01059ad07bfc7ef7c07ba235a73a92ddc3f3 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sat, 10 Nov 2018 13:43:14 +0000 Subject: [PATCH] Added importing of tasks in new import. --- WEB-INF/lib/ttOrgImportHelper.class.php | 25 ++++++++++++++++++++++++- WEB-INF/templates/footer.tpl | 2 +- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/WEB-INF/lib/ttOrgImportHelper.class.php b/WEB-INF/lib/ttOrgImportHelper.class.php index 991424e6..3ccd3a66 100644 --- a/WEB-INF/lib/ttOrgImportHelper.class.php +++ b/WEB-INF/lib/ttOrgImportHelper.class.php @@ -28,6 +28,7 @@ import('ttUserHelper'); import('ttRoleHelper'); +import('ttTaskHelper'); // ttOrgImportHelper - this class is a future replacement for ttImportHelper. // Currently, it is work in progress. @@ -46,7 +47,8 @@ class ttOrgImportHelper { // var $currentGroupUsers = array(); // Array of arrays of user properties. // Entity maps for current group. They map XML ids with database ids. - var $currentGroupRoleMap = array(); // Maps role ids from XML to their database ids. + var $currentGroupRoleMap = array(); + var $currentGroupTaskMap = array(); //var $userMap = array(); // User ids. //var $projectMap = array(); // Project ids. //var $taskMap = array(); // Task ids. @@ -120,6 +122,27 @@ class ttOrgImportHelper { $this->currentGroupRoleMap[$attrs['ID']] = $role_id; } else $this->errors->add($i18n->get('error.db')); } + + if ($name == 'TASKS') { + // If we get here, we have to recycle $currentGroupTaskMap. + unset($this->currentGroupTaskMap); + $this->currentGroupTaskMap = array(); + // Task map is reconstructed after processing elements in XML. See below. + } + + if ($name == 'TASK') { + // We get here when processing tags for the current group. + $task_id = ttTaskHelper::insert(array( + 'group_id' => $this->current_group_id, + 'org_id' => $this->org_id, + 'name' => $attrs['NAME'], + 'description' => $attrs['DESCRIPTION'], + 'status' => $attrs['STATUS'])); + if ($task_id) { + // Add a mapping. + $this->currentGroupTaskMap[$attrs['ID']] = $task_id; + } else $this->errors->add($i18n->get('error.db')); + } } } diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 45cd36fd..92fda1f1 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.12.4401 | Copyright © Anuko | +  Anuko Time Tracker 1.18.12.4402 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1