}
if ($bean->getAttribute('chcost')) {
print "\t<cost><![CDATA[";
- if ($user->canManageTeam() || $user->isClient())
+ if ($user->can('manage_invoices') || $user->isClient())
print $subtotal['cost'];
else
print $subtotal['expenses'];
print "<row>\n";
print "\t<date><![CDATA[".$item['date']."]]></date>\n";
- if ($user->canManageTeam() || $user->isClient()) print "\t<user><![CDATA[".$item['user']."]]></user>\n";
+ if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) print "\t<user><![CDATA[".$item['user']."]]></user>\n";
if ($bean->getAttribute('chclient')) print "\t<client><![CDATA[".$item['client']."]]></client>\n";
if ($bean->getAttribute('chproject')) print "\t<project><![CDATA[".$item['project']."]]></project>\n";
if ($bean->getAttribute('chtask')) print "\t<task><![CDATA[".$item['task']."]]></task>\n";
if ($bean->getAttribute('chnote')) print "\t<note><![CDATA[".$item['note']."]]></note>\n";
if ($bean->getAttribute('chcost')) {
print "\t<cost><![CDATA[";
- if ($user->canManageTeam() || $user->isClient())
+ if ($user->can('manage_invoices') || $user->isClient())
print $item['cost'];
else
print $item['expense'];
print ',"'.$val.'"';
}
if ($bean->getAttribute('chcost')) {
- if ($user->canManageTeam() || $user->isClient())
+ if ($user->can('manage_invoices') || $user->isClient())
print ',"'.$subtotal['cost'].'"';
else
print ',"'.$subtotal['expenses'].'"';
} else {
// Normal report. Print headers.
print '"'.$i18n->get('label.date').'"';
- if ($user->canManageTeam() || $user->isClient()) print ',"'.$i18n->get('label.user').'"';
+ if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) print ',"'.$i18n->get('label.user').'"';
if ($bean->getAttribute('chclient')) print ',"'.$i18n->get('label.client').'"';
if ($bean->getAttribute('chproject')) print ',"'.$i18n->get('label.project').'"';
if ($bean->getAttribute('chtask')) print ',"'.$i18n->get('label.task').'"';
// Print items.
foreach ($items as $item) {
print '"'.$item['date'].'"';
- if ($user->canManageTeam() || $user->isClient()) print ',"'.str_replace('"','""',$item['user']).'"';
+ if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) print ',"'.str_replace('"','""',$item['user']).'"';
if ($bean->getAttribute('chclient')) print ',"'.str_replace('"','""',$item['client']).'"';
if ($bean->getAttribute('chproject')) print ',"'.str_replace('"','""',$item['project']).'"';
if ($bean->getAttribute('chtask')) print ',"'.str_replace('"','""',$item['task']).'"';
}
if ($bean->getAttribute('chnote')) print ',"'.str_replace('"','""',$item['note']).'"';
if ($bean->getAttribute('chcost')) {
- if ($user->canManageTeam() || $user->isClient())
+ if ($user->can('manage_invoices') || $user->isClient())
print ',"'.$item['cost'].'"';
else
print ',"'.$item['expense'].'"';
if ($bean->getAttribute('chduration')) $html .= "<td $styleRightAligned>".$subtotal['time'].'</td>';
if ($bean->getAttribute('chcost')) {
$html .= "<td $styleRightAligned>";
- if ($user->canManageTeam() || $user->isClient())
+ if ($user->can('manage_invoices') || $user->isClient())
$html .= $subtotal['cost'];
else
$html .= $subtotal['expenses'];
if ($bean->getAttribute('chcost')) {
$html .= "<td $styleRightAligned>";
$html .= htmlspecialchars($user->currency).' ';
- if ($user->canManageTeam() || $user->isClient())
+ if ($user->can('manage_invoices') || $user->isClient())
$html .= $totals['cost'];
else
$html .= $totals['expenses'];
$html .= '<thead>';
$html .= "<tr $styleHeader>";
$html .= '<td>'.$i18n->get('label.date').'</td>';
- if ($user->canManageTeam() || $user->isClient()) { $colspan++; $html .= '<td>'.$i18n->get('label.user').'</td>'; }
+ if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) { $colspan++; $html .= '<td>'.$i18n->get('label.user').'</td>'; }
if ($bean->getAttribute('chclient')) { $colspan++; $html .= '<td>'.$i18n->get('label.client').'</td>'; }
if ($bean->getAttribute('chproject')) { $colspan++; $html .= '<td>'.$i18n->get('label.project').'</td>'; }
if ($bean->getAttribute('chtask')) { $colspan++; $html .= '<td>'.$i18n->get('label.task').'</td>'; }
if ($cur_grouped_by != $prev_grouped_by && !$first_pass) {
$html .= '<tr style="background-color:#e0e0e0;">';
$html .= '<td>'.$i18n->get('label.subtotal').'</td>';
- if ($user->canManageTeam() || $user->isClient()) {
+ if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) {
$html .= '<td>';
if ($group_by == 'user') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']);
$html .= '</td>';
if ($bean->getAttribute('chnote')) $html .= '<td></td>';
if ($bean->getAttribute('chcost')) {
$html .= "<td $styleRightAligned>";
- if ($user->canManageTeam() || $user->isClient())
+ if ($user->can('manage_invoices') || $user->isClient())
$html .= $subtotals[$prev_grouped_by]['cost'];
else
$html .= $subtotals[$prev_grouped_by]['expenses'];
// Print a regular row.
$html .= '<tr>';
$html .= '<td>'.$item['date'].'</td>';
- if ($user->canManageTeam() || $user->isClient()) $html .= '<td>'.htmlspecialchars($item['user']).'</td>';
+ if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) $html .= '<td>'.htmlspecialchars($item['user']).'</td>';
if ($bean->getAttribute('chclient')) $html .= '<td>'.htmlspecialchars($item['client']).'</td>';
if ($bean->getAttribute('chproject')) $html .= '<td>'.htmlspecialchars($item['project']).'</td>';
if ($bean->getAttribute('chtask')) $html .= '<td>'.htmlspecialchars($item['task']).'</td>';
if ($bean->getAttribute('chnote')) $html .= '<td>'.htmlspecialchars($item['note']).'</td>';
if ($bean->getAttribute('chcost')) {
$html .= "<td $styleRightAligned>";
- if ($user->canManageTeam() || $user->isClient())
+ if ($user->can('manage_invoices') || $user->isClient())
$html .= $item['cost'];
else
$html .= $item['expense'];
if ($print_subtotals) {
$html .= '<tr style="background-color:#e0e0e0;">';
$html .= '<td>'.$i18n->get('label.subtotal').'</td>';
- if ($user->canManageTeam() || $user->isClient()) {
+ if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) {
$html .= '<td>';
if ($group_by == 'user') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']);
$html .= '</td>';
if ($bean->getAttribute('chnote')) $html .= '<td></td>';
if ($bean->getAttribute('chcost')) {
$html .= "<td $styleRightAligned>";
- if ($user->canManageTeam() || $user->isClient())
+ if ($user->can('manage_invoices') || $user->isClient())
$html .= $subtotals[$prev_grouped_by]['cost'];
else
$html .= $subtotals[$prev_grouped_by]['expenses'];
$html .= '<tr><td colspan="'.$colspan.'"> </td></tr>';
$html .= '<tr style="background-color:#e0e0e0;">';
$html .= '<td>'.$i18n->get('label.total').'</td>';
- if ($user->canManageTeam() || $user->isClient()) $html .= '<td></td>';
+ if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) $html .= '<td></td>';
if ($bean->getAttribute('chclient')) $html .= '<td></td>';
if ($bean->getAttribute('chproject')) $html .= '<td></td>';
if ($bean->getAttribute('chtask')) $html .= '<td></td>';
if ($bean->getAttribute('chnote')) $html .= '<td></td>';
if ($bean->getAttribute('chcost')) {
$html .= "<td $styleRightAligned>".htmlspecialchars($user->currency).' ';
- if ($user->canManageTeam() || $user->isClient())
+ if ($user->can('manage_invoices') || $user->isClient())
$html .= $totals['cost'];
else
$html .= $totals['expenses'];