From 8fce71f594124d3d6e91d8a3ef25209a7ca180fa Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Fri, 1 Apr 2016 18:23:40 +0000 Subject: [PATCH] Fixed export and import for locking specification. --- WEB-INF/lib/ttExportHelper.class.php | 6 +++--- WEB-INF/lib/ttImportHelper.class.php | 1 + WEB-INF/lib/ttTeamHelper.class.php | 17 +++++++++++++---- WEB-INF/templates/footer.tpl | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/WEB-INF/lib/ttExportHelper.class.php b/WEB-INF/lib/ttExportHelper.class.php index d641f3f5..634987a4 100644 --- a/WEB-INF/lib/ttExportHelper.class.php +++ b/WEB-INF/lib/ttExportHelper.class.php @@ -46,10 +46,10 @@ class ttExportHelper { // createDataFile creates a file with all data for a given team. function createDataFile($compress = false) { - global $user; + global $user; // Create a temporary file. - $dirName = dirname(TEMPLATE_DIR . '_c/.'); + $dirName = dirname(TEMPLATE_DIR . '_c/.'); $tmp_file = tempnam($dirName, 'tt'); // Open the file for writing. @@ -61,7 +61,7 @@ class ttExportHelper { fwrite($file, "\n"); // Write team info. - fwrite($file, "currency."\" lock_interval=\"".$user->lock_interval."\" lang=\"".$user->lang."\" decimal_mark=\"".$user->decimal_mark."\" date_format=\"".$user->date_format."\" time_format=\"".$user->time_format."\" week_start=\"".$user->week_start. + fwrite($file, "currency."\" lock_spec=\"".$user->lock_spec."\" lock_interval=\"".$user->lock_interval."\" lang=\"".$user->lang."\" decimal_mark=\"".$user->decimal_mark."\" date_format=\"".$user->date_format."\" time_format=\"".$user->time_format."\" week_start=\"".$user->week_start. "\" plugins=\"".$user->plugins."\" tracking_mode=\"".$user->tracking_mode."\" record_type=\"".$user->record_type."\">\n"); fwrite($file, " team."]]>\n"); fwrite($file, "
address."]]>
\n"); diff --git a/WEB-INF/lib/ttImportHelper.class.php b/WEB-INF/lib/ttImportHelper.class.php index 91d6b394..806dfdbf 100644 --- a/WEB-INF/lib/ttImportHelper.class.php +++ b/WEB-INF/lib/ttImportHelper.class.php @@ -117,6 +117,7 @@ class ttImportHelper { 'name' => $this->teamData['NAME'], 'address' => $this->teamData['ADDRESS'], 'currency' => $this->teamData['CURRENCY'], + 'lock_spec' => $this->teamData['LOCK_SPEC'], 'lock_interval' => $this->teamData['LOCK_INTERVAL'], 'lang' => $this->teamData['LANG'], 'decimal_mark' => $this->teamData['DECIMAL_MARK'], diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 8cc9660b..5b25174b 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -602,6 +602,15 @@ class ttTeamHelper { $mdb2 = getConnection(); + $lock_spec = $fields['lock_spec']; + if ($lock_spec !== null) { + $lockspec_f = ', lock_spec'; + $lockspec_v = ', ' . $mdb2->quote($lock_spec); + } else { + $lockspec_f = ''; + $lockspec_v = ''; + } + if ($fields['lock_interval'] !== null) { $locktime_f = ', locktime'; $locktime_v = ", " . (int)$fields['lock_interval']; @@ -615,11 +624,11 @@ class ttTeamHelper { global $i18n; $lang = $i18n->lang; } - + $decimal_mark = $fields['decimal_mark']; if ($decimal_mark !== null) { $decimal_mark_f = ', decimal_mark'; - $decimal_mark_v = ', ' . $mdb2->quote($decimal_mark); + $decimal_mark_v = ', ' . $mdb2->quote($decimal_mark); } else { $decimal_mark_f = ''; $decimal_mark_v = ''; @@ -688,11 +697,11 @@ class ttTeamHelper { $record_type_v = ''; } - $sql = "insert into tt_teams (name, address, currency $locktime_f, lang $decimal_mark_f $date_format_f $time_format_f $week_start_f $plugins_f $tracking_mode_f $record_type_f) + $sql = "insert into tt_teams (name, address, currency $lockspec_f $locktime_f, lang $decimal_mark_f $date_format_f $time_format_f $week_start_f $plugins_f $tracking_mode_f $record_type_f) values(". $mdb2->quote(trim($fields['name'])). ", ".$mdb2->quote(trim($fields['address'])). - ", ".$mdb2->quote(trim($fields['currency']))." $locktime_v, ".$mdb2->quote($lang). + ", ".$mdb2->quote(trim($fields['currency']))." $lockspec_v $locktime_v, ".$mdb2->quote($lang). "$decimal_mark_v $date_format_v $time_format_v $week_start_v $plugins_v $tracking_mode_v $record_type_v)"; $affected = $mdb2->exec($sql); diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 4075ce32..408ffcfd 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.9.22.3469 | Copyright © Anuko | +  Anuko Time Tracker 1.9.22.3470 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1