Updated ttImportHelper class to populate org_id in newly imported groups.
authorNik Okuntseff <support@anuko.com>
Fri, 2 Nov 2018 13:23:35 +0000 (13:23 +0000)
committerNik Okuntseff <support@anuko.com>
Fri, 2 Nov 2018 13:23:35 +0000 (13:23 +0000)
WEB-INF/lib/ttImportHelper.class.php
WEB-INF/templates/footer.tpl

index d966f89..6686d40 100644 (file)
@@ -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.
index 74ea3c2..878b85e 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.18.06.4348 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.06.4349 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
             <a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
             <a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
             <a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>