From 6ede4ba89cf66620bd1c40d092b3518fd51ba69c Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 11 Nov 2018 13:58:21 +0000 Subject: [PATCH] Integrated custom field log in new export-import. --- WEB-INF/lib/ttGroupExportHelper.class.php | 15 +++++++++++++++ WEB-INF/lib/ttOrgImportHelper.class.php | 14 ++++++++++++++ WEB-INF/templates/footer.tpl | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/WEB-INF/lib/ttGroupExportHelper.class.php b/WEB-INF/lib/ttGroupExportHelper.class.php index f1ea228d..aba161f6 100644 --- a/WEB-INF/lib/ttGroupExportHelper.class.php +++ b/WEB-INF/lib/ttGroupExportHelper.class.php @@ -411,6 +411,21 @@ class ttGroupExportHelper { fwrite($this->file, $this->indentation." \n"); unset($custom_field_options); + // Write custom field log. + $custom_field_log = ttTeamHelper::getCustomFieldLog($this->group_id); + fwrite($this->file, $this->indentation." \n"); + foreach ($custom_field_log as $entry) { + $custom_field_log_part = $this->indentation.' '."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 .= ">\n"; + fwrite($this->file, $custom_field_log_part); + } + fwrite($this->file, $this->indentation." \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.' '); diff --git a/WEB-INF/lib/ttOrgImportHelper.class.php b/WEB-INF/lib/ttOrgImportHelper.class.php index 9c39810f..17827986 100644 --- a/WEB-INF/lib/ttOrgImportHelper.class.php +++ b/WEB-INF/lib/ttOrgImportHelper.class.php @@ -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 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')); + } + } } } diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index bd9cdf51..b8cedad7 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.12.4413 | Copyright © Anuko | +  Anuko Time Tracker 1.18.12.4414 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} -- 2.20.1