From 6ab97ede1a08afd9f703a713b0eb6addd560a589 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 9 Dec 2018 17:34:37 +0000 Subject: [PATCH] A bit more refactoring for subgroups. --- WEB-INF/lib/ttProjectHelper.class.php | 5 +++-- WEB-INF/templates/footer.tpl | 2 +- mobile/project_add.php | 5 +---- mobile/project_edit.php | 5 +---- project_add.php | 5 +---- project_edit.php | 5 +---- 6 files changed, 8 insertions(+), 19 deletions(-) diff --git a/WEB-INF/lib/ttProjectHelper.class.php b/WEB-INF/lib/ttProjectHelper.class.php index 87d75c62..06dcd286 100644 --- a/WEB-INF/lib/ttProjectHelper.class.php +++ b/WEB-INF/lib/ttProjectHelper.class.php @@ -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']; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 96e60584..1cb0da70 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.29.4622 | Copyright © Anuko | +  Anuko Time Tracker 1.18.29.4623 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/mobile/project_add.php b/mobile/project_add.php index aa3e40f7..98f7c064 100644 --- a/mobile/project_add.php +++ b/mobile/project_add.php @@ -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, diff --git a/mobile/project_edit.php b/mobile/project_edit.php index afe99953..40728aaf 100644 --- a/mobile/project_edit.php +++ b/mobile/project_edit.php @@ -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, diff --git a/project_add.php b/project_add.php index e8f98883..e00a0316 100644 --- a/project_add.php +++ b/project_add.php @@ -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, diff --git a/project_edit.php b/project_edit.php index 7f48c910..6fe08287 100644 --- a/project_edit.php +++ b/project_edit.php @@ -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, -- 2.20.1