Work in progress integrating IP audit info in reports.
authorNik Okuntseff <support@anuko.com>
Sun, 18 Mar 2018 23:22:20 +0000 (23:22 +0000)
committerNik Okuntseff <support@anuko.com>
Sun, 18 Mar 2018 23:22:20 +0000 (23:22 +0000)
WEB-INF/lib/common.lib.php
WEB-INF/lib/ttReportHelper.class.php
WEB-INF/resources/en.lang.php
WEB-INF/templates/footer.tpl
WEB-INF/templates/report.tpl
WEB-INF/templates/reports.tpl
reports.php

index 3dce388..7086fe2 100644 (file)
@@ -341,6 +341,7 @@ function ttAccessAllowed($required_right)
 
   // Check if user has the right.
   if (in_array($required_right, $user->rights)) {
+    import('ttUserHelper');
     ttUserHelper::updateLastAccess();
     return true;
   }
index f2ae620..b5208bc 100644 (file)
@@ -291,6 +291,13 @@ class ttReportHelper {
     // Add paid status.
     if ($canViewReports && $bean->getAttribute('chpaid'))
       array_push($fields, 'l.paid as paid');
+    // Add IP address.
+    if ($canViewReports && $bean->getAttribute('chip')) {
+      array_push($fields, 'l.created as created');
+      array_push($fields, 'l.created_ip as created_ip');
+      array_push($fields, 'l.modified as modified');
+      array_push($fields, 'l.modified_ip as modified_ip');
+    }
 
     // Add invoice name if it is selected.
     if (($canViewReports || $isClient) && $bean->getAttribute('chinvoice'))
@@ -361,6 +368,14 @@ class ttReportHelper {
       // Add paid status.
       if ($canViewReports && $bean->getAttribute('chpaid'))
         array_push($fields, 'ei.paid as paid');
+      // Add IP address. NULL for now for expenses.
+      if ($canViewReports && $bean->getAttribute('chip')) {
+        array_push($fields, 'null as created');
+        array_push($fields, 'null as created_ip');
+        array_push($fields, 'null as modified');
+        array_push($fields, 'null as modified_ip');
+      }
+
       // Add invoice name if it is selected.
       if (($canViewReports || $isClient) && $bean->getAttribute('chinvoice'))
         array_push($fields, 'i.name as invoice');
index 9afe723..0123f02 100644 (file)
@@ -154,6 +154,7 @@ $i18n_key_words = array(
 'label.notes' => 'Notes',
 'label.item' => 'Item',
 'label.cost' => 'Cost',
+'label.ip' => 'IP',
 'label.day_total' => 'Day total',
 'label.week_total' => 'Week total',
 'label.month_total' => 'Month total',
index 6443793..e504b57 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.17.57.4105 | Copyright &copy; <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+          <td align="center">&nbsp;Anuko Time Tracker 1.17.58.4106 | 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 f99a3fb..a0eedaf 100644 (file)
@@ -47,6 +47,7 @@
   {if $bean->getAttribute('chnote')}<td class="tableHeader">{$i18n.label.note}</td>{/if}
   {if $bean->getAttribute('chcost')}<td class="tableHeaderCentered" width="5%">{$i18n.label.cost}</td>{/if}
   {if $bean->getAttribute('chpaid')}<td class="tableHeader">{$i18n.label.paid}</td>{/if}
+  {if $bean->getAttribute('chip')}<td class="tableHeader">{$i18n.label.ip}</td>{/if}
   {if $bean->getAttribute('chinvoice')}<td class="tableHeader">{$i18n.label.invoice}</td>{/if}
       </tr>
   {foreach $report_items as $item}
@@ -68,6 +69,7 @@
         {if $bean->getAttribute('chnote')}<td></td>{/if}
         {if $bean->getAttribute('chcost')}<td class="cellRightAlignedSubtotal">{if $user->canManageTeam() || $user->isClient()}{$subtotals[$prev_grouped_by]['cost']}{else}{$subtotals[$prev_grouped_by]['expenses']}{/if}</td>{/if}
         {if $bean->getAttribute('chpaid')}<td></td>{/if}
+        {if $bean->getAttribute('chip')}<td></td>{/if}
         {if $bean->getAttribute('chinvoice')}<td></td>{/if}
         {if $use_checkboxes}<td></td>{/if}
       </tr>
@@ -92,6 +94,7 @@
     {if $bean->getAttribute('chnote')}<td class="cellLeftAligned">{$item.note|escape}</td>{/if}
     {if $bean->getAttribute('chcost')}<td class="cellRightAligned">{if $user->canManageTeam() || $user->isClient()}{$item.cost}{else}{$item.expense}{/if}</td>{/if}
     {if $bean->getAttribute('chpaid')}<td class="cellRightAligned">{if $item.paid == 1}{$i18n.label.yes}{else}{$i18n.label.no}{/if}{/if}
+    {if $bean->getAttribute('chip')}<td class="cellRightAligned">{if $item.modified}{$item.modified_ip} {$item.modified}{else}{$item.created_ip} {$item.created}{/if}{/if}
     {if $bean->getAttribute('chinvoice')}<td class="cellRightAligned">{$item.invoice|escape}</td>{/if}
     {if $use_checkboxes}
       {if 1 == $item.type}<td bgcolor="white"><input type="checkbox" name="log_id_{$item.id}"></td>{/if}
     {if $bean->getAttribute('chnote')}<td></td>{/if}
     {if $bean->getAttribute('chcost')}<td class="cellRightAlignedSubtotal">{if $user->canManageTeam() || $user->isClient()}{$subtotals[$cur_grouped_by]['cost']}{else}{$subtotals[$cur_grouped_by]['expenses']}{/if}</td>{/if}
     {if $bean->getAttribute('chpaid')}<td></td>{/if}
+    {if $bean->getAttribute('chip')}<td></td>{/if}
     {if $bean->getAttribute('chinvoice')}<td></td>{/if}
     {if $use_checkboxes}<td></td>{/if}
       </tr>
     {if $bean->getAttribute('chnote')}<td></td>{/if}
     {if $bean->getAttribute('chcost')}<td nowrap class="cellRightAlignedSubtotal">{$user->currency|escape} {if $user->canManageTeam() || $user->isClient()}{$totals['cost']}{else}{$totals['expenses']}{/if}</td>{/if}
     {if $bean->getAttribute('chpaid')}<td></td>{/if}
+    {if $bean->getAttribute('chip')}<td></td>{/if}
     {if $bean->getAttribute('chinvoice')}<td></td>{/if}
     {if $use_checkboxes}<td></td>{/if}
       </tr>
index 8e7daf0..7d0524e 100644 (file)
@@ -254,6 +254,9 @@ function handleCheckboxes() {
   {/if}
   {if ($user->canManageTeam() && $user->isPluginEnabled('ps'))}
                 <td width="25%"><label>{$forms.reportForm.chpaid.control}&nbsp;{$i18n.label.paid}</label></td>
+  {/if}
+  {if ($user->canManageTeam())}
+                <td width="25%"><label>{$forms.reportForm.chip.control}&nbsp;{$i18n.label.ip}</label></td>
   {/if}
               </tr>
 {/if}
index fe56001..f6655d7 100644 (file)
@@ -187,6 +187,10 @@ if ($user->isPluginEnabled('cl'))
   $form->addInput(array('type'=>'checkbox','name'=>'chclient'));
 if (($user->canManageTeam() || $user->isClient()) && $user->isPluginEnabled('iv'))
   $form->addInput(array('type'=>'checkbox','name'=>'chinvoice'));
+if ($user->canManageTeam() && $user->isPluginEnabled('ps'))
+  $form->addInput(array('type'=>'checkbox','name'=>'chpaid'));
+if ($user->canManageTeam())
+  $form->addInput(array('type'=>'checkbox','name'=>'chip'));
 if (MODE_PROJECTS == $user->tracking_mode || MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
   $form->addInput(array('type'=>'checkbox','name'=>'chproject'));
 if (MODE_PROJECTS_AND_TASKS == $user->tracking_mode)
@@ -201,8 +205,6 @@ $form->addInput(array('type'=>'checkbox','name'=>'chcost'));
 // If we have a custom field - add a checkbox for it.
 if ($custom_fields && $custom_fields->fields[0])
   $form->addInput(array('type'=>'checkbox','name'=>'chcf_1'));
-if ($user->canManageTeam() && $user->isPluginEnabled('ps'))
-  $form->addInput(array('type'=>'checkbox','name'=>'chpaid'));
 // Add group by control.
 $group_by_options['no_grouping'] = $i18n->getKey('form.reports.group_by_no');
 $group_by_options['date'] = $i18n->getKey('form.reports.group_by_date');
@@ -239,6 +241,8 @@ if ($request->isGet() && !$bean->isSaved()) {
   $form->setValueByElement('end_date', $period->getEndDate());
   $form->setValueByElement('chclient', '1');
   $form->setValueByElement('chinvoice', '0');
+  $form->setValueByElement('chpaid', '0');
+  $form->setValueByElement('chip', '0');
   $form->setValueByElement('chproject', '1');
   $form->setValueByElement('chstart', '1');
   $form->setValueByElement('chduration', '1');
@@ -247,7 +251,6 @@ if ($request->isGet() && !$bean->isSaved()) {
   $form->setValueByElement('chfinish', '1');
   $form->setValueByElement('chnote', '1');
   $form->setValueByElement('chcf_1', '0');
-  $form->setValueByElement('chpaid', '0');
   $form->setValueByElement('chtotalsonly', '0');
 }