From: Nik Okuntseff Date: Fri, 22 Jul 2016 20:33:27 +0000 (+0000) Subject: Refactoring - some renaming to keep things consistent. X-Git-Tag: timetracker_1.19-1~1670 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=39ccd603de95cb71725f7daff81c6e7abd70bb29;p=timetracker.git Refactoring - some renaming to keep things consistent. --- diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index adadd9b3..f27bc08f 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - {if $month_total} + {if $user->isPluginEnabled('mq')} {if $over_quota} diff --git a/dbinstall.php b/dbinstall.php index a6aab22e..2b875518 100755 --- a/dbinstall.php +++ b/dbinstall.php @@ -614,8 +614,7 @@ if ($_POST) { 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 `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"); + setChange("RENAME TABLE tt_monthly_quota TO tt_monthly_quotas"); } // The update_clients function updates projects field in tt_clients table. diff --git a/mysql.sql b/mysql.sql index d9adc6e3..a4773775 100644 --- a/mysql.sql +++ b/mysql.sql @@ -340,19 +340,19 @@ create index client_idx on tt_expense_items(client_id); create index project_idx on tt_expense_items(project_id); create index invoice_idx on tt_expense_items(invoice_id); + # -# Structure for table tt_monthly_quota. -# This table lists monthly quota per team. +# Structure for table tt_monthly_quotas. +# This table keeps monthly work hour quotas for teams. # - -CREATE TABLE `tt_monthly_quota` ( - `team_id` int(11) NOT NULL, # team's id - `year` smallint(5) UNSIGNED NOT NULL, # year we'setting monthly quota for - `month` tinyint(3) UNSIGNED NOT NULL, # month we're settng monthly quota for - `quota` smallint(5) UNSIGNED NOT NULL, # the monthly quota - PRIMARY KEY (`year`,`month`,`team_id`) +CREATE TABLE `tt_monthly_quotas` ( + `team_id` int(11) NOT NULL, # team id + `year` smallint(5) UNSIGNED NOT NULL, # quota year + `month` tinyint(3) UNSIGNED NOT NULL, # quota month + `quota` smallint(5) UNSIGNED NOT NULL, # number of work hours in specified month and year + PRIMARY KEY (`team_id`,`year`,`month`) ); -ALTER TABLE `tt_monthly_quota` +ALTER TABLE `tt_monthly_quotas` ADD CONSTRAINT `FK_TT_TEAM_CONSTRAING` FOREIGN KEY (`team_id`) REFERENCES `tt_teams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; diff --git a/plugins/MonthlyQuota.class.php b/plugins/MonthlyQuota.class.php index 5961a479..0ad73d8b 100644 --- a/plugins/MonthlyQuota.class.php +++ b/plugins/MonthlyQuota.class.php @@ -16,10 +16,10 @@ class MonthlyQuota { public function update($year, $month, $quota) { $teamId = $this->usersTeamId; - $deleteSql = "DELETE FROM tt_monthly_quota WHERE year = $year AND month = $month AND team_id = $teamId"; + $deleteSql = "DELETE FROM tt_monthly_quotas WHERE year = $year AND month = $month AND team_id = $teamId"; $this->db->exec($deleteSql); if ($quota){ - $insertSql = "INSERT INTO tt_monthly_quota (team_id, year, month, quota) values ($teamId, $year, $month, $quota)"; + $insertSql = "INSERT INTO tt_monthly_quotas (team_id, year, month, quota) values ($teamId, $year, $month, $quota)"; $affected = $this->db->exec($insertSql); return (!is_a($affected, 'PEAR_Error')); } @@ -48,7 +48,7 @@ class MonthlyQuota { private function getSingle($year, $month) { $teamId = $this->usersTeamId; - $sql = "SELECT quota FROM tt_monthly_quota WHERE year = $year AND month = $month AND team_id = $teamId"; + $sql = "SELECT quota FROM tt_monthly_quotas WHERE year = $year AND month = $month AND team_id = $teamId"; $reader = $this->db->query($sql); if (is_a($reader, 'PEAR_Error')) { return false; @@ -75,7 +75,7 @@ class MonthlyQuota { private function getMany($year){ $teamId = $this->usersTeamId; - $sql = "SELECT month, quota FROM tt_monthly_quota WHERE year = $year AND team_id = $teamId"; + $sql = "SELECT month, quota FROM tt_monthly_quotas WHERE year = $year AND team_id = $teamId"; $result = array(); $res = $this->db->query($sql); if (is_a($res, 'PEAR_Error')) {
 Anuko Time Tracker 1.9.27.3516 | Copyright © Anuko | +  Anuko Time Tracker 1.9.27.3517 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/time.tpl b/WEB-INF/templates/time.tpl index 6285628f..c36f81f2 100644 --- a/WEB-INF/templates/time.tpl +++ b/WEB-INF/templates/time.tpl @@ -354,7 +354,7 @@ function get_time() { {$i18n.label.week_total}: {$week_total} {$i18n.label.day_total}: {$day_total}
{$i18n.label.month_total}: {$month_total}