From 39988068b83854ecfd7f0a86ccfe4bfb8fc89644 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Wed, 7 Nov 2018 11:59:11 +0000 Subject: [PATCH] Introduced org_id field in tt_clients table. --- WEB-INF/lib/ttGroupExportHelper.class.php | 2 +- WEB-INF/templates/footer.tpl | 2 +- dbinstall.php | 10 ++++++---- mysql.sql | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/WEB-INF/lib/ttGroupExportHelper.class.php b/WEB-INF/lib/ttGroupExportHelper.class.php index 56533e10..d643ed9d 100644 --- a/WEB-INF/lib/ttGroupExportHelper.class.php +++ b/WEB-INF/lib/ttGroupExportHelper.class.php @@ -102,7 +102,7 @@ class ttGroupExportHelper { $mdb2 = getConnection(); $result = array(); - $sql = "select * from tt_roles where group_id = $this->group_id"; // and org_id = $user->org_id <-- add this when possible + $sql = "select * from tt_roles where group_id = $this->group_id and org_id = $user->org_id"; $res = $mdb2->query($sql); $result = array(); if (!is_a($res, 'PEAR_Error')) { diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 5e48388e..0148ae7b 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - - + +
 Anuko Time Tracker 1.18.08.4379 | Copyright © Anuko | +  Anuko Time Tracker 1.18.09.4380 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index b57f157c..9ba804fd 100644 --- a/dbinstall.php +++ b/dbinstall.php @@ -956,7 +956,7 @@ if ($_POST) { print "Updated $tt_expense_items_updated tt_expense_items records...
\n"; } - if ($_POST["convert11797to11808"]) { + if ($_POST["convert11797to11809"]) { setChange("ALTER TABLE `tt_fav_reports` CHANGE `group_by` `group_by1` varchar(20) default NULL"); setChange("ALTER TABLE `tt_fav_reports` ADD `group_by2` varchar(20) default NULL AFTER `group_by1`"); setChange("ALTER TABLE `tt_fav_reports` ADD `group_by3` varchar(20) default NULL AFTER `group_by2`"); @@ -971,6 +971,8 @@ if ($_POST) { setChange("ALTER TABLE `tt_roles` ADD `org_id` int(11) default NULL AFTER `group_id`"); setChange("UPDATE `tt_roles` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.07') set org_id = group_id where org_id is null"); setChange("UPDATE `tt_site_config` SET param_value = '1.18.08', modified = now() where param_name = 'version_db' and param_value = '1.18.07'"); + setChange("ALTER TABLE `tt_clients` ADD `org_id` int(11) default NULL AFTER `group_id`"); + setChange("UPDATE `tt_site_config` SET param_value = '1.18.09', modified = now() where param_name = 'version_db' and param_value = '1.18.08'"); } if ($_POST["cleanup"]) { @@ -1016,7 +1018,7 @@ if ($_POST) {

DB Install

-
Create database structure (v1.18.08) + Create database structure (v1.18.09)
(applies only to new installations, do not execute when updating)
@@ -1061,8 +1063,8 @@ if ($_POST) {
Update database structure (v1.17.97 to v1.18.08)Update database structure (v1.17.97 to v1.18.09)
diff --git a/mysql.sql b/mysql.sql index 79e2b3ff..b29d08dc 100644 --- a/mysql.sql +++ b/mysql.sql @@ -304,6 +304,7 @@ CREATE TABLE `tt_cron` ( CREATE TABLE `tt_clients` ( `id` int(11) NOT NULL AUTO_INCREMENT, # client id `group_id` int(11) NOT NULL, # group id + `org_id` int(11) default NULL, # organization id `name` varchar(80) COLLATE utf8_bin NOT NULL, # client name `address` varchar(255) default NULL, # client address `tax` float(6,2) default '0.00', # applicable tax for this client @@ -460,4 +461,4 @@ CREATE TABLE `tt_site_config` ( PRIMARY KEY (`param_name`) ); -INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.18.08', now()); # TODO: change when structure changes. +INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.18.09', now()); # TODO: change when structure changes. -- 2.20.1