Integrated custom field log in new export-import.
authorNik Okuntseff <support@anuko.com>
Sun, 11 Nov 2018 13:58:21 +0000 (13:58 +0000)
committerNik Okuntseff <support@anuko.com>
Sun, 11 Nov 2018 13:58:21 +0000 (13:58 +0000)
WEB-INF/lib/ttGroupExportHelper.class.php
WEB-INF/lib/ttOrgImportHelper.class.php
WEB-INF/templates/footer.tpl

index f1ea228..aba161f 100644 (file)
@@ -411,6 +411,21 @@ class ttGroupExportHelper {
     fwrite($this->file, $this->indentation."  </custom_field_options>\n");
     unset($custom_field_options);
 
+    // Write custom field log.
+    $custom_field_log = ttTeamHelper::getCustomFieldLog($this->group_id);
+    fwrite($this->file, $this->indentation."  <custom_field_log>\n");
+    foreach ($custom_field_log as $entry) {
+      $custom_field_log_part = $this->indentation.'    '."<custom_field_log_entry log_id=\"".$this->logMap[$entry['log_id']]."\"";
+      $custom_field_log_part .= " field_id=\"".$this->customFieldMap[$entry['field_id']]."\"";
+      $custom_field_log_part .= " option_id=\"".$this->customFieldOptionMap[$entry['option_id']]."\"";
+      $custom_field_log_part .= " value=\"".htmlentities($entry['value'])."\"";
+      $custom_field_log_part .= " status=\"".$entry['status']."\"";
+      $custom_field_log_part .= "></custom_field_log_entry>\n";
+      fwrite($this->file, $custom_field_log_part);
+    }
+    fwrite($this->file, $this->indentation."  </custom_field_log>\n");
+    unset($custom_field_log);
+
     // Call self recursively for all subgroups.
     foreach ($this->subgroups as $subgroup) {
       $subgroup_helper = new ttGroupExportHelper($subgroup['id'], $this->file, $this->indentation.'  ');
index 9c39810..1782798 100644 (file)
@@ -356,6 +356,20 @@ class ttOrgImportHelper {
           $this->currentGroupCustomFieldOptionMap[$attrs['ID']] = $custom_field_option_id;
         } else $this->errors->add($i18n->get('error.db'));
       }
+
+      if ($name == 'CUSTOM_FIELD_LOG_ENTRY') {
+        // We get here when processing <custom_field_log_entry> tags for the current group.
+        if (!ttCustomFieldHelper::insertLogEntry(array(
+          // 'group_id' => $this->current_group_id, TODO: add this when group_id field is added to the table.
+          // 'org_id' => $this->org_id, TODO: add this when org_id field is added to the table.
+          'log_id' => $this->currentGroupLogMap[$attrs['LOG_ID']],
+          'field_id' => $this->currentGroupCustomFieldMap[$attrs['FIELD_ID']],
+          'option_id' => $this->currentGroupCustomFieldOptionMap[$attrs['OPTION_ID']],
+          'value' => $attrs['VALUE'],
+          'status' => $attrs['STATUS']))) {
+          $this->errors->add($i18n->get('error.db'));
+        }
+      }
     }
   }
 
index bd9cdf5..b8cedad 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.18.12.4413 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.18.12.4414 | 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>