Merge pull request #11000 from inietov/fixes/download_all_triggers_getDisplayNameAttribute_on_null

Fixes Activity Report Download all action fails creating the CSV report.
This commit is contained in:
snipe 2022-05-03 20:52:42 +01:00 committed by GitHub
commit fd71b48489
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -272,13 +272,18 @@ class ReportsController extends Controller
} }
} }
if($actionlog->item){
$item_name = e($actionlog->item->getDisplayNameAttribute());
} else {
$item_name ='';
}
$row = [ $row = [
$actionlog->created_at, $actionlog->created_at,
($actionlog->user) ? e($actionlog->user->getFullNameAttribute()) : '', ($actionlog->user) ? e($actionlog->user->getFullNameAttribute()) : '',
$actionlog->present()->actionType(), $actionlog->present()->actionType(),
e($actionlog->itemType()), e($actionlog->itemType()),
($actionlog->itemType()=='user') ? $actionlog->filename : e($actionlog->item->getDisplayNameAttribute()), ($actionlog->itemType()=='user') ? $actionlog->filename : $item_name,
$target_name, $target_name,
($actionlog->note) ? e($actionlog->note): '', ($actionlog->note) ? e($actionlog->note): '',
$actionlog->log_meta, $actionlog->log_meta,