From 0fdda830ba3e780c365c90e1fdfd5cfa7ed77244 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Wed, 7 Nov 2018 12:43:23 +0000 Subject: [PATCH] Started to populate org_id upon client creation. --- WEB-INF/lib/ttClientHelper.class.php | 5 +++-- WEB-INF/lib/ttImportHelper.class.php | 1 + WEB-INF/templates/footer.tpl | 2 +- client_add.php | 3 ++- client_edit.php | 3 ++- mobile/client_add.php | 3 ++- mobile/client_edit.php | 3 ++- 7 files changed, 13 insertions(+), 7 deletions(-) diff --git a/WEB-INF/lib/ttClientHelper.class.php b/WEB-INF/lib/ttClientHelper.class.php index 19409b90..0c12a953 100644 --- a/WEB-INF/lib/ttClientHelper.class.php +++ b/WEB-INF/lib/ttClientHelper.class.php @@ -168,6 +168,7 @@ class ttClientHelper { $mdb2 = getConnection(); $group_id = (int) $fields['group_id']; + $org_id = (int) $fields['org_id']; $name = $fields['name']; $address = $fields['address']; $tax = $fields['tax']; @@ -179,8 +180,8 @@ class ttClientHelper { $tax = str_replace(',', '.', $tax); if ($tax == '') $tax = 0; - $sql = "insert into tt_clients (group_id, name, address, tax, projects, status)". - " values ($group_id, ".$mdb2->quote($name).", ".$mdb2->quote($address).", $tax, ".$mdb2->quote($comma_separated).", ".$mdb2->quote($status).")"; + $sql = "insert into tt_clients (group_id, org_id, name, address, tax, projects, status)". + " values ($group_id, $org_id, ".$mdb2->quote($name).", ".$mdb2->quote($address).", $tax, ".$mdb2->quote($comma_separated).", ".$mdb2->quote($status).")"; $affected = $mdb2->exec($sql); if (is_a($affected, 'PEAR_Error')) diff --git a/WEB-INF/lib/ttImportHelper.class.php b/WEB-INF/lib/ttImportHelper.class.php index 8c6fd0c0..e732b989 100644 --- a/WEB-INF/lib/ttImportHelper.class.php +++ b/WEB-INF/lib/ttImportHelper.class.php @@ -222,6 +222,7 @@ class ttImportHelper { $this->clientMap[$this->currentElement['ID']] = ttClientHelper::insert(array( 'group_id' => $this->group_id, + 'org_id' => $this->org_id, 'name' => $this->currentElement['NAME'], 'address' => $this->currentElement['ADDRESS'], 'tax' => $this->currentElement['TAX'], diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 0148ae7b..c94ea858 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.09.4380 | Copyright © Anuko | +  Anuko Time Tracker 1.18.09.4381 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/client_add.php b/client_add.php index 3afcbc07..dc99e6c8 100644 --- a/client_add.php +++ b/client_add.php @@ -71,7 +71,8 @@ if ($request->isPost()) { if ($err->no()) { if (!ttClientHelper::getClientByName($cl_name)) { if (ttClientHelper::insert(array( - 'group_id' => $user->group_id, + 'group_id' => $user->getActiveGroup(), + 'org_id' => $user->org_id, 'name' => $cl_name, 'address' => $cl_address, 'tax' => $cl_tax, diff --git a/client_edit.php b/client_edit.php index 74062d06..19aa5f89 100644 --- a/client_edit.php +++ b/client_edit.php @@ -103,7 +103,8 @@ if ($request->isPost()) { if ($request->getParameter('btn_copy')) { if (!ttClientHelper::getClientByName($cl_name)) { if (ttClientHelper::insert(array( - 'group_id' => $user->group_id, + 'group_id' => $user->getActiveGroup(), + 'org_id' => $user->org_id, 'name' => $cl_name, 'address' => $cl_address, 'tax' => $cl_tax, diff --git a/mobile/client_add.php b/mobile/client_add.php index f83c720a..7a097b5f 100644 --- a/mobile/client_add.php +++ b/mobile/client_add.php @@ -71,7 +71,8 @@ if ($request->isPost()) { if ($err->no()) { if (!ttClientHelper::getClientByName($cl_name)) { if (ttClientHelper::insert(array( - 'group_id' => $user->group_id, + 'group_id' => $user->getActiveGroup(), + 'org_id' => $user->org_id, 'name' => $cl_name, 'address' => $cl_address, 'tax' => $cl_tax, diff --git a/mobile/client_edit.php b/mobile/client_edit.php index 093e9668..73d50cac 100644 --- a/mobile/client_edit.php +++ b/mobile/client_edit.php @@ -104,7 +104,8 @@ if ($request->isPost()) { if ($request->getParameter('btn_copy')) { if (!ttClientHelper::getClientByName($cl_name)) { if (ttClientHelper::insert(array( - 'group_id' => $user->group_id, + 'group_id' => $user->getActiveGroup(), + 'org_id' => $user->org_id, 'name' => $cl_name, 'address' => $cl_address, 'tax' => $cl_tax, -- 2.20.1