$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')) {
$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.
// - 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.
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.05.4346 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.06.4347 | Copyright © <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>