From: Nik Okuntseff Date: Wed, 14 Feb 2018 15:58:48 +0000 (+0000) Subject: Fixed import and export for latest changes. X-Git-Tag: timetracker_1.19-1~1126 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=e3ed046e205a14772a8157def21fea9a14acdde8;p=timetracker.git Fixed import and export for latest changes. --- diff --git a/WEB-INF/lib/ttExportHelper.class.php b/WEB-INF/lib/ttExportHelper.class.php index bf43f28c..0e116478 100644 --- a/WEB-INF/lib/ttExportHelper.class.php +++ b/WEB-INF/lib/ttExportHelper.class.php @@ -64,8 +64,9 @@ class ttExportHelper { fwrite($file, "currency."\" decimal_mark=\"".$user->decimal_mark."\" lang=\"".$user->lang. "\" date_format=\"".$user->date_format."\" time_format=\"".$user->time_format."\" week_start=\"".$user->week_start. "\" tracking_mode=\"".$user->tracking_mode."\" project_required=\"".$user->project_required."\" task_required=\"".$user->task_required. - "\" record_type=\"".$user->record_type."\" uncompleted_indicators=\"".$user->uncompleted_indicators."\" bcc_email=\"".$user->bcc_email. - "\" plugins=\"".$user->plugins."\" lock_spec=\"".$user->lock_spec."\" workday_hours=\"".$user->workday_hours. + "\" record_type=\"".$user->record_type."\" bcc_email=\"".$user->bcc_email. + "\" plugins=\"".$user->plugins."\" lock_spec=\"".$user->lock_spec."\" workday_minutes=\"".$user->workday_minutes. + "\" config=\"".$user->config. "\">\n"); fwrite($file, " team."]]>\n"); fwrite($file, "\n"); @@ -206,7 +207,7 @@ class ttExportHelper { $quotas = ttTeamHelper::getMonthlyQuotas($user->team_id); fwrite($file, "\n"); foreach ($quotas as $quota) { - fwrite($file, " \n"); + fwrite($file, " \n"); } fwrite($file, "\n"); diff --git a/WEB-INF/lib/ttImportHelper.class.php b/WEB-INF/lib/ttImportHelper.class.php index da4176c1..9b1aad2a 100644 --- a/WEB-INF/lib/ttImportHelper.class.php +++ b/WEB-INF/lib/ttImportHelper.class.php @@ -126,11 +126,11 @@ class ttImportHelper { 'project_required' => $this->teamData['PROJECT_REQUIRED'], 'task_required' => $this->teamData['TASK_REQUIRED'], 'record_type' => $this->teamData['RECORD_TYPE'], - 'uncompleted_indicators' => $this->teamData['UNCOMPLETED_INDICATORS'], 'bcc_email' => $this->teamData['BCC_EMAIL'], 'plugins' => $this->teamData['PLUGINS'], 'lock_spec' => $this->teamData['LOCK_SPEC'], - 'workday_hours' => $this->teamData['WORKDAY_HOURS'])); + 'workday_minutes' => $this->teamData['WORKDAY_MINUTES'], + 'config' => $this->teamData['CONFIG'])); if ($team_id) { $this->team_id = $team_id; foreach ($this->users as $key=>$user_item) { @@ -216,7 +216,7 @@ class ttImportHelper { } if ($name == 'MONTHLY_QUOTA' && $this->canImport) { - $this->insertMonthlyQuota($this->team_id, $this->currentElement['YEAR'], $this->currentElement['MONTH'], $this->currentElement['QUOTA']); + $this->insertMonthlyQuota($this->team_id, $this->currentElement['YEAR'], $this->currentElement['MONTH'], $this->currentElement['MINUTES']); } if ($name == 'LOG_ITEM' && $this->canImport) { @@ -410,9 +410,9 @@ class ttImportHelper { } // insertMonthlyQuota - a helper function to insert a monthly quota. - private function insertMonthlyQuota($team_id, $year, $month, $quota) { + private function insertMonthlyQuota($team_id, $year, $month, $minutes) { $mdb2 = getConnection(); - $sql = "INSERT INTO tt_monthly_quotas (team_id, year, month, quota) values ($team_id, $year, $month, $quota)"; + $sql = "INSERT INTO tt_monthly_quotas (team_id, year, month, minutes) values ($team_id, $year, $month, $minutes)"; $affected = $mdb2->exec($sql); return (!is_a($affected, 'PEAR_Error')); } diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index c0baa3d8..a58c2cd3 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -548,7 +548,7 @@ class ttTeamHelper { $mdb2 = getConnection(); $result = array(); - $sql = "select year, month, quota from tt_monthly_quotas where team_id = $team_id"; + $sql = "select year, month, minutes from tt_monthly_quotas where team_id = $team_id"; $res = $mdb2->query($sql); $result = array(); if (!is_a($res, 'PEAR_Error')) { @@ -727,15 +727,6 @@ class ttTeamHelper { $record_type_v = ''; } - $uncompleted_indicators = $fields['uncompleted_indicators']; - if ($uncompleted_indicators !== null) { - $uncompleted_indicators_f = ', uncompleted_indicators'; - $uncompleted_indicators_v = ', ' . (int)$uncompleted_indicators; - } else { - $uncompleted_indicators_f = ''; - $uncompleted_indicators_v = ''; - } - $bcc_email = $fields['bcc_email']; if ($bcc_email !== null) { $bcc_email_f = ', bcc_email'; @@ -763,19 +754,28 @@ class ttTeamHelper { $lockspec_v = ''; } - $workday_hours = $fields['workday_hours']; - if ($workday_hours !== null) { - $workday_hours_f = ', workday_hours'; - $workday_hours_v = ', ' . (int)$workday_hours; + $workday_minutes = $fields['workday_minutes']; + if ($workday_minutes !== null) { + $workday_minutes_f = ', workday_minutes'; + $workday_minutes_v = ', ' . (int)$workday_minutes; + } else { + $workday_minutes_f = ''; + $workday_minutes_v = ''; + } + + $config = $fields['config']; + if ($config !== null) { + $config_f = ', config'; + $config_v = ', ' . $mdb2->quote($config); } else { - $workday_hours_f = ''; - $workday_hours_v = ''; + $config_f = ''; + $config_f = ''; } - $sql = "insert into tt_teams (name, currency $decimal_mark_f, lang $date_format_f $time_format_f $week_start_f $tracking_mode_f $project_required_f $task_required_f $record_type_f $uncompleted_indicators_f $bcc_email_f $plugins_f $lockspec_f $workday_hours_f) + $sql = "insert into tt_teams (name, currency $decimal_mark_f, lang $date_format_f $time_format_f $week_start_f $tracking_mode_f $project_required_f $task_required_f $record_type_f $bcc_email_f $plugins_f $lockspec_f $workday_minutes_f $config_f) values(".$mdb2->quote(trim($fields['name'])). ", ".$mdb2->quote(trim($fields['currency']))." $decimal_mark_v, ".$mdb2->quote($lang). - "$date_format_v $time_format_v $week_start_v $tracking_mode_v $project_required_v $task_required_v $record_type_v $uncompleted_indicators_v $bcc_email_v $plugins_v $lockspec_v $workday_hours_v)"; + "$date_format_v $time_format_v $week_start_v $tracking_mode_v $project_required_v $task_required_v $record_type_v $bcc_email_v $plugins_v $lockspec_v $workday_minutes_v $config_v)"; $affected = $mdb2->exec($sql); if (!is_a($affected, 'PEAR_Error')) { @@ -800,7 +800,6 @@ class ttTeamHelper { $tracking_mode_part = ''; $task_required_part = ' , task_required = '.(int) $fields['task_required']; $record_type_part = ''; - $uncompleted_indicators_part = ''; $bcc_email_part = ''; $plugins_part = ''; $config_part = ''; @@ -815,7 +814,6 @@ class ttTeamHelper { if (isset($fields['week_start'])) $week_start_part = ', week_start = '.(int) $fields['week_start']; if (isset($fields['tracking_mode'])) $tracking_mode_part = ', tracking_mode = '.(int) $fields['tracking_mode']; if (isset($fields['record_type'])) $record_type_part = ', record_type = '.(int) $fields['record_type']; - if (isset($fields['uncompleted_indicators'])) $uncompleted_indicators_part = ', uncompleted_indicators = '.(int) $fields['uncompleted_indicators']; if (isset($fields['bcc_email'])) $bcc_email_part = ', bcc_email = '.$mdb2->quote($fields['bcc_email']); if (isset($fields['plugins'])) $plugins_part = ', plugins = '.$mdb2->quote($fields['plugins']); if (isset($fields['config'])) $config_part = ', config = '.$mdb2->quote($fields['config']); @@ -824,7 +822,7 @@ class ttTeamHelper { $sql = "update tt_teams set $name_part $currency_part $lang_part $decimal_mark_part $date_format_part $time_format_part $week_start_part $tracking_mode_part $task_required_part $record_type_part - $uncompleted_indicators_part $bcc_email_part $plugins_part $config_part $lock_spec_part $workday_minutes_part where id = $team_id"; + $bcc_email_part $plugins_part $config_part $lock_spec_part $workday_minutes_part where id = $team_id"; $affected = $mdb2->exec($sql); if (is_a($affected, 'PEAR_Error')) return false; diff --git a/WEB-INF/lib/ttUser.class.php b/WEB-INF/lib/ttUser.class.php index f2fa1cba..f64a76c0 100644 --- a/WEB-INF/lib/ttUser.class.php +++ b/WEB-INF/lib/ttUser.class.php @@ -69,7 +69,7 @@ class ttUser { $sql = "SELECT u.id, u.login, u.name, u.team_id, u.role, u.client_id, u.email, t.name as team_name, t.currency, t.lang, t.decimal_mark, t.date_format, t.time_format, t.week_start, - t.tracking_mode, t.project_required, t.task_required, t.record_type, t.uncompleted_indicators, + t.tracking_mode, t.project_required, t.task_required, t.record_type, t.bcc_email, t.plugins, t.config, t.lock_spec, t.workday_minutes, t.custom_logo FROM tt_users u LEFT JOIN tt_teams t ON (u.team_id = t.id) WHERE "; if ($id) @@ -101,7 +101,6 @@ class ttUser { $this->project_required = $val['project_required']; $this->task_required = $val['task_required']; $this->record_type = $val['record_type']; - // $this->uncompleted_indicators = $val['uncompleted_indicators']; // TODO: remove the field from query and drop the field. $this->bcc_email = $val['bcc_email']; $this->team = $val['team_name']; $this->currency = $val['currency']; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 3fd1c79f..12aac3e5 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- - - + +
 Anuko Time Tracker 1.17.18.3988 | Copyright © Anuko | +  Anuko Time Tracker 1.17.19.3989 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/mobile/users.tpl b/WEB-INF/templates/mobile/users.tpl index 956ee55a..5ca38fed 100644 --- a/WEB-INF/templates/mobile/users.tpl +++ b/WEB-INF/templates/mobile/users.tpl @@ -19,7 +19,7 @@ {foreach $active_users as $u}
- {if $smarty.const.UNCOMPLETED_INDICATORS == $user->uncompleted_indicators} + {if $user->uncompleted_indicators} {/if} {if $user->isManager()} diff --git a/WEB-INF/templates/users.tpl b/WEB-INF/templates/users.tpl index c84039d2..95ff2805 100644 --- a/WEB-INF/templates/users.tpl +++ b/WEB-INF/templates/users.tpl @@ -21,7 +21,7 @@ {foreach $active_users as $u}
- {if $smarty.const.UNCOMPLETED_INDICATORS == $user->uncompleted_indicators} + {if $user->uncompleted_indicators} {/if} {$u.name|escape} diff --git a/dbinstall.php b/dbinstall.php index dd360115..4d4de7e8 100755 --- a/dbinstall.php +++ b/dbinstall.php @@ -709,7 +709,7 @@ if ($_POST) { setChange("ALTER TABLE `tt_log` ADD `paid` tinyint(4) NULL default '0' AFTER `billable`"); } - if ($_POST["convert11400to11715"]) { + if ($_POST["convert11400to11719"]) { setChange("ALTER TABLE `tt_teams` DROP `address`"); setChange("ALTER TABLE `tt_fav_reports` ADD `report_spec` text default NULL AFTER `user_id`"); setChange("ALTER TABLE `tt_fav_reports` ADD `paid_status` tinyint(4) default NULL AFTER `invoice`"); @@ -724,6 +724,7 @@ if ($_POST) { setChange("ALTER TABLE `tt_teams` DROP `workday_hours`"); setChange("UPDATE `tt_monthly_quotas` SET `minutes` = 60 * `quota`"); setChange("ALTER TABLE `tt_monthly_quotas` DROP `quota`"); + setChange("ALTER TABLE `tt_teams` DROP `uncompleted_indicators`"); } if ($_POST["cleanup"]) { @@ -768,7 +769,7 @@ if ($_POST) {

DB Install

-
Create database structure (v1.17.15) + Create database structure (v1.17.19)
(applies only to new installations, do not execute when updating)
@@ -804,8 +805,8 @@ if ($_POST) {

Update database structure (v1.14 to v1.17.15)
Update database structure (v1.14 to v1.17.19)
diff --git a/mobile/users.php b/mobile/users.php index d565fc64..1eee6089 100644 --- a/mobile/users.php +++ b/mobile/users.php @@ -45,7 +45,7 @@ if($user->canManageTeam()) { } // Check if the team is set to show indicators for uncompleted time entries. -if (UNCOMPLETED_INDICATORS == $user->uncompleted_indicators) { +if ($user->uncompleted_indicators) { // Check each active user if they have an uncompleted time entry. foreach ($active_users as $key => $user) { $active_users[$key]['has_uncompleted_entry'] = (bool) ttTimeHelper::getUncompleted($user['id']); diff --git a/mysql.sql b/mysql.sql index d7711260..a09c3f4a 100644 --- a/mysql.sql +++ b/mysql.sql @@ -26,12 +26,10 @@ CREATE TABLE `tt_teams` ( `project_required` smallint(2) NOT NULL DEFAULT '0', # whether a project selection is required or optional `task_required` smallint(2) NOT NULL DEFAULT '0', # whether a task selection is required or optional `record_type` smallint(2) NOT NULL DEFAULT '0', # time record type ("start and finish", "duration", or both) - `uncompleted_indicators` smallint(2) NOT NULL DEFAULT '0', # whether to show indicators for users with uncompleted time entries `bcc_email` varchar(100) default NULL, # bcc email to copy all reports to `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". - `workday_hours` decimal(5,2) DEFAULT '8.00', # number of work hours in a regular day `workday_minutes` smallint(4) DEFAULT '480', # number of work minutes in a regular working day `custom_logo` tinyint(4) default '0', # whether to use a custom logo or not `config` text default NULL, # miscellaneous team configuration settings diff --git a/users.php b/users.php index da570401..354ea1d6 100644 --- a/users.php +++ b/users.php @@ -45,7 +45,7 @@ if($user->canManageTeam()) { } // Check if the team is set to show indicators for uncompleted time entries. -if (UNCOMPLETED_INDICATORS == $user->uncompleted_indicators) { +if ($user->uncompleted_indicators) { // Check each active user if they have an uncompleted time entry. foreach ($active_users as $key => $user) { $active_users[$key]['has_uncompleted_entry'] = (bool) ttTimeHelper::getUncompleted($user['id']);