From: Nik Okuntseff Date: Wed, 21 Mar 2018 21:11:48 +0000 (+0000) Subject: Added handling of audit info to user registration. X-Git-Tag: timetracker_1.19-1~981 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=15684e556a6829fbea1511e99ee5bf8053d69295;p=timetracker.git Added handling of audit info to user registration. --- diff --git a/WEB-INF/lib/ttRegistrator.class.php b/WEB-INF/lib/ttRegistrator.class.php index 0e51ce39..ea76f3a2 100644 --- a/WEB-INF/lib/ttRegistrator.class.php +++ b/WEB-INF/lib/ttRegistrator.class.php @@ -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; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 1a731bba..54e00f39 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.17.65.4128 | Copyright © Anuko | +  Anuko Time Tracker 1.17.65.4129 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve}