Added user config params to export.
authorNik Okuntseff <support@anuko.com>
Mon, 19 Nov 2018 20:46:11 +0000 (20:46 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 19 Nov 2018 20:46:11 +0000 (20:46 +0000)
WEB-INF/lib/ttGroupExportHelper.class.php
WEB-INF/templates/footer.tpl

index cf64ced..c6e1d9a 100644 (file)
@@ -72,7 +72,7 @@ class ttGroupExportHelper {
   }
 
   // getGroupData obtains group attributes for export.
-  function getGroupData() {
+  private function getGroupData() {
     global $user;
     $mdb2 = getConnection();
 
@@ -86,7 +86,7 @@ class ttGroupExportHelper {
   }
 
   // The getUsers obtains all users in group for the purpose of export.
-  function getUsers() {
+  private function getUsers() {
     global $user;
     $mdb2 = getConnection();
 
@@ -232,6 +232,24 @@ class ttGroupExportHelper {
     return false;
   }
 
+  // getRecordsFromTable - obtains all fields from a given table for a group.
+  function getRecordsFromTable($table_name) {
+    global $user;
+    $mdb2 = getConnection();
+
+    $result = array();
+    $sql = "select * from $table_name where group_id = $this->group_id and org_id = $user->org_id";
+    $res = $mdb2->query($sql);
+    $result = array();
+    if (!is_a($res, 'PEAR_Error')) {
+      while ($val = $res->fetchRow()) {
+        $result[] = $val;
+      }
+      return $result;
+    }
+    return false;
+  }
+
   // writeData writes group data into file.
   function writeData() {
 
@@ -626,6 +644,20 @@ class ttGroupExportHelper {
     unset($notifications);
     unset($notification_part);
 
+    // Write user config parameters.
+    $user_params = $this->getRecordsFromTable('tt_config');
+    fwrite($this->file, $this->indentation."  <user_params>\n");
+    foreach ($user_params as $user_param) {
+      $user_param_part = $this->indentation.'    '."<user_param user_id=\"".$this->userMap[$user_param['user_id']]."\"";
+      $user_param_part .= " param_name=\"".htmlspecialchars($user_param['param_name'])."\"";
+      $user_param_part .= " param_value=\"".htmlspecialchars($user_param['param_value'])."\"";
+      $user_param_part .= "></user_param>\n";
+      fwrite($this->file, $user_param_part);
+    }
+    fwrite($this->file, $this->indentation."  </user_params>\n");
+    unset($user_params);
+    unset($user_param_part);
+
     // We are mostly done with writing this group data, destroy all maps.
     unset($this->roleMap);
     unset($this->userMap);
index 92095cf..23cc0ed 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.4465 | 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.4466 | 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>