From: Nik Okuntseff Date: Sat, 17 Nov 2018 17:48:55 +0000 (+0000) Subject: Introduced org_id in tt_expense_items table. X-Git-Tag: timetracker_1.19-1~629 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=0f552019a1c58ff22df3e9f59b9efe22261931fa;p=timetracker.git Introduced org_id in tt_expense_items table. --- diff --git a/WEB-INF/lib/ttPredefinedExpenseHelper.class.php b/WEB-INF/lib/ttPredefinedExpenseHelper.class.php index 16826a9d..27a3a833 100644 --- a/WEB-INF/lib/ttPredefinedExpenseHelper.class.php +++ b/WEB-INF/lib/ttPredefinedExpenseHelper.class.php @@ -105,7 +105,7 @@ class ttPredefinedExpenseHelper { $cost = str_replace($user->decimal_mark, '.', $cost); $sql = "update tt_predefined_expenses set name = ".$mdb2->quote($name).", cost = ".$mdb2->quote($cost). - " where id = $predefined_expense_id and group_id = $group_id"; // TODO: add org_id when possible. + " where id = $predefined_expense_id and group_id = $group_id and org_id = $org_id"; $affected = $mdb2->exec($sql); return (!is_a($affected, 'PEAR_Error')); } diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 232208f9..09117895 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - - + +
 Anuko Time Tracker 1.18.16.4442 | Copyright © Anuko | +  Anuko Time Tracker 1.18.17.4443 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index 069016ab..e8dc454b 100644 --- a/dbinstall.php +++ b/dbinstall.php @@ -957,7 +957,7 @@ if ($_POST) { print "Updated $tt_expense_items_updated tt_expense_items records...
\n"; } - if ($_POST["convert11797to11816"]) { + if ($_POST["convert11797to11817"]) { 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`"); @@ -1003,6 +1003,8 @@ if ($_POST) { setChange("ALTER TABLE `tt_predefined_expenses` ADD `org_id` int(11) default NULL AFTER `group_id`"); setChange("UPDATE `tt_site_config` SET param_value = '1.18.16', modified = now() where param_name = 'version_db' and param_value = '1.18.15'"); setChange("UPDATE `tt_predefined_expenses` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.16') set org_id = group_id where org_id is null"); + setChange("ALTER TABLE `tt_expense_items` ADD `org_id` int(11) default NULL AFTER `group_id`"); + setChange("UPDATE `tt_site_config` SET param_value = '1.18.17', modified = now() where param_name = 'version_db' and param_value = '1.18.16'"); // TODO: this does not work as we just introduced group_id and it is NULL. Same for tt_project_task_binds. Improve. // setChange("UPDATE `tt_user_project_binds` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.12') set org_id = group_id where org_id is null"); @@ -1052,7 +1054,7 @@ if ($_POST) {

DB Install

-
Create database structure (v1.18.16) + Create database structure (v1.18.17)
(applies only to new installations, do not execute when updating)
@@ -1097,8 +1099,8 @@ if ($_POST) {
Update database structure (v1.17.97 to v1.18.16)Update database structure (v1.17.97 to v1.18.17)
diff --git a/mysql.sql b/mysql.sql index 9a6030c1..5ffc79e4 100644 --- a/mysql.sql +++ b/mysql.sql @@ -405,6 +405,7 @@ CREATE TABLE `tt_expense_items` ( `date` date NOT NULL, # date the record is for `user_id` int(11) NOT NULL, # user id the expense item is reported by `group_id` int(11) default NULL, # group id + `org_id` int(11) default NULL, # organization id `client_id` int(11) default NULL, # client id `project_id` int(11) default NULL, # project id `name` text NOT NULL, # expense item name (what is an expense for) @@ -471,4 +472,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.16', now()); # TODO: change when structure changes. +INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.18.17', now()); # TODO: change when structure changes.