From 3cd816de20457c5224d72db358833b234571be70 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Tue, 19 Mar 2019 14:58:32 +0000 Subject: [PATCH] Added group_key field to tt_groups. --- WEB-INF/lib/common.lib.php | 11 +++++++++++ WEB-INF/lib/ttFileHelper.class.php | 4 +--- WEB-INF/templates/footer.tpl | 2 +- dbinstall.php | 10 ++++++---- mysql.sql | 3 ++- 5 files changed, 21 insertions(+), 9 deletions(-) diff --git a/WEB-INF/lib/common.lib.php b/WEB-INF/lib/common.lib.php index 6526d730..e09a943f 100644 --- a/WEB-INF/lib/common.lib.php +++ b/WEB-INF/lib/common.lib.php @@ -406,3 +406,14 @@ function ttDateToUserFormat($date) $o_date = new DateAndTime(DB_DATEFORMAT, $date); return $o_date->toString($user->date_format); } + +// ttRandomString generates a random alphanumeric string. +function ttRandomString($length = 32) { + $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $charactersLength = strlen($characters); + $randomString = ''; + for ($i = 0; $i < $length; $i++) { + $randomString .= $characters[rand(0, $charactersLength - 1)]; + } + return $randomString; +} diff --git a/WEB-INF/lib/ttFileHelper.class.php b/WEB-INF/lib/ttFileHelper.class.php index 68bb38a5..80f07166 100644 --- a/WEB-INF/lib/ttFileHelper.class.php +++ b/WEB-INF/lib/ttFileHelper.class.php @@ -99,7 +99,7 @@ class ttFileHelper { $this->errors->add($i18n->get('error.file_storage')); } } else { - // Site id found, need to update site attributes. + // Site id found. $this->site_id = $val['id']; // Obtain site key. @@ -112,8 +112,6 @@ class ttFileHelper { // putFile - puts uploaded file in remote storage. function putFile($fields) { - // if (!$this->site_id || !$this->site_key) return false; - global $i18n; global $user; $mdb2 = getConnection(); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 64d84101..d6be8733 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - - + +
 Anuko Time Tracker 1.18.59.4877 | Copyright © Anuko | +  Anuko Time Tracker 1.18.61.4878 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index 37b1d09d..063f2022 100644 --- a/dbinstall.php +++ b/dbinstall.php @@ -972,7 +972,7 @@ if ($_POST) { print "Updated $tt_expense_items_updated tt_expense_items records...
\n"; } - if ($_POST["convert11797to11860"]) { + if ($_POST["convert11797to11861"]) { ttExecute("ALTER TABLE `tt_fav_reports` CHANGE `group_by` `group_by1` varchar(20) default NULL"); ttExecute("ALTER TABLE `tt_fav_reports` ADD `group_by2` varchar(20) default NULL AFTER `group_by1`"); ttExecute("ALTER TABLE `tt_fav_reports` ADD `group_by3` varchar(20) default NULL AFTER `group_by2`"); @@ -1131,6 +1131,8 @@ if ($_POST) { ttExecute("UPDATE `tt_site_config` SET param_value = '1.18.59', modified = now() where param_name = 'version_db' and param_value = '1.18.55'"); ttExecute("ALTER TABLE `tt_files` ADD `file_key` varchar(32) AFTER `remote_id`"); ttExecute("UPDATE `tt_site_config` SET param_value = '1.18.60', modified = now() where param_name = 'version_db' and param_value = '1.18.59'"); + ttExecute("ALTER TABLE `tt_groups` ADD `group_key` varchar(32) AFTER `org_id`"); + ttExecute("UPDATE `tt_site_config` SET param_value = '1.18.61', modified = now() where param_name = 'version_db' and param_value = '1.18.60'"); } if ($_POST["cleanup"]) { @@ -1180,7 +1182,7 @@ if ($_POST) {

DB Install

-
Create database structure (v1.18.60) + Create database structure (v1.18.61)
(applies only to new installations, do not execute when updating)
@@ -1225,8 +1227,8 @@ if ($_POST) {
Update database structure (v1.17.97 to v1.18.60)Update database structure (v1.17.97 to v1.18.61)
diff --git a/mysql.sql b/mysql.sql index d52882cc..e526e614 100644 --- a/mysql.sql +++ b/mysql.sql @@ -16,6 +16,7 @@ CREATE TABLE `tt_groups` ( `id` int(11) NOT NULL auto_increment, # group id `parent_id` int(11) default NULL, # parent group id `org_id` int(11) default NULL, # organization id (id of top group) + `group_key` varchar(32) default NULL, # group key `name` varchar(80) default NULL, # group name `description` varchar(255) default NULL, # group description `currency` varchar(7) default NULL, # currency symbol @@ -572,4 +573,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.60', now()); # TODO: change when structure changes. +INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.18.61', now()); # TODO: change when structure changes. -- 2.20.1