Skip to content

A free open source IT asset/license management system

Fixed #5491 - added default location filter for custom report

snipe13195d06fdec
diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php
index a76729b380..62c211229d 100644
--- a/app/Http/Controllers/ReportsController.php
+++ b/app/Http/Controllers/ReportsController.php
@@ -376,6 +376,7 @@ class ReportsController extends Controller
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');
@@ -462,6 +463,11 @@ class ReportsController extends Controller
$assets->where('assets.location_id', $request->input('by_location_id'));
}
+ if ($request->has('by_rtd_location_id')) {
+ \Log::debug('RTD location should match: '.$request->input('by_rtd_location_id'));
+ $assets->where('assets.rtd_location_id', $request->input('by_rtd_location_id'));
+ }
+
if ($request->has('by_supplier_id')) {
$assets->where('assets.supplier_id', $request->input('by_supplier_id'));
}
@@ -497,6 +503,10 @@ class ReportsController extends Controller
if (($request->has('created_start')) && ($request->has('created_end'))) {
$assets->whereBetween('assets.created_at', [$request->input('created_start'), $request->input('created_end')]);
}
+
+ if (($request->has('expected_checkin_start')) && ($request->has('expected_checkin_end'))) {
+ $assets->whereBetween('assets.expected_checkin', [$request->input('expected_checkin_start'), $request->input('expected_checkin_end')]);
+ }
$assets->orderBy('assets.created_at', 'ASC')->chunk(500, function($assets) use($handle, $customfields, $request) {
diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php
index b523c716c9..176b519467 100644
--- a/resources/views/reports/custom.blade.php
+++ b/resources/views/reports/custom.blade.php
@@ -254,6 +254,7 @@
@include ('partials.forms.edit.company-select', ['translated_name' => trans('general.company'), 'fieldname' => 'by_company_id', 'hide_new' => 'true'])
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'by_location_id', 'hide_new' => 'true'])
+ @include ('partials.forms.edit.location-select', ['translated_name' => trans('admin/hardware/form.default_location'), 'fieldname' => 'by_rtd_location_id', 'hide_new' => 'true'])
@include ('partials.forms.edit.supplier-select', ['translated_name' => trans('general.supplier'), 'fieldname' => 'by_supplier_id', 'hide_new' => 'true'])
@include ('partials.forms.edit.model-select', ['translated_name' => trans('general.asset_model'), 'fieldname' => 'by_model_id', 'hide_new' => 'true'])
@include ('partials.forms.edit.manufacturer-select', ['translated_name' => trans('general.manufacturer'), 'fieldname' => 'by_manufacturer_id', 'hide_new' => 'true'])
@@ -296,6 +297,16 @@
</div>
</div>
+ <!-- Expected Checkin Date -->
+ <div class="form-group purchase-range">
+ <label for="purchase_date" class="col-md-3 control-label">{{ trans('admin/hardware/form.expected_checkin') }}</label>
+ <div class="input-daterange input-group col-md-6" id="datepicker">
+ <input type="text" class="input-sm form-control" name="expected_checkin_start" />
+ <span class="input-group-addon">to</span>
+ <input type="text" class="input-sm form-control" name="expected_checkin_end" />
+ </div>
+ </div>
+
<div class="col-md-9 col-md-offset-3">