Improved ttUser::updateGroup for subgroup support.
authorNik Okuntseff <support@anuko.com>
Fri, 23 Nov 2018 12:20:09 +0000 (12:20 +0000)
committerNik Okuntseff <support@anuko.com>
Fri, 23 Nov 2018 12:20:09 +0000 (12:20 +0000)
WEB-INF/lib/ttUser.class.php
WEB-INF/templates/footer.tpl

index ad5c041..79f7ae7 100644 (file)
@@ -509,8 +509,13 @@ class ttUser {
     if (!($this->can('manage_basic_settings') ||
       $this->can('manage_advanced_settings') ||
       $this->can('manage_features'))) return false;
+    // TODO: update the above for subgroup updates.
+
+    $group_id = $fields['group_id'];
+    if ($group_id && !$this->isGroupValid($group_id)) return false;
 
     $mdb2 = getConnection();
+    if (!$group_id) $group_id = $this->getActiveGroup();
 
     if (isset($fields['name'])) $name_part = ', name = '.$mdb2->quote($fields['name']);
     if (isset($fields['currency'])) $currency_part = ', currency = '.$mdb2->quote($fields['currency']);
@@ -537,7 +542,7 @@ class ttUser {
       $time_format_part.$week_start_part.$tracking_mode_part.$task_required_part.$project_required_part.$record_type_part.
       $bcc_email_part.$allow_ip_part.$plugins_part.$config_part.$lock_spec_part.$workday_minutes_part.$modified_part, ',');
 
-    $sql = "update tt_groups set $parts where id = $this->group_id";
+    $sql = "update tt_groups set $parts where id = $group_id and org_id = $this->org_id";
     $affected = $mdb2->exec($sql);
     if (is_a($affected, 'PEAR_Error')) return false;
 
index 50749d4..72436ab 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.27.4495 | 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.27.4496 | 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>