Ongoing refactoring on decoupling import.
authorNik Okuntseff <support@anuko.com>
Fri, 30 Nov 2018 14:51:33 +0000 (14:51 +0000)
committerNik Okuntseff <support@anuko.com>
Fri, 30 Nov 2018 14:51:33 +0000 (14:51 +0000)
WEB-INF/lib/ttOrgImportHelper.class.php
WEB-INF/templates/footer.tpl

index 328eabe..060a7c1 100644 (file)
 // +----------------------------------------------------------------------+
 
 import('ttUserHelper');
-import('ttRoleHelper');
 import('ttTaskHelper');
-import('ttClientHelper');
 import('ttInvoiceHelper');
-import('ttTimeHelper');
-import('ttExpenseHelper');
-import('ttFavReportHelper');
 
 // ttOrgImportHelper class is used to import organization data from an XML file
 // prepared by ttOrgExportHelper and consisting of nested groups with their info.
@@ -63,7 +58,7 @@ class ttOrgImportHelper {
   // Constructor.
   function __construct(&$errors) {
     $this->errors = &$errors;
-    $this->top_role_id = ttRoleHelper::getRoleByRank(512, 0);
+    $this->top_role_id = $this->getTopRole();
   }
 
   // startElement - callback handler for opening tags in XML.
@@ -981,4 +976,20 @@ class ttOrgImportHelper {
     $affected = $mdb2->exec($sql);
     return (!is_a($affected, 'PEAR_Error'));
   }
+
+  // getTopRole returns top role id.
+  private function getTopRole() {
+    global $user;
+    $mdb2 = getConnection();
+
+    $sql = "select id from tt_roles where group_id = 0 and rank = ".MAX_RANK." and status = 1";
+    $res = $mdb2->query($sql);
+
+    if (!is_a($res, 'PEAR_Error')) {
+      $val = $res->fetchRow();
+      if ($val['id'])
+        return $val['id'];
+    }
+    return false;
+  }
 }
index 0b4dd2b..f0d3ff5 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.28.4546 | 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.28.4547 | 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>