Skip to content

A free open source IT asset/license management system

Added default location/address to custom report

snipe225343994065
diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php
index e0a1f5aa58..03d9499575 100644
--- a/app/Http/Controllers/ReportsController.php
+++ b/app/Http/Controllers/ReportsController.php
@@ -503,6 +503,19 @@ class ReportsController extends Controller
$header[] = trans('general.zip');
}
+ if ($request->has('rtd_location')) {
+ $header[] = trans('admin/hardware/form.default_location');
+ }
+ if ($request->has('rtd_location_address')) {
+ $header[] = trans('general.address');
+ $header[] = trans('general.address');
+ $header[] = trans('general.city');
+ $header[] = trans('general.state');
+ $header[] = trans('general.country');
+ $header[] = trans('general.zip');
+ }
+
+
if ($request->has('assigned_to')) {
$header[] = trans('admin/hardware/table.checkoutto');
$header[] = trans('general.type');
@@ -671,12 +684,25 @@ class ReportsController extends Controller
}
if ($request->has('location_address')) {
- $row[] = ($asset->location) ? $asset->location->address : '';
- $row[] = ($asset->location) ? $asset->location->address2 : '';
- $row[] = ($asset->location) ? $asset->location->city : '';
- $row[] = ($asset->location) ? $asset->location->state : '';
- $row[] = ($asset->location) ? $asset->location->country : '';
- $row[] = ($asset->location) ? $asset->location->zip : '';
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->address : '';
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->address2 : '';
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->city : '';
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->state : '';
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->country : '';
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->zip : '';
+ }
+
+ if ($request->has('rtd_location')) {
+ $row[] = ($asset->location) ? $asset->defaultLoc->present()->name() : '';
+ }
+
+ if ($request->has('rtd_location_address')) {
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->address : '';
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->address2 : '';
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->city : '';
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->state : '';
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->country : '';
+ $row[] = ($asset->defaultLoc) ? $asset->defaultLoc->zip : '';
}
diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php
index 1b9817fce4..6e556a204d 100644
--- a/resources/views/reports/custom.blade.php
+++ b/resources/views/reports/custom.blade.php
@@ -118,9 +118,23 @@
<div class="checkbox col-md-12">
<label>
{{ Form::checkbox('location_address', '1', '1', ['class' => 'minimal']) }}
- {{ trans('general.address') }}
+ - {{ trans('general.address') }}
</label>
</div>
+
+ <div class="checkbox col-md-12">
+ <label>
+ {{ Form::checkbox('rtd_location', '1', '1', ['class' => 'minimal']) }}
+ {{ trans('admin/hardware/form.default_location') }}
+ </label>
+ </div>
+ <div class="checkbox col-md-12">
+ <label>
+ {{ Form::checkbox('rtd_location_address', '1', '1', ['class' => 'minimal']) }}
+ - {{ trans('general.address') }}
+ </label>
+ </div>
+
<div class="checkbox col-md-12">
<label>
{{ Form::checkbox('assigned_to', '1', '1', ['class' => 'minimal']) }}