Added handling of audit info to user registration.
authorNik Okuntseff <support@anuko.com>
Wed, 21 Mar 2018 21:11:48 +0000 (21:11 +0000)
committerNik Okuntseff <support@anuko.com>
Wed, 21 Mar 2018 21:11:48 +0000 (21:11 +0000)
WEB-INF/lib/ttRegistrator.class.php
WEB-INF/templates/footer.tpl

index 0e51ce3..ea76f3a 100644 (file)
@@ -122,8 +122,10 @@ class ttRegistrator {
     $name = $mdb2->quote($this->group_name);
     $currency = $mdb2->quote($this->currency);
     $lang = $mdb2->quote($this->lang);
+    $created = 'now()';
+    $created_ip = $mdb2->quote($_SERVER['REMOTE_ADDR']);
 
-    $sql = "insert into tt_teams (name, currency, lang) values($name, $currency, $lang)";
+    $sql = "insert into tt_teams (name, currency, lang, created, created_ip) values($name, $currency, $lang, $created, $created_ip)";
     $affected = $mdb2->exec($sql);
 
     if (!is_a($affected, 'PEAR_Error')) {
@@ -149,6 +151,15 @@ class ttRegistrator {
     $affected = $mdb2->exec($sql);
     if (!is_a($affected, 'PEAR_Error')) {
       $user_id = $mdb2->lastInsertID('tt_users', 'id');
+
+      // Update created_by field for the team with user id, now that we have it.
+      $sql = "update tt_teams set created_by = $user_id where id = $this->group_id and created_by is null";
+      $affected = $mdb2->exec($sql);
+
+      // Update created_by field for user by setting to self.
+      $sql = "update tt_users set created_by = $user_id where id = $user_id and team_id = $this->group_id and created_by is null";
+      $affected = $mdb2->exec($sql);
+
       return $user_id;
     }
     return false;
index 1a731bb..54e00f3 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.17.65.4128 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.17.65.4129 | 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>