A bit of refactoring.
authorNik Okuntseff <support@anuko.com>
Mon, 22 Apr 2019 17:45:08 +0000 (17:45 +0000)
committerNik Okuntseff <support@anuko.com>
Mon, 22 Apr 2019 17:45:08 +0000 (17:45 +0000)
WEB-INF/lib/ttTimeHelper.class.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/week.tpl
mobile/time.php
mobile/timer.php
time.php
week.php

index 44d9678..0d5863e 100644 (file)
@@ -807,11 +807,12 @@ class ttTimeHelper {
   }
 
   // getRecords - returns time records for a user for a given date.
-  static function getRecords($user_id, $date) {
+  static function getRecords($date) {
     // TODO: merge getRecords and getRecordsWithFiles into one function.
     global $user;
     $mdb2 = getConnection();
 
+    $user_id = $user->getUser();
     $group_id = $user->getGroup();
     $org_id = $user->org_id;
 
@@ -869,10 +870,11 @@ class ttTimeHelper {
   // getRecordsWithFiles - returns time records for a user for a given date
   // with information whether they have attached files (has_files property).
   // A separate fiunction from getRecords because sql here is more complex.
-  static function getRecordsWithFiles($user_id, $date) {
+  static function getRecordsWithFiles($date) {
     global $user;
     $mdb2 = getConnection();
 
+    $user_id = $user->getUser();
     $group_id = $user->getGroup();
     $org_id = $user->org_id;
 
index 6e00cf3..62a5cf4 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.19.1.4969 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.19.1.4970 | 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>
index 6fc08b8..33a218a 100644 (file)
@@ -117,6 +117,9 @@ function fillDropdowns() {
   {/if}
         <td width="5%" class="tableHeader">{$i18n.label.duration}</td>
         <td class="tableHeader">{$i18n.label.note}</td>
+  {if $show_files}
+        <td></td>
+  {/if}
         <td></td>
         <td></td>
       </tr>
@@ -138,6 +141,13 @@ function fillDropdowns() {
     {/if}
         <td align="right" valign="top">{if ($record.duration == '0:00' && $record.start <> '')}<font color="#ff0000">{$i18n.form.time.uncompleted}</font>{else}{$record.duration}{/if}</td>
         <td valign="top">{if $record.comment}{$record.comment|escape}{else}&nbsp;{/if}</td>
+    {if $show_files}
+      {if $record.has_files}
+        <td valign="top" align="center"><a href="time_files.php?id={$record.id}"><img class="table_icon" alt="{$i18n.label.files}" src="images/icon_files.png"></a></td>
+      {else}
+        <td valign="top" align="center"><a href="time_files.php?id={$record.id}"><img class="table_icon" alt="{$i18n.label.files}" src="images/icon_file.png"></a></td>
+      {/if}
+    {/if}
         <td valign="top" align="center">
     {if $record.approved || $record.timesheet_id || $record.invoice_id}
           &nbsp;
index 15069db..30c7a40 100644 (file)
@@ -347,7 +347,7 @@ if ($request->isPost()) {
 
 $smarty->assign('next_date', $next_date);
 $smarty->assign('prev_date', $prev_date);
-$smarty->assign('time_records', ttTimeHelper::getRecords($user_id, $cl_date));
+$smarty->assign('time_records', ttTimeHelper::getRecords($cl_date));
 $smarty->assign('day_total', ttTimeHelper::getTimeForDay($cl_date));
 $smarty->assign('client_list', $client_list);
 $smarty->assign('project_list', $project_list);
index d3a0d0f..a8f708a 100644 (file)
@@ -290,7 +290,7 @@ $smarty->assign('uncompleted', $uncompleted);
 
 
 
-$smarty->assign('time_records', ttTimeHelper::getRecords($user->getUser(), $cl_date));
+$smarty->assign('time_records', ttTimeHelper::getRecords($cl_date));
 $smarty->assign('day_total', ttTimeHelper::getTimeForDay($cl_date));
 $smarty->assign('client_list', $client_list);
 $smarty->assign('project_list', $project_list);
index f6c8475..2a2c616 100644 (file)
--- a/time.php
+++ b/time.php
@@ -442,7 +442,7 @@ if ($request->isPost()) {
 } // isPost
 
 $week_total = ttTimeHelper::getTimeForWeek($selected_date);
-$timeRecords = $showFiles? ttTimeHelper::getRecordsWithFiles($user_id, $cl_date) : ttTimeHelper::getRecords($user_id, $cl_date);
+$timeRecords = $showFiles? ttTimeHelper::getRecordsWithFiles($cl_date) : ttTimeHelper::getRecords($cl_date);
 
 $smarty->assign('selected_date', $selected_date);
 $smarty->assign('week_total', $week_total);
index f18817d..b4a9176 100644 (file)
--- a/week.php
+++ b/week.php
@@ -507,6 +507,9 @@ $smarty->assign('onload', 'onLoad="fillDropdowns()"');
 $smarty->assign('timestring', $startDate->toString($user->date_format).' - '.$endDate->toString($user->date_format));
 $smarty->assign('time_records', $records);
 
+//$showFiles = $user->isPluginEnabled('at');
+//$smarty->assign('show_files', $showFiles);
+
 $smarty->assign('title', $i18n->get('title.time'));
 $smarty->assign('content_page_name', 'week.tpl');
 $smarty->display('index.tpl');