|
218 | 218 | foreach ($custom_fields->userFields as $userField) { |
219 | 219 | $field_name = 'user_field_'.$userField['id']; |
220 | 220 | $checkbox_control_name = 'show_'.$field_name; |
221 | | - if ($bean->getAttribute($checkbox_control_name)) print ',"'.str_replace('"','""',$userField['label']).'"'; |
| 221 | + if ($bean->getAttribute($checkbox_control_name)) print ',"'.ttNeutralizeForCsv($userField['label']).'"'; |
222 | 222 | } |
223 | 223 | } |
224 | 224 | if ($bean->getAttribute('chclient')) print ',"'.$i18n->get('label.client').'"'; |
|
229 | 229 | foreach ($custom_fields->timeFields as $timeField) { |
230 | 230 | $field_name = 'time_field_'.$timeField['id']; |
231 | 231 | $checkbox_control_name = 'show_'.$field_name; |
232 | | - if ($bean->getAttribute($checkbox_control_name)) print ',"'.str_replace('"','""',$timeField['label']).'"'; |
| 232 | + if ($bean->getAttribute($checkbox_control_name)) print ',"'.ttNeutralizeForCsv($timeField['label']).'"'; |
233 | 233 | } |
234 | 234 | } |
235 | 235 | if ($bean->getAttribute('chstart')) print ',"'.$i18n->get('label.start').'"'; |
|
248 | 248 | // Print items. |
249 | 249 | foreach ($items as $item) { |
250 | 250 | print '"'.$item['date'].'"'; |
251 | | - if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) print ',"'.str_replace('"','""',$item['user']).'"'; |
| 251 | + if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient()) print ',"'.ttNeutralizeForCsv($item['user']).'"'; |
252 | 252 | // User custom fields. |
253 | 253 | if ($custom_fields && $custom_fields->userFields) { |
254 | 254 | foreach ($custom_fields->userFields as $userField) { |
255 | 255 | $field_name = 'user_field_'.$userField['id']; |
256 | 256 | $checkbox_control_name = 'show_'.$field_name; |
257 | | - if ($bean->getAttribute($checkbox_control_name)) print ',"'.str_replace('"','""',$item[$field_name]).'"'; |
| 257 | + if ($bean->getAttribute($checkbox_control_name)) print ',"'.ttNeutralizeForCsv($item[$field_name]).'"'; |
258 | 258 | } |
259 | 259 | } |
260 | | - if ($bean->getAttribute('chclient')) print ',"'.str_replace('"','""',$item['client']).'"'; |
261 | | - if ($bean->getAttribute('chproject')) print ',"'.str_replace('"','""',$item['project']).'"'; |
262 | | - if ($bean->getAttribute('chtask')) print ',"'.str_replace('"','""',$item['task']).'"'; |
| 260 | + if ($bean->getAttribute('chclient')) print ',"'.ttNeutralizeForCsv($item['client']).'"'; |
| 261 | + if ($bean->getAttribute('chproject')) print ',"'.ttNeutralizeForCsv($item['project']).'"'; |
| 262 | + if ($bean->getAttribute('chtask')) print ',"'.ttNeutralizeForCsv($item['task']).'"'; |
263 | 263 | // Time custom fields. |
264 | 264 | if ($custom_fields && $custom_fields->timeFields) { |
265 | 265 | foreach ($custom_fields->timeFields as $timeField) { |
266 | 266 | $field_name = 'time_field_'.$timeField['id']; |
267 | 267 | $checkbox_control_name = 'show_'.$field_name; |
268 | | - if ($bean->getAttribute($checkbox_control_name)) print ',"'.str_replace('"','""',$item[$field_name]).'"'; |
| 268 | + if ($bean->getAttribute($checkbox_control_name)) print ',"'.ttNeutralizeForCsv($item[$field_name]).'"'; |
269 | 269 | } |
270 | 270 | } |
271 | 271 | if ($bean->getAttribute('chstart')) print ',"'.$item['start'].'"'; |
|
277 | 277 | print ',"'.$val.'"'; |
278 | 278 | } |
279 | 279 | if ($bean->getAttribute('chunits')) print ',"'.$item['units'].'"'; |
280 | | - if ($bean->getAttribute('chnote')) print ',"'.str_replace('"','""',$item['note']).'"'; |
| 280 | + if ($bean->getAttribute('chnote')) print ',"'.ttNeutralizeForCsv($item['note']).'"'; |
281 | 281 | if ($bean->getAttribute('chcost')) { |
282 | 282 | if ($user->can('manage_invoices') || $user->isClient()) |
283 | 283 | print ',"'.$item['cost'].'"'; |
|
290 | 290 | $ip = $item['modified'] ? $item['modified_ip'].' '.$item['modified'] : $item['created_ip'].' '.$item['created']; |
291 | 291 | print ',"'.$ip.'"'; |
292 | 292 | } |
293 | | - if ($bean->getAttribute('chinvoice')) print ',"'.str_replace('"','""',$item['invoice']).'"'; |
294 | | - if ($bean->getAttribute('chtimesheet')) print ',"'.str_replace('"','""',$item['timesheet_name']).'"'; |
| 293 | + if ($bean->getAttribute('chinvoice')) print ',"'.ttNeutralizeForCsv($item['invoice']).'"'; |
| 294 | + if ($bean->getAttribute('chtimesheet')) print ',"'.ttNeutralizeForCsv($item['timesheet_name']).'"'; |
295 | 295 | print "\n"; |
296 | 296 | } |
297 | 297 | } |
|
0 commit comments