From: Nik Okuntseff Date: Fri, 2 Nov 2018 13:23:35 +0000 (+0000) Subject: Updated ttImportHelper class to populate org_id in newly imported groups. X-Git-Tag: timetracker_1.19-1~730 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5d2849f60950348fd2b862f40ae98e9fce837528;p=timetracker.git Updated ttImportHelper class to populate org_id in newly imported groups. --- diff --git a/WEB-INF/lib/ttImportHelper.class.php b/WEB-INF/lib/ttImportHelper.class.php index d966f896..6686d40f 100644 --- a/WEB-INF/lib/ttImportHelper.class.php +++ b/WEB-INF/lib/ttImportHelper.class.php @@ -474,11 +474,18 @@ class ttImportHelper { $sql = 'insert into tt_groups '.$columns.$values; $affected = $mdb2->exec($sql); - if (!is_a($affected, 'PEAR_Error')) { - $group_id = $mdb2->lastInsertID('tt_groups', 'id'); - return $group_id; - } - return false; + if (is_a($affected, 'PEAR_Error')) return false; + + $group_id = $mdb2->lastInsertID('tt_groups', 'id'); + + // Update org_id with group_id. + // NOTE: Both export and import need an additional effort to properly operate on subgroups. + // Currently we are importing one group only, which becomes a top level group. + $sql = "update tt_groups set org_id = $group_id where org_id is NULL and id = $group_id"; + $affected = $mdb2->exec($sql); + if (is_a($affected, 'PEAR_Error')) return false; + + return $group_id; } // insertMonthlyQuota - a helper function to insert a monthly quota. diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 74ea3c29..878b85ee 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.06.4348 | Copyright © Anuko | +  Anuko Time Tracker 1.18.06.4349 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve}