Added import of templates.
authorNik Okuntseff <support@anuko.com>
Sat, 9 Mar 2019 21:57:43 +0000 (21:57 +0000)
committerNik Okuntseff <support@anuko.com>
Sat, 9 Mar 2019 21:57:43 +0000 (21:57 +0000)
WEB-INF/lib/ttOrgImportHelper.class.php
WEB-INF/templates/footer.tpl

index c29c01c..2a54473 100644 (file)
@@ -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;
index 10c67ac..a6bbd63 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.56.4854 | 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.56.4855 | 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>