A little bit of refactoring in export-import.
authorNik Okuntseff <support@anuko.com>
Wed, 4 Apr 2018 13:26:42 +0000 (13:26 +0000)
committerNik Okuntseff <support@anuko.com>
Wed, 4 Apr 2018 13:26:42 +0000 (13:26 +0000)
WEB-INF/lib/ttExportHelper.class.php
WEB-INF/lib/ttImportHelper.class.php
WEB-INF/templates/footer.tpl
export.php

index 22521c7..c26937e 100644 (file)
@@ -62,7 +62,7 @@ class ttExportHelper {
     fwrite($file, "<pack>\n");
 
     // Write team info.
-    fwrite($file, "<team currency=\"".$user->currency."\" decimal_mark=\"".$user->decimal_mark."\" lang=\"".$user->lang.
+    fwrite($file, "<group currency=\"".$user->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."\" bcc_email=\"".$user->bcc_email.
@@ -70,7 +70,7 @@ class ttExportHelper {
       "\" config=\"".$user->config.
       "\">\n");
     fwrite($file, "  <name><![CDATA[".$user->team."]]></name>\n");
-    fwrite($file, "</team>\n");
+    fwrite($file, "</group>\n");
 
     // Prepare role map.
     $roles = $this->getRoles();
index ea54d0e..b7c024d 100644 (file)
@@ -38,7 +38,7 @@ import('ttFavReportHelper');
 import('ttExpenseHelper');
 import('ttRoleHelper');
 
-// ttImportHelper - this class is used to import team data from a file.
+// ttImportHelper - this class is used to import group data from a file.
 class ttImportHelper {
   var $errors         = null;    // Errors go here. Set in constructor by reference.
 
@@ -46,7 +46,7 @@ class ttImportHelper {
   var $currentTag     = '';      // XML tag of the current element.
 
   var $canImport      = true;    // False if we cannot import data due to a login collision.
-  var $teamData       = array(); // Array of team data such as team name, etc.
+  var $groupData      = array(); // Array of group data such as group name, etc.
   var $group_id       = null;    // New group id we are importing. It is created during the import operation.
   var $roles          = array(); // Array of arrays of role properties.
   var $users          = array(); // Array of arrays of user properties.
@@ -73,7 +73,7 @@ class ttImportHelper {
   // startElement - callback handler for opening tag of an XML element.
   // In this function we assign passed in attributes to currentElement.
   function startElement($parser, $name, $attrs) {
-    if ($name == 'TEAM'
+    if ($name == 'GROUP'
       || $name == 'USER'
       || $name == 'TASK'
       || $name == 'PROJECT'
@@ -98,10 +98,10 @@ class ttImportHelper {
   // When we are here, currentElement is an array of the element attributes (as set in startElement).
   // Here we do the actual import of data into the database.
   function endElement($parser, $name) {
-    if ($name == 'TEAM') {
-      $this->teamData = $this->currentElement;
-      // Now teamData is an array of team properties. We'll use it later to create a team.
-      // Cannot create the team here. Need to determine whether logins collide with existing logins.
+    if ($name == 'GROUP') {
+      $this->groupData = $this->currentElement;
+      // Now groupData is an array of group properties. We'll use it later to create a group.
+      // Cannot create the group here. Need to determine whether logins collide with existing logins.
       $this->currentElement = array();
     }
     if ($name == 'ROLE') {
@@ -121,26 +121,26 @@ class ttImportHelper {
         }
       }
 
-      // Now we can create a team.
+      // Now we can create a group.
       if ($this->canImport) {
         $this->top_role_id = ttRoleHelper::getRoleByRank(512, 0);
         $group_id = ttTeamHelper::insert(array(
-          'name' => $this->teamData['NAME'],
-          'currency' => $this->teamData['CURRENCY'],
-          'decimal_mark' => $this->teamData['DECIMAL_MARK'],
-          'lang' => $this->teamData['LANG'],
-          'date_format' => $this->teamData['DATE_FORMAT'],
-          'time_format' => $this->teamData['TIME_FORMAT'],
-          'week_start' => $this->teamData['WEEK_START'],
-          'tracking_mode' => $this->teamData['TRACKING_MODE'],
-          'project_required' => $this->teamData['PROJECT_REQUIRED'],
-          'task_required' => $this->teamData['TASK_REQUIRED'],
-          'record_type' => $this->teamData['RECORD_TYPE'],
-          'bcc_email' => $this->teamData['BCC_EMAIL'],
-          'plugins' => $this->teamData['PLUGINS'],
-          'lock_spec' => $this->teamData['LOCK_SPEC'],
-          'workday_minutes' => $this->teamData['WORKDAY_MINUTES'],
-          'config' => $this->teamData['CONFIG']));
+          'name' => $this->groupData['NAME'],
+          'currency' => $this->groupData['CURRENCY'],
+          'decimal_mark' => $this->groupData['DECIMAL_MARK'],
+          'lang' => $this->groupData['LANG'],
+          'date_format' => $this->groupData['DATE_FORMAT'],
+          'time_format' => $this->groupData['TIME_FORMAT'],
+          'week_start' => $this->groupData['WEEK_START'],
+          'tracking_mode' => $this->groupData['TRACKING_MODE'],
+          'project_required' => $this->groupData['PROJECT_REQUIRED'],
+          'task_required' => $this->groupData['TASK_REQUIRED'],
+          'record_type' => $this->groupData['RECORD_TYPE'],
+          'bcc_email' => $this->groupData['BCC_EMAIL'],
+          'plugins' => $this->groupData['PLUGINS'],
+          'lock_spec' => $this->groupData['LOCK_SPEC'],
+          'workday_minutes' => $this->groupData['WORKDAY_MINUTES'],
+          'config' => $this->groupData['CONFIG']));
         if ($group_id) {
           $this->group_id = $group_id;
 
index b377a9e..ce32bb1 100644 (file)
@@ -12,7 +12,7 @@
       <br>
       <table cellspacing="0" cellpadding="4" width="100%" border="0">
         <tr>
-          <td align="center">&nbsp;Anuko Time Tracker 1.17.86.4224 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.17.86.4225 | Copyright &copy; <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>
index 4f1a571..5f7bd02 100644 (file)
@@ -47,7 +47,7 @@ $form->addInput(array('type'=>'submit','name'=>'btn_submit','value'=>$i18n->get(
 
 if ($request->isPost()) {
 
-  $filename = 'team_data.xml';
+  $filename = 'group_data.xml';
   $mime_type = 'text/xml';
   $compress = false;
   if ('bzip' == $cl_compression) {