Started to populate org_id upon group creation.
authorNik Okuntseff <support@anuko.com>
Fri, 2 Nov 2018 12:36:58 +0000 (12:36 +0000)
committerNik Okuntseff <support@anuko.com>
Fri, 2 Nov 2018 12:36:58 +0000 (12:36 +0000)
WEB-INF/lib/ttGroupHelper.class.php
WEB-INF/lib/ttRegistrator.class.php
WEB-INF/lib/ttUser.class.php
WEB-INF/templates/footer.tpl

index 6ffa6b2..d28c306 100644 (file)
@@ -36,7 +36,7 @@ class ttGroupHelper {
     $mdb2 = getConnection();
 
     $sql =  "select id, name, created, lang from tt_groups".
-            " where status = 1 and org_id is NULL order by id desc";
+            " where status = 1 and org_id is NULL or org_id = id order by id desc";
     $res = $mdb2->query($sql);
     $result = array();
     if (!is_a($res, 'PEAR_Error')) {
index 6a2142b..48f4b0a 100644 (file)
@@ -137,12 +137,16 @@ class ttRegistrator {
 
     $sql = "insert into tt_groups (name, currency, lang, created, created_ip) values($name, $currency, $lang, $created, $created_ip)";
     $affected = $mdb2->exec($sql);
+    if (is_a($affected, 'PEAR_Error')) return false;
 
-    if (!is_a($affected, 'PEAR_Error')) {
-      $group_id = $mdb2->lastInsertID('tt_groups', 'id');
-      return $group_id;
-    }
-    return false;
+    $group_id = $mdb2->lastInsertID('tt_groups', 'id');
+
+    // Update org_id with group_id.
+    $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;
   }
 
   // The createUser creates a user in database as part of registration process.
index 9ce67ac..3085a0d 100644 (file)
@@ -365,7 +365,7 @@ class ttUser {
   // - A parent group (..) of a currently selected group, if available.
   // - A currently selected group (.) represented by $behalf_group_id.
   // - All subgroups (only immediate children) of a currently selected group.
-  function getGroups($options) {
+  function getGroups() {
     $mdb2 = getConnection();
 
     // $sql = 'select id, parent_id, name from tt_groups where org_id = $this->org_id ...'; // TODO: parent_id is now NULL in db, fix this.
index a14235f..80c8910 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.05.4346 | 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.4347 | 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>