X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttReportHelper.class.php;h=b894b037d8978f59aba61667fb40cee861582a23;hb=5f64df1308fd641565631e6e38d282432f5e6250;hp=bd882559c098d1ea301c992f65f5dee680be529d;hpb=101cdfe54c97350fc65b140f3f27c5bdd466844e;p=timetracker.git diff --git a/WEB-INF/lib/ttReportHelper.class.php b/WEB-INF/lib/ttReportHelper.class.php index bd882559..b894b037 100644 --- a/WEB-INF/lib/ttReportHelper.class.php +++ b/WEB-INF/lib/ttReportHelper.class.php @@ -368,7 +368,7 @@ 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. + // Add IP address. if ($canViewReports && $bean->getAttribute('chip')) { array_push($fields, 'ei.created as created'); array_push($fields, 'ei.created_ip as created_ip'); @@ -553,6 +553,16 @@ class ttReportHelper { array_push($fields, "cast(l.billable * coalesce(upb.rate, 0) * time_to_sec(l.duration)/3600 as decimal(10,2)) as cost"); // Use project rate for user. array_push($fields, "null as expense"); } + // Add paid status. + if ($canViewReports && $report['show_paid']) + array_push($fields, 'l.paid as paid'); + // Add IP address. + if ($canViewReports && $report['show_ip']) { + 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) && $report['show_invoice']) array_push($fields, 'i.name as invoice'); @@ -619,6 +629,16 @@ class ttReportHelper { array_push($fields, 'ei.name as note'); array_push($fields, 'ei.cost as cost'); array_push($fields, 'ei.cost as expense'); + // Add paid status. + if ($canViewReports && $report['show_paid']) + array_push($fields, 'ei.paid as paid'); + // Add IP address. + if ($canViewReports && $report['show_ip']) { + array_push($fields, 'ei.created as created'); + array_push($fields, 'ei.created_ip as created_ip'); + array_push($fields, 'ei.modified as modified'); + array_push($fields, 'ei.modified_ip as modified_ip'); + } // Add invoice name if it is selected. if (($canViewReports || $isClient) && $report['show_invoice']) array_push($fields, 'i.name as invoice'); @@ -1168,7 +1188,7 @@ class ttReportHelper { $body .= ''; // Output title. - $body .= '

'.$i18n->getKey('form.mail.report_subject').': '.$totals['start_date'].' - '.$totals['end_date'].'

'; + $body .= '

'.$i18n->get('form.mail.report_subject').': '.$totals['start_date'].' - '.$totals['end_date'].'

'; // Output comment. if ($comment) $body .= '

'.htmlspecialchars($comment).'

'; @@ -1181,16 +1201,16 @@ class ttReportHelper { $group_by_header = htmlspecialchars($custom_fields->fields[0]['label']); else { $key = 'label.'.$group_by; - $group_by_header = $i18n->getKey($key); + $group_by_header = $i18n->get($key); } $body .= ''; $body .= ''; $body .= ''; if ($bean->getAttribute('chduration')) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chcost')) - $body .= ''; + $body .= ''; $body .= ''; foreach($subtotals as $subtotal) { $body .= ''; @@ -1211,7 +1231,7 @@ class ttReportHelper { // Print totals. $body .= ''; $body .= ''; - $body .= ''; + $body .= ''; if ($bean->getAttribute('chduration')) { $body .= '
'.$group_by_header.''.$i18n->getKey('label.duration').''.$i18n->get('label.duration').''.$i18n->getKey('label.cost').''.$i18n->get('label.cost').'
 
'.$i18n->getKey('label.total').''.$i18n->get('label.total').''; if ($totals['time'] <> '0:00') $body .= $totals['time']; @@ -1231,33 +1251,33 @@ class ttReportHelper { // Print table header. $body .= ''; $body .= ''; - $body .= ''; + $body .= ''; if ($canViewReports || $isClient) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chclient')) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chproject')) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chtask')) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chcf_1')) $body .= ''; if ($bean->getAttribute('chstart')) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chfinish')) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chduration')) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chnote')) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chcost')) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chpaid')) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chip')) - $body .= ''; + $body .= ''; if ($bean->getAttribute('chinvoice')) - $body .= ''; + $body .= ''; $body .= ''; // Initialize variables to print subtotals. @@ -1281,7 +1301,7 @@ class ttReportHelper { $cur_grouped_by = $record['grouped_by']; if ($cur_grouped_by != $prev_grouped_by && !$first_pass) { $body .= ''; - $body .= ''; + $body .= ''; $subtotal_name = htmlspecialchars($subtotals[$prev_grouped_by]['name']); if ($canViewReports || $isClient) $body .= ''; if ($bean->getAttribute('chclient')) $body .= ''; @@ -1333,7 +1353,7 @@ class ttReportHelper { $body .= ''; if ($bean->getAttribute('chpaid')) { $body .= ''; } if ($bean->getAttribute('chip')) { @@ -1354,7 +1374,7 @@ class ttReportHelper { // Print a terminating subtotal. if ($print_subtotals) { $body .= ''; - $body .= ''; + $body .= ''; $subtotal_name = htmlspecialchars($subtotals[$cur_grouped_by]['name']); if ($canViewReports || $isClient) $body .= ''; if ($bean->getAttribute('chclient')) $body .= ''; @@ -1379,7 +1399,7 @@ class ttReportHelper { // Print totals. $body .= ''; $body .= ''; - $body .= ''; + $body .= ''; if ($canViewReports || $isClient) $body .= ''; if ($bean->getAttribute('chclient')) $body .= ''; if ($bean->getAttribute('chproject')) $body .= ''; @@ -1404,7 +1424,7 @@ class ttReportHelper { // Output footer. if (!defined('REPORT_FOOTER') || !(REPORT_FOOTER == false)) - $body .= '

'.$i18n->getKey('form.mail.footer').'

'; + $body .= '

'.$i18n->get('form.mail.footer').'

'; // Finish creating email body. $body .= ''; @@ -1464,7 +1484,7 @@ class ttReportHelper { $body .= ''; // Output title. - $body .= '

'.$i18n->getKey('form.mail.report_subject').': '.$totals['start_date'].' - '.$totals['end_date'].'

'; + $body .= '

'.$i18n->get('form.mail.report_subject').': '.$totals['start_date'].' - '.$totals['end_date'].'

'; // Output comment. // if ($comment) $body .= '

'.htmlspecialchars($comment).'

'; // No comment for fav. reports. @@ -1477,16 +1497,16 @@ class ttReportHelper { $group_by_header = htmlspecialchars($custom_fields->fields[0]['label']); else { $key = 'label.'.$group_by; - $group_by_header = $i18n->getKey($key); + $group_by_header = $i18n->get($key); } $body .= '
'.$i18n->getKey('label.date').''.$i18n->get('label.date').''.$i18n->getKey('label.user').''.$i18n->get('label.user').''.$i18n->getKey('label.client').''.$i18n->get('label.client').''.$i18n->getKey('label.project').''.$i18n->get('label.project').''.$i18n->getKey('label.task').''.$i18n->get('label.task').''.htmlspecialchars($custom_fields->fields[0]['label']).''.$i18n->getKey('label.start').''.$i18n->get('label.start').''.$i18n->getKey('label.finish').''.$i18n->get('label.finish').''.$i18n->getKey('label.duration').''.$i18n->get('label.duration').''.$i18n->getKey('label.note').''.$i18n->get('label.note').''.$i18n->getKey('label.cost').''.$i18n->get('label.cost').''.$i18n->getKey('label.paid').''.$i18n->get('label.paid').''.$i18n->getKey('label.ip').''.$i18n->get('label.ip').''.$i18n->getKey('label.invoice').''.$i18n->get('label.invoice').'
'.$i18n->getKey('label.subtotal').''.$i18n->get('label.subtotal').''.($group_by == 'user' ? $subtotal_name : '').''.($group_by == 'client' ? $subtotal_name : '').''.$record['cost'].''; - $body .= $record['paid'] == 1 ? $i18n->getKey('label.yes') : $i18n->getKey('label.no'); + $body .= $record['paid'] == 1 ? $i18n->get('label.yes') : $i18n->get('label.no'); $body .= '
'.$i18n->getKey('label.subtotal').''.$i18n->get('label.subtotal').''.($group_by == 'user' ? $subtotal_name : '').''.($group_by == 'client' ? $subtotal_name : '').'
 
'.$i18n->getKey('label.total').''.$i18n->get('label.total').'
'; $body .= ''; $body .= ''; if ($report['show_duration']) - $body .= ''; + $body .= ''; if ($report['show_cost']) - $body .= ''; + $body .= ''; $body .= ''; foreach($subtotals as $subtotal) { $body .= ''; @@ -1507,7 +1527,7 @@ class ttReportHelper { // Print totals. $body .= ''; $body .= ''; - $body .= ''; + $body .= ''; if ($report['show_duration']) { $body .= '
'.$group_by_header.''.$i18n->getKey('label.duration').''.$i18n->get('label.duration').''.$i18n->getKey('label.cost').''.$i18n->get('label.cost').'
 
'.$i18n->getKey('label.total').''.$i18n->get('label.total').''; if ($totals['time'] <> '0:00') $body .= $totals['time']; @@ -1527,31 +1547,33 @@ class ttReportHelper { // Print table header. $body .= ''; $body .= ''; - $body .= ''; + $body .= ''; if ($canViewReports || $isClient) - $body .= ''; + $body .= ''; if ($report['show_client']) - $body .= ''; + $body .= ''; if ($report['show_project']) - $body .= ''; + $body .= ''; if ($report['show_task']) - $body .= ''; + $body .= ''; if ($report['show_custom_field_1']) $body .= ''; if ($report['show_start']) - $body .= ''; + $body .= ''; if ($report['show_end']) - $body .= ''; + $body .= ''; if ($report['show_duration']) - $body .= ''; + $body .= ''; if ($report['show_note']) - $body .= ''; + $body .= ''; if ($report['show_cost']) - $body .= ''; + $body .= ''; if ($report['show_paid']) - $body .= ''; + $body .= ''; + if ($report['show_ip']) + $body .= ''; if ($report['show_invoice']) - $body .= ''; + $body .= ''; $body .= ''; // Initialize variables to print subtotals. @@ -1575,7 +1597,7 @@ class ttReportHelper { $cur_grouped_by = $record['grouped_by']; if ($cur_grouped_by != $prev_grouped_by && !$first_pass) { $body .= ''; - $body .= ''; + $body .= ''; $subtotal_name = htmlspecialchars($subtotals[$prev_grouped_by]['name']); if ($canViewReports || $isClient) $body .= ''; if ($report['show_client']) $body .= ''; @@ -1592,6 +1614,7 @@ class ttReportHelper { $body .= ''; } if ($report['show_paid']) $body .= ''; + if ($report['show_ip']) $body .= ''; if ($report['show_invoice']) $body .= ''; $body .= ''; $body .= ''; @@ -1626,7 +1649,12 @@ class ttReportHelper { $body .= ''; if ($report['show_paid']) { $body .= ''; + } + if ($report['show_ip']) { + $body .= ''; } if ($report['show_invoice']) @@ -1642,7 +1670,7 @@ class ttReportHelper { // Print a terminating subtotal. if ($print_subtotals) { $body .= ''; - $body .= ''; + $body .= ''; $subtotal_name = htmlspecialchars($subtotals[$cur_grouped_by]['name']); if ($canViewReports || $isClient) $body .= ''; if ($report['show_client']) $body .= ''; @@ -1659,6 +1687,7 @@ class ttReportHelper { $body .= ''; } if ($report['show_paid']) $body .= ''; + if ($report['show_ip']) $body .= ''; if ($report['show_invoice']) $body .= ''; $body .= ''; } @@ -1666,7 +1695,7 @@ class ttReportHelper { // Print totals. $body .= ''; $body .= ''; - $body .= ''; + $body .= ''; if ($canViewReports || $isClient) $body .= ''; if ($report['show_client']) $body .= ''; if ($report['show_project']) $body .= ''; @@ -1682,6 +1711,7 @@ class ttReportHelper { $body .= ''; } if ($report['show_paid']) $body .= ''; + if ($report['show_ip']) $body .= ''; if ($report['show_invoice']) $body .= ''; $body .= ''; @@ -1690,7 +1720,7 @@ class ttReportHelper { // Output footer. if (!defined('REPORT_FOOTER') || !(REPORT_FOOTER == false)) - $body .= '

'.$i18n->getKey('form.mail.footer').'

'; + $body .= '

'.$i18n->get('form.mail.footer').'

'; // Finish creating email body. $body .= '';
'.$i18n->getKey('label.date').''.$i18n->get('label.date').''.$i18n->getKey('label.user').''.$i18n->get('label.user').''.$i18n->getKey('label.client').''.$i18n->get('label.client').''.$i18n->getKey('label.project').''.$i18n->get('label.project').''.$i18n->getKey('label.task').''.$i18n->get('label.task').''.htmlspecialchars($custom_fields->fields[0]['label']).''.$i18n->getKey('label.start').''.$i18n->get('label.start').''.$i18n->getKey('label.finish').''.$i18n->get('label.finish').''.$i18n->getKey('label.duration').''.$i18n->get('label.duration').''.$i18n->getKey('label.note').''.$i18n->get('label.note').''.$i18n->getKey('label.cost').''.$i18n->get('label.cost').''.$i18n->getKey('label.paid').''.$i18n->get('label.paid').''.$i18n->get('label.ip').''.$i18n->getKey('label.invoice').''.$i18n->get('label.invoice').'
'.$i18n->getKey('label.subtotal').''.$i18n->get('label.subtotal').''.($group_by == 'user' ? $subtotal_name : '').''.($group_by == 'client' ? $subtotal_name : '').'
 
'.$record['cost'].''; - $body .= $record['paid'] == 1 ? $i18n->getKey('label.yes') : $i18n->getKey('label.no'); + $body .= $record['paid'] == 1 ? $i18n->get('label.yes') : $i18n->get('label.no'); + $body .= ''; + $body .= $record['modified'] ? $record['modified_ip'].' '.$record['modified'] : $record['created_ip'].' '.$record['created']; $body .= '
'.$i18n->getKey('label.subtotal').''.$i18n->get('label.subtotal').''.($group_by == 'user' ? $subtotal_name : '').''.($group_by == 'client' ? $subtotal_name : '').'
 
'.$i18n->getKey('label.total').''.$i18n->get('label.total').'