Skip to content

A free open source IT asset/license management system

Add column to show filenames in Activity Report if the log action is 'uploaded'

Ivan Nieto Vivancof208869aff32
diff --git a/app/Http/Transformers/ActionlogsTransformer.php b/app/Http/Transformers/ActionlogsTransformer.php
index 12f89de2b8..3a095e8910 100644
--- a/app/Http/Transformers/ActionlogsTransformer.php
+++ b/app/Http/Transformers/ActionlogsTransformer.php
@@ -55,25 +55,35 @@ class ActionlogsTransformer
}
}
+ $url = '';
+ if($actionlog->filename!='') {
+ if ($actionlog->present()->actionType() == 'accepted') {
+ $url = route('log.storedeula.download', ['filename' => $actionlog->filename]);
+ } else {
+ if ($actionlog->itemType() == 'asset') {
+ $url = route('show/assetfile', ['assetId' => $actionlog->id, 'fileId' => $actionlog->id]);
+ } elseif ($actionlog->itemType() == 'license') {
+ $url = route('show.licensefile', ['licenseId' => $actionlog->item->id, 'fileId' => $actionlog->id]);
+ } elseif ($actionlog->itemType() == 'user') {
+ $url = route('show/userfile', ['userId' => $actionlog->item->id, 'fileId' => $actionlog->id]);
+ }
+ }
+ }
- $array = [
+ $array = [
'id' => (int) $actionlog->id,
'icon' => $icon,
'file' => ($actionlog->filename!='')
?
[
- 'url' => ($actionlog->present()->actionType()=='accepted')
- ?
- route('log.storedeula.download', ['filename' => $actionlog->filename])
- :
- route('show/assetfile', ['assetId' => $actionlog->id, 'fileId' => $actionlog->id]),
+ 'url' => $url,
'filename' => $actionlog->filename,
'inlineable' => (bool) Helper::show_file_inline($actionlog->filename),
] : null,
'item' => ($actionlog->item) ? [
'id' => (int) $actionlog->item->id,
- 'name' => ($actionlog->itemType()=='user') ? $actionlog->filename : e($actionlog->item->getDisplayNameAttribute()),
+ 'name' => ($actionlog->itemType()=='user') ? e($actionlog->item->getFullNameAttribute()) : e($actionlog->item->getDisplayNameAttribute()),
'type' => e($actionlog->itemType()),
] : null,
'location' => ($actionlog->location) ? [
@@ -104,6 +114,7 @@ class ActionlogsTransformer
];
//\Log::info("Clean Meta is: ".print_r($clean_meta,true));
+ //dd($array);
return $array;
}
diff --git a/resources/views/reports/activity.blade.php b/resources/views/reports/activity.blade.php
index 1b54e78515..931ba654cb 100644
--- a/resources/views/reports/activity.blade.php
+++ b/resources/views/reports/activity.blade.php
@@ -47,6 +47,7 @@
<th class="col-sm-3" data-searchable="false" data-sortable="true" data-field="action_date" data-formatter="dateDisplayFormatter">{{ trans('general.date') }}</th>
<th class="col-sm-2" data-searchable="true" data-sortable="true" data-field="admin" data-formatter="usersLinkObjFormatter">{{ trans('general.admin') }}</th>
<th class="col-sm-2" data-field="action_type">{{ trans('general.action') }}</th>
+ <th class="col-sm-2" data-field="file" data-formatter="fileUploadNameFormatter">{{ trans('general.file_name') }}</th>
<th class="col-sm-1" data-field="type" data-formatter="itemTypeFormatter">{{ trans('general.type') }}</th>
<th class="col-sm-3" data-field="item" data-formatter="polymorphicItemFormatter">{{ trans('general.item') }}</th>
<th class="col-sm-2" data-field="target" data-formatter="polymorphicItemFormatter">{{ trans('general.to') }}</th>