A bit more refactoring for subgroups.
authorNik Okuntseff <support@anuko.com>
Sun, 9 Dec 2018 17:34:37 +0000 (17:34 +0000)
committerNik Okuntseff <support@anuko.com>
Sun, 9 Dec 2018 17:34:37 +0000 (17:34 +0000)
WEB-INF/lib/ttProjectHelper.class.php
WEB-INF/templates/footer.tpl
mobile/project_add.php
mobile/project_edit.php
project_add.php
project_edit.php

index 87d75c6..06dcd28 100644 (file)
@@ -196,10 +196,11 @@ class ttProjectHelper {
   // insert function inserts a new project into database.
   static function insert($fields)
   {
+    global $user;
     $mdb2 = getConnection();
 
-    $group_id = (int) $fields['group_id'];
-    $org_id = (int) $fields['org_id'];
+    $group_id = $user->getGroup();
+    $org_id = $user->org_id;
 
     $name = $fields['name'];
     $description = $fields['description'];
index 96e6058..1cb0da7 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.29.4622 | 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.29.4623 | 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>
index aa3e40f..98f7c06 100644 (file)
@@ -77,10 +77,7 @@ if ($request->isPost()) {
 
   if ($err->no()) {
     if (!ttProjectHelper::getProjectByName($cl_name)) {
-      if (ttProjectHelper::insert(array(
-        'group_id' => $user->getGroup(),
-        'org_id' => $user->org_id,
-        'name' => $cl_name,
+      if (ttProjectHelper::insert(array('name' => $cl_name,
         'description' => $cl_description,
         'users' => $cl_users,
         'tasks' => $cl_tasks,
index afe9995..40728aa 100644 (file)
@@ -118,10 +118,7 @@ if ($request->isPost()) {
 
     if ($request->getParameter('btn_copy')) {
       if (!ttProjectHelper::getProjectByName($cl_name)) {
-        if (ttProjectHelper::insert(array(
-          'group_id' => $user->getGroup(),
-          'org_id' => $user->org_id,
-          'name' => $cl_name,
+        if (ttProjectHelper::insert(array('name' => $cl_name,
           'description' => $cl_description,
           'users' => $cl_users,
           'tasks' => $cl_tasks,
index e8f9888..e00a031 100644 (file)
@@ -77,10 +77,7 @@ if ($request->isPost()) {
 
   if ($err->no()) {
     if (!ttProjectHelper::getProjectByName($cl_name)) {
-      if (ttProjectHelper::insert(array(
-        'group_id' => $user->getGroup(),
-        'org_id' => $user->org_id,
-        'name' => $cl_name,
+      if (ttProjectHelper::insert(array('name' => $cl_name,
         'description' => $cl_description,
         'users' => $cl_users,
         'tasks' => $cl_tasks,
index 7f48c91..6fe0828 100644 (file)
@@ -117,10 +117,7 @@ if ($request->isPost()) {
 
     if ($request->getParameter('btn_copy')) {
       if (!ttProjectHelper::getProjectByName($cl_name)) {
-        if (ttProjectHelper::insert(array(
-          'group_id' => $user->getGroup(),
-          'org_id' => $user->org_id,
-          'name' => $cl_name,
+        if (ttProjectHelper::insert(array('name' => $cl_name,
           'description' => $cl_description,
           'users' => $cl_users,
           'tasks' => $cl_tasks,