From: Nik Okuntseff Date: Sat, 10 Nov 2018 20:27:17 +0000 (+0000) Subject: Improved new export-import by including user to project binds. X-Git-Tag: timetracker_1.19-1~664 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=b06601362567c117bdc889277d554c8c58f0efdc;p=timetracker.git Improved new export-import by including user to project binds. --- diff --git a/WEB-INF/lib/ttGroupExportHelper.class.php b/WEB-INF/lib/ttGroupExportHelper.class.php index 4a2eb785..125df0ff 100644 --- a/WEB-INF/lib/ttGroupExportHelper.class.php +++ b/WEB-INF/lib/ttGroupExportHelper.class.php @@ -309,6 +309,21 @@ class ttGroupExportHelper { } fwrite($this->file, $this->indentation." \n"); + // Write user to project binds. + fwrite($this->file, $this->indentation." \n"); + $user_binds = ttTeamHelper::getUserToProjectBinds($this->group_id); + foreach ($user_binds as $bind) { + $user_id = $this->userMap[$bind['user_id']]; + $project_id = $this->projectMap[$bind['project_id']]; + $bind_part = $this->indentation.' '."file, $bind_part); + } + fwrite($this->file, $this->indentation." \n"); + // Call self recursively for all subgroups. foreach ($this->subgroups as $subgroup) { $subgroup_helper = new ttGroupExportHelper($subgroup['id'], $this->file, $this->indentation.' '); diff --git a/WEB-INF/lib/ttOrgImportHelper.class.php b/WEB-INF/lib/ttOrgImportHelper.class.php index 06d205e6..ccdc05b2 100644 --- a/WEB-INF/lib/ttOrgImportHelper.class.php +++ b/WEB-INF/lib/ttOrgImportHelper.class.php @@ -238,12 +238,23 @@ class ttOrgImportHelper { 'rate' => $attrs['RATE'], 'email' => $attrs['EMAIL'], 'status' => $attrs['STATUS']), false); - // TODO: what about created_by and other audit info? if ($user_id) { // Add a mapping. $this->currentGroupUserMap[$attrs['ID']] = $user_id; } else $this->errors->add($i18n->get('error.db')); } + + if ($name == 'USER_PROJECT_BIND') { + if (!ttUserHelper::insertBind(array( + 'user_id' => $this->currentGroupUserMap[$attrs['USER_ID']], + 'project_id' => $this->currentGroupProjectMap[$attrs['PROJECT_ID']], + 'group_id' => $this->current_group_id, + 'org_id' => $this->org_id, + 'rate' => $attrs['RATE'], + 'status' => $attrs['STATUS']))) { + $this->errors->add($i18n->get('error.db')); + } + } } } diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 931ae5f1..cff88227 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.12.4408 | Copyright © Anuko | +  Anuko Time Tracker 1.18.12.4409 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve}