From: Nik Okuntseff Date: Sat, 9 Mar 2019 21:57:43 +0000 (+0000) Subject: Added import of templates. X-Git-Tag: timetracker_1.19-1~187 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=bb2dc72d5b08a2e04244a372ed58edc0384f1cdd;p=timetracker.git Added import of templates. --- diff --git a/WEB-INF/lib/ttOrgImportHelper.class.php b/WEB-INF/lib/ttOrgImportHelper.class.php index c29c01cc..2a544738 100644 --- a/WEB-INF/lib/ttOrgImportHelper.class.php +++ b/WEB-INF/lib/ttOrgImportHelper.class.php @@ -422,6 +422,19 @@ class ttOrgImportHelper { return; } + if ($name == 'TEMPLATE') { + if (!$this->insertTemplate(array( + 'group_id' => $this->current_group_id, + 'org_id' => $this->org_id, + 'name' => $attrs['NAME'], + 'description' => $attrs['DESCRIPTION'], + 'content' => $attrs['CONTENT'], + 'status' => $attrs['STATUS']))) { + $this->errors->add($i18n->get('error.db')); + } + return; + } + if ($name == 'MONTHLY_QUOTA') { if (!$this->insertMonthlyQuota(array( 'group_id' => $this->current_group_id, @@ -745,6 +758,23 @@ class ttOrgImportHelper { return (!is_a($affected, 'PEAR_Error')); } + // insertTemplate - a helper function to insert a template. + private function insertTemplate($fields) { + $mdb2 = getConnection(); + + $group_id = (int) $fields['group_id']; + $org_id = (int) $fields['org_id']; + $name = $mdb2->quote($fields['name']); + $description = $mdb2->quote($fields['description']); + $content = $mdb2->quote($fields['content']); + $status = $mdb2->quote($fields['status']); + + $sql = "INSERT INTO tt_templates (group_id, org_id, name, description, content, status)". + " values ($group_id, $org_id, $name, $description, $content, $status)"; + $affected = $mdb2->exec($sql); + return (!is_a($affected, 'PEAR_Error')); + } + // insertExpense - a helper function to insert an expense item. private function insertExpense($fields) { global $user; diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 10c67acd..a6bbd639 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
-
 Anuko Time Tracker 1.18.56.4854 | Copyright © Anuko | +  Anuko Time Tracker 1.18.56.4855 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve}