From 270ff8df9ea85d9deb349accedfaedc2f8734251 Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Mon, 18 Jul 2016 20:48:06 +0000 Subject: [PATCH] Refactoring: renamed a field for clarity. --- WEB-INF/lib/ttTeamHelper.class.php | 2 +- dbinstall.php | 5 +++-- mysql.sql | 2 +- plugins/MonthlyQuota.class.php | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index e91a794d..4ac69c3b 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -731,7 +731,7 @@ class ttTeamHelper { if (isset($fields['record_type'])) $record_type_part = ', record_type = '.intval($fields['record_type']); if (isset($fields['plugins'])) $plugins_part = ', plugins = '.$mdb2->quote($fields['plugins']); if (isset($fields['lock_spec'])) $lock_spec_part = ', lock_spec = '.$mdb2->quote($fields['lock_spec']); - if (isset($fields['working_hours'])) $working_hours_part = ', daily_working_hours = '.$mdb2->quote($fields['working_hours']); + if (isset($fields['working_hours'])) $working_hours_part = ', workday_hours = '.$mdb2->quote($fields['working_hours']); $sql = "update tt_teams set $name_part $addr_part $currency_part $lang_part $decimal_mark_part $date_format_part $time_format_part $week_start_part $tracking_mode_part $record_type_part diff --git a/dbinstall.php b/dbinstall.php index 4a7bcd12..32540fd6 100755 --- a/dbinstall.php +++ b/dbinstall.php @@ -613,8 +613,9 @@ if ($_POST) { setChange("ALTER TABLE tt_teams DROP locktime"); setChange("CREATE TABLE `tt_monthly_quota` (`team_id` int(11) NOT NULL, `year` smallint(5) UNSIGNED NOT NULL, `month` tinyint(3) UNSIGNED NOT NULL, `quota` smallint(5) UNSIGNED NOT NULL, PRIMARY KEY (`year`,`month`,`team_id`))"); setChange("ALTER TABLE `tt_monthly_quota` ADD CONSTRAINT `FK_TT_TEAM_CONSTRAING` FOREIGN KEY (`team_id`) REFERENCES `tt_teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE"); - setChange("ALTER TABLE `tt_teams` ADD `daily_working_hours` SMALLINT NULL DEFAULT '8' AFTER `lock_spec`"); - setChange("UPDATE `tt_teams` SET `daily_working_hours` = 8"); + setChange("ALTER TABLE `tt_teams` ADD `workday_hours` SMALLINT NULL DEFAULT '8' AFTER `lock_spec`"); + setChange("UPDATE `tt_teams` SET `workday_hours` = 8"); + setChange("ALTER TABLE tt_teams DROP daily_working_hours"); } // The update_clients function updates projects field in tt_clients table. diff --git a/mysql.sql b/mysql.sql index bfc198a9..d9adc6e3 100644 --- a/mysql.sql +++ b/mysql.sql @@ -28,7 +28,7 @@ CREATE TABLE `tt_teams` ( `plugins` varchar(255) default NULL, # a list of enabled plugins for team `lock_spec` varchar(255) default NULL, # Cron specification for record locking, # for example: "0 10 * * 1" for "weekly on Mon at 10:00". - `daily_working_hours` smallint(6) DEFAULT '8', # number of working hours per days, a worker is suppose to work + `workday_hours` smallint(6) DEFAULT '8', # number of work hours in a regular day `custom_logo` tinyint(4) default '0', # whether to use a custom logo or not `status` tinyint(4) default '1', # team status PRIMARY KEY (`id`) diff --git a/plugins/MonthlyQuota.class.php b/plugins/MonthlyQuota.class.php index b50469b3..5961a479 100644 --- a/plugins/MonthlyQuota.class.php +++ b/plugins/MonthlyQuota.class.php @@ -36,14 +36,14 @@ class MonthlyQuota { public function getDailyWorkingHours(){ $teamId = $this->usersTeamId; - $sql = "SELECT daily_working_hours FROM tt_teams where id = $teamId"; + $sql = "SELECT workday_hours FROM tt_teams where id = $teamId"; $reader = $this->db->query($sql); if (is_a($reader, 'PEAR_Error')) { return false; } $row = $reader->fetchRow(); - return $row["daily_working_hours"]; + return $row["workday_hours"]; } private function getSingle($year, $month) { -- 2.20.1