From ff879e2018f1fac406b813d423ba7d617817b2c7 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 7 Sep 2018 05:39:41 -0700 Subject: [PATCH] Added the ability to update asset location when auditing - per #5854 --- app/Http/Controllers/Api/AssetsController.php | 6 ++++++ app/Http/Controllers/Assets/AssetsController.php | 8 ++++++++ resources/views/hardware/audit.blade.php | 12 ++++++++++++ resources/views/hardware/quickscan.blade.php | 10 ++++++++++ 4 files changed, 36 insertions(+) diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php index f2f932abf5..dbed7be798 100644 --- a/app/Http/Controllers/Api/AssetsController.php +++ b/app/Http/Controllers/Api/AssetsController.php @@ -733,6 +733,12 @@ class AssetsController extends Controller $asset->next_audit_date = $request->input('next_audit_date'); } + // Check to see if they checked the box to update the physical location, + // not just note it in the audit notes + if ($request->input('update_location')=='1') { + $asset->location_id = $request->input('location_id'); + } + $asset->last_audit_date = date('Y-m-d h:i:s'); if ($asset->save()) { diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php index 9105f4e35e..ce0fa18862 100755 --- a/app/Http/Controllers/Assets/AssetsController.php +++ b/app/Http/Controllers/Assets/AssetsController.php @@ -763,6 +763,14 @@ class AssetsController extends Controller $asset->next_audit_date = $request->input('next_audit_date'); $asset->last_audit_date = date('Y-m-d h:i:s'); + // Check to see if they checked the box to update the physical location, + // not just note it in the audit notes + if ($request->input('update_location')=='1') { + \Log::debug('update location in audit'); + $asset->location_id = $request->input('location_id'); + } + + if ($asset->save()) { diff --git a/resources/views/hardware/audit.blade.php b/resources/views/hardware/audit.blade.php index f05d721e33..5a7289d4b8 100644 --- a/resources/views/hardware/audit.blade.php +++ b/resources/views/hardware/audit.blade.php @@ -53,6 +53,18 @@ @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id']) + +
+
+ + sdd +

Checking this box will edit the asset record to reflect this new location. Leaving it unchecked will simply note the location in the audit log.

+ +
+
+
diff --git a/resources/views/hardware/quickscan.blade.php b/resources/views/hardware/quickscan.blade.php index 9e90ae36e8..b3df1139d5 100644 --- a/resources/views/hardware/quickscan.blade.php +++ b/resources/views/hardware/quickscan.blade.php @@ -46,6 +46,16 @@ @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id']) + +
+
+ +
+
+ +
{{ Form::label('next_audit_date', trans('general.next_audit_date'), array('class' => 'col-md-3 control-label')) }}