Added user config params to import.
authorNik Okuntseff <support@anuko.com>
Mon, 19 Nov 2018 21:01:53 +0000 (21:01 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 19 Nov 2018 21:01:53 +0000 (21:01 +0000)
WEB-INF/lib/ttOrgImportHelper.class.php
WEB-INF/templates/footer.tpl

index 9907f6e..dda7f75 100644 (file)
@@ -526,6 +526,18 @@ class ttOrgImportHelper {
         }
         return;
       }
+
+      if ($name == 'USER_PARAM') {
+        if (!$this->insertUserParam(array(
+          'group_id' => $this->current_group_id,
+          'org_id' => $this->org_id,
+          'user_id' => $this->currentGroupUserMap[$attrs['USER_ID']],
+          'param_name' => $attrs['PARAM_NAME'],
+          'param_value' => $attrs['PARAM_VALUE']))) {
+          $this->errors->add($i18n->get('error.db'));
+        }
+        return;
+      }
     }
   }
 
@@ -884,4 +896,21 @@ class ttOrgImportHelper {
     $affected = $mdb2->exec($sql);
     return (!is_a($affected, 'PEAR_Error'));
   }
+
+  // insertUserParam - a helper function to insert a user parameter.
+  private function insertUserParam($fields) {
+    $mdb2 = getConnection();
+
+    $group_id = (int) $fields['group_id'];
+    $org_id = (int) $fields['org_id'];
+    $user_id = (int) $fields['user_id'];
+    $param_name = $fields['param_name'];
+    $param_value = $fields['param_value'];
+
+    $sql = "insert into tt_config".
+      " (user_id, group_id, org_id, param_name, param_value)".
+      " values ($user_id, $group_id, $org_id, ".$mdb2->quote($param_name).", ".$mdb2->quote($param_value).")";
+    $affected = $mdb2->exec($sql);
+    return (!is_a($affected, 'PEAR_Error'));
+  }
 }
index 23cc0ed..c6c6ed7 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.22.4466 | 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.22.4467 | 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>