From: Nik Okuntseff Date: Sun, 18 Mar 2018 23:22:20 +0000 (+0000) Subject: Work in progress integrating IP audit info in reports. X-Git-Tag: timetracker_1.19-1~1006 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f0e54f23029d8b109c0ab554ab2b49195d204391;p=timetracker.git Work in progress integrating IP audit info in reports. --- diff --git a/WEB-INF/lib/common.lib.php b/WEB-INF/lib/common.lib.php index 3dce388f..7086fe29 100644 --- a/WEB-INF/lib/common.lib.php +++ b/WEB-INF/lib/common.lib.php @@ -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; } diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index f2ae6202..b5208bc7 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -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'); diff --git a/WEB-INF/resources/en.lang.php b/WEB-INF/resources/en.lang.php index 9afe7233..0123f02a 100644 --- a/WEB-INF/resources/en.lang.php +++ b/WEB-INF/resources/en.lang.php @@ -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', diff --git a/WEB-INF/templates/footer.tpl b/WEB-INF/templates/footer.tpl index 64437933..e504b572 100644 --- a/WEB-INF/templates/footer.tpl +++ b/WEB-INF/templates/footer.tpl @@ -12,7 +12,7 @@
- {/if} {if $bean->getAttribute('chcost')}{/if} {if $bean->getAttribute('chpaid')}{/if} + {if $bean->getAttribute('chip')}{/if} {if $bean->getAttribute('chinvoice')}{/if} {foreach $report_items as $item} @@ -68,6 +69,7 @@ {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} {if $bean->getAttribute('chpaid')}{/if} + {if $bean->getAttribute('chip')}{/if} {if $bean->getAttribute('chinvoice')}{/if} {if $use_checkboxes}{/if} @@ -92,6 +94,7 @@ {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} {if $bean->getAttribute('chpaid')}{/if} {if $use_checkboxes} {if 1 == $item.type}{/if} @@ -116,6 +119,7 @@ {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} {if $bean->getAttribute('chpaid')}{/if} + {if $bean->getAttribute('chip')}{/if} {if $bean->getAttribute('chinvoice')}{/if} {if $use_checkboxes}{/if} @@ -135,6 +139,7 @@ {if $bean->getAttribute('chnote')}{/if} {if $bean->getAttribute('chcost')}{/if} {if $bean->getAttribute('chpaid')}{/if} + {if $bean->getAttribute('chip')}{/if} {if $bean->getAttribute('chinvoice')}{/if} {if $use_checkboxes}{/if} diff --git a/WEB-INF/templates/reports.tpl b/WEB-INF/templates/reports.tpl index 8e7daf09..7d0524e1 100644 --- a/WEB-INF/templates/reports.tpl +++ b/WEB-INF/templates/reports.tpl @@ -254,6 +254,9 @@ function handleCheckboxes() { {/if} {if ($user->canManageTeam() && $user->isPluginEnabled('ps'))} + {/if} + {if ($user->canManageTeam())} + {/if} {/if} diff --git a/reports.php b/reports.php index fe560016..f6655d70 100644 --- a/reports.php +++ b/reports.php @@ -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'); }
 Anuko Time Tracker 1.17.57.4105 | Copyright © Anuko | +  Anuko Time Tracker 1.17.58.4106 | Copyright © Anuko | {$i18n.footer.credits} | {$i18n.footer.license} | {$i18n.footer.improve} diff --git a/WEB-INF/templates/report.tpl b/WEB-INF/templates/report.tpl index f99a3fb9..a0eedaf0 100644 --- a/WEB-INF/templates/report.tpl +++ b/WEB-INF/templates/report.tpl @@ -47,6 +47,7 @@ {if $bean->getAttribute('chnote')}{$i18n.label.note}{$i18n.label.cost}{$i18n.label.paid}{$i18n.label.ip}{$i18n.label.invoice}
{if $user->canManageTeam() || $user->isClient()}{$subtotals[$prev_grouped_by]['cost']}{else}{$subtotals[$prev_grouped_by]['expenses']}{/if}
{$item.note|escape}{if $user->canManageTeam() || $user->isClient()}{$item.cost}{else}{$item.expense}{/if}{if $item.paid == 1}{$i18n.label.yes}{else}{$i18n.label.no}{/if}{/if} + {if $bean->getAttribute('chip')}{if $item.modified}{$item.modified_ip} {$item.modified}{else}{$item.created_ip} {$item.created}{/if}{/if} {if $bean->getAttribute('chinvoice')}{$item.invoice|escape}{if $user->canManageTeam() || $user->isClient()}{$subtotals[$cur_grouped_by]['cost']}{else}{$subtotals[$cur_grouped_by]['expenses']}{/if}
{$user->currency|escape} {if $user->canManageTeam() || $user->isClient()}{$totals['cost']}{else}{$totals['expenses']}{/if}