X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/8a0ec8135a1bb4f42c0ae89b7d97e3dfd500aba5..5d2849f60950348fd2b862f40ae98e9fce837528:/WEB-INF/lib/ttImportHelper.class.php 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.