|
119 | 119 | if ($bean->getAttribute('chduration')) $html .= "<td $styleRightAligned>".$subtotal['time'].'</td>'; |
120 | 120 | if ($bean->getAttribute('chcost')) { |
121 | 121 | $html .= "<td $styleRightAligned>"; |
122 | | - if ($user->canManageTeam() || $user->isClient()) |
| 122 | + if ($user->can('manage_invoices') || $user->isClient()) |
123 | 123 | $html .= $subtotal['cost']; |
124 | 124 | else |
125 | 125 | $html .= $subtotal['expenses']; |
|
135 | 135 | if ($bean->getAttribute('chcost')) { |
136 | 136 | $html .= "<td $styleRightAligned>"; |
137 | 137 | $html .= htmlspecialchars($user->currency).' '; |
138 | | - if ($user->canManageTeam() || $user->isClient()) |
| 138 | + if ($user->can('manage_invoices') || $user->isClient()) |
139 | 139 | $html .= $totals['cost']; |
140 | 140 | else |
141 | 141 | $html .= $totals['expenses']; |
|
150 | 150 | $html .= '<thead>'; |
151 | 151 | $html .= "<tr $styleHeader>"; |
152 | 152 | $html .= '<td>'.$i18n->get('label.date').'</td>'; |
153 | | - if ($user->canManageTeam() || $user->isClient()) { $colspan++; $html .= '<td>'.$i18n->get('label.user').'</td>'; } |
| 153 | + if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) { $colspan++; $html .= '<td>'.$i18n->get('label.user').'</td>'; } |
154 | 154 | if ($bean->getAttribute('chclient')) { $colspan++; $html .= '<td>'.$i18n->get('label.client').'</td>'; } |
155 | 155 | if ($bean->getAttribute('chproject')) { $colspan++; $html .= '<td>'.$i18n->get('label.project').'</td>'; } |
156 | 156 | if ($bean->getAttribute('chtask')) { $colspan++; $html .= '<td>'.$i18n->get('label.task').'</td>'; } |
|
174 | 174 | if ($cur_grouped_by != $prev_grouped_by && !$first_pass) { |
175 | 175 | $html .= '<tr style="background-color:#e0e0e0;">'; |
176 | 176 | $html .= '<td>'.$i18n->get('label.subtotal').'</td>'; |
177 | | - if ($user->canManageTeam() || $user->isClient()) { |
| 177 | + if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) { |
178 | 178 | $html .= '<td>'; |
179 | 179 | if ($group_by == 'user') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); |
180 | 180 | $html .= '</td>'; |
|
205 | 205 | if ($bean->getAttribute('chnote')) $html .= '<td></td>'; |
206 | 206 | if ($bean->getAttribute('chcost')) { |
207 | 207 | $html .= "<td $styleRightAligned>"; |
208 | | - if ($user->canManageTeam() || $user->isClient()) |
| 208 | + if ($user->can('manage_invoices') || $user->isClient()) |
209 | 209 | $html .= $subtotals[$prev_grouped_by]['cost']; |
210 | 210 | else |
211 | 211 | $html .= $subtotals[$prev_grouped_by]['expenses']; |
|
223 | 223 | // Print a regular row. |
224 | 224 | $html .= '<tr>'; |
225 | 225 | $html .= '<td>'.$item['date'].'</td>'; |
226 | | - if ($user->canManageTeam() || $user->isClient()) $html .= '<td>'.htmlspecialchars($item['user']).'</td>'; |
| 226 | + if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) $html .= '<td>'.htmlspecialchars($item['user']).'</td>'; |
227 | 227 | if ($bean->getAttribute('chclient')) $html .= '<td>'.htmlspecialchars($item['client']).'</td>'; |
228 | 228 | if ($bean->getAttribute('chproject')) $html .= '<td>'.htmlspecialchars($item['project']).'</td>'; |
229 | 229 | if ($bean->getAttribute('chtask')) $html .= '<td>'.htmlspecialchars($item['task']).'</td>'; |
|
234 | 234 | if ($bean->getAttribute('chnote')) $html .= '<td>'.htmlspecialchars($item['note']).'</td>'; |
235 | 235 | if ($bean->getAttribute('chcost')) { |
236 | 236 | $html .= "<td $styleRightAligned>"; |
237 | | - if ($user->canManageTeam() || $user->isClient()) |
| 237 | + if ($user->can('manage_invoices') || $user->isClient()) |
238 | 238 | $html .= $item['cost']; |
239 | 239 | else |
240 | 240 | $html .= $item['expense']; |
|
261 | 261 | if ($print_subtotals) { |
262 | 262 | $html .= '<tr style="background-color:#e0e0e0;">'; |
263 | 263 | $html .= '<td>'.$i18n->get('label.subtotal').'</td>'; |
264 | | - if ($user->canManageTeam() || $user->isClient()) { |
| 264 | + if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) { |
265 | 265 | $html .= '<td>'; |
266 | 266 | if ($group_by == 'user') $html .= htmlspecialchars($subtotals[$prev_grouped_by]['name']); |
267 | 267 | $html .= '</td>'; |
|
292 | 292 | if ($bean->getAttribute('chnote')) $html .= '<td></td>'; |
293 | 293 | if ($bean->getAttribute('chcost')) { |
294 | 294 | $html .= "<td $styleRightAligned>"; |
295 | | - if ($user->canManageTeam() || $user->isClient()) |
| 295 | + if ($user->can('manage_invoices') || $user->isClient()) |
296 | 296 | $html .= $subtotals[$prev_grouped_by]['cost']; |
297 | 297 | else |
298 | 298 | $html .= $subtotals[$prev_grouped_by]['expenses']; |
|
308 | 308 | $html .= '<tr><td colspan="'.$colspan.'"> </td></tr>'; |
309 | 309 | $html .= '<tr style="background-color:#e0e0e0;">'; |
310 | 310 | $html .= '<td>'.$i18n->get('label.total').'</td>'; |
311 | | - if ($user->canManageTeam() || $user->isClient()) $html .= '<td></td>'; |
| 311 | + if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) $html .= '<td></td>'; |
312 | 312 | if ($bean->getAttribute('chclient')) $html .= '<td></td>'; |
313 | 313 | if ($bean->getAttribute('chproject')) $html .= '<td></td>'; |
314 | 314 | if ($bean->getAttribute('chtask')) $html .= '<td></td>'; |
|
319 | 319 | if ($bean->getAttribute('chnote')) $html .= '<td></td>'; |
320 | 320 | if ($bean->getAttribute('chcost')) { |
321 | 321 | $html .= "<td $styleRightAligned>".htmlspecialchars($user->currency).' '; |
322 | | - if ($user->canManageTeam() || $user->isClient()) |
| 322 | + if ($user->can('manage_invoices') || $user->isClient()) |
323 | 323 | $html .= $totals['cost']; |
324 | 324 | else |
325 | 325 | $html .= $totals['expenses']; |
|
0 commit comments