X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/bcfe9680fdb90d26de543b2c43feabefdcac3c20..0bf91be4d6ee52adaf09a74d729c7a34cf012de7:/WEB-INF/lib/ttImportHelper.class.php diff --git a/WEB-INF/lib/ttImportHelper.class.php b/WEB-INF/lib/ttImportHelper.class.php index 8be7a831..6686d40f 100644 --- a/WEB-INF/lib/ttImportHelper.class.php +++ b/WEB-INF/lib/ttImportHelper.class.php @@ -335,7 +335,9 @@ class ttImportHelper { 'chnote' => (int) $this->currentElement['SHOW_NOTE'], 'chcf_1' => (int) $this->currentElement['SHOW_CUSTOM_FIELD_1'], 'chunits' => (int) $this->currentElement['SHOW_WORK_UNITS'], - 'group_by' => $this->currentElement['GROUP_BY'], + 'group_by1' => $this->currentElement['GROUP_BY1'], + 'group_by2' => $this->currentElement['GROUP_BY2'], + 'group_by3' => $this->currentElement['GROUP_BY3'], 'chtotalsonly' => (int) $this->currentElement['SHOW_TOTALS_ONLY'])); } $this->currentTag = ''; @@ -472,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.