Merge pull request #11001 from inietov/fixes/download_all_triggers_getDisplayNameAttribute_on_null_develop

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

View file

@ -275,13 +275,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,