<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.9.27.3516 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.9.27.3517 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
<td align="left">{$i18n.label.week_total}: {$week_total}</td>
<td align="right">{$i18n.label.day_total}: {$day_total}</td>
</tr>
- {if $month_total}
+ {if $user->isPluginEnabled('mq')}
<tr>
<td align="left">{$i18n.label.month_total}: {$month_total}</td>
{if $over_quota}
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.
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;
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'));
}
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;
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')) {