From 6bd6e0481ca4c22c47de758d53eef9db5e565e5c Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sat, 17 Nov 2018 21:24:23 +0000 Subject: [PATCH] Populating tt_user_project_binds. --- WEB-INF/lib/ttOrgHelper.class.php | 5 +++++ WEB-INF/templates/footer.tpl | 2 +- dbinstall.php | 4 +--- mysql.sql | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/WEB-INF/lib/ttOrgHelper.class.php b/WEB-INF/lib/ttOrgHelper.class.php index 36921239..c69fc7a7 100644 --- a/WEB-INF/lib/ttOrgHelper.class.php +++ b/WEB-INF/lib/ttOrgHelper.class.php @@ -90,6 +90,11 @@ class ttOrgHelper { // However, at this time not all tables have org_id. // So, we need to add the field as we write code here. + // Delete expense items. + $sql = "delete from tt_expense_items where org_id = $org_id"; + $affected = $mdb2->exec($sql); + if (is_a($affected, 'PEAR_Error')) return false; + // Delete predefined expenses. $sql = "delete from tt_predefined_expenses where org_id = $org_id"; $affected = $mdb2->exec($sql); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 0fa85daa..433f5934 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.17.4445 | Copyright © Anuko | +  Anuko Time Tracker 1.18.17.4446 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/dbinstall.php b/dbinstall.php index 437dac2e..eec02368 100644 --- a/dbinstall.php +++ b/dbinstall.php @@ -1006,9 +1006,7 @@ if ($_POST) { 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'"); setChange("UPDATE `tt_expense_items` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.17') set org_id = group_id where org_id is null"); - - // 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"); + setChange("update `tt_user_project_binds` upb inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.17') inner join `tt_users` u on u.id = upb.user_id set upb.group_id = u.group_id, upb.org_id = u.org_id where upb.org_id is null"); } if ($_POST["cleanup"]) { diff --git a/mysql.sql b/mysql.sql index 5ffc79e4..5ee9ad4a 100644 --- a/mysql.sql +++ b/mysql.sql @@ -384,7 +384,7 @@ CREATE TABLE `tt_custom_field_options` ( # This table supplements tt_log and contains custom field values for records. # CREATE TABLE `tt_custom_field_log` ( - `id` bigint NOT NULL auto_increment, # cutom field log id + `id` bigint NOT NULL auto_increment, # custom field log id `log_id` bigint NOT NULL, # id of a record in tt_log this record corresponds to `field_id` int(11) NOT NULL, # custom field id `option_id` int(11) default NULL, # Option id. Used for dropdown custom fields. -- 2.20.1