Skip to content

A free open source IT asset/license management system

Added the ability to update asset location when auditing - per #5854

snipeff879e2018f1
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 @@
<!-- Locations -->
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id'])
+ <!-- Update location -->
+ <div class="form-group">
+ <div class="col-sm-offset-3 col-md-9">
+ <label>
+ <input type="checkbox" value="1" name="update_location" class="minimal" {{ Input::old('update_location') == '1' ? ' checked="checked"' : '' }}> Update asset location
+ </label>
+ sdd
+ <p class="help-block">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.</p>
+
+ </div>
+ </div>
+
<!-- Next Audit -->
<div class="form-group {{ $errors->has('next_audit_date') ? 'error' : '' }}">
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'])
+ <!-- Update location -->
+ <div class="form-group">
+ <div class="col-sm-offset-3 col-md-9">
+ <label>
+ <input type="checkbox" value="1" name="update_location" class="minimal" {{ Input::old('update_location') == '1' ? ' checked="checked"' : '' }}> Update asset location
+ </label> <a href="#" class="text-dark-gray" tabindex="0" role="button" data-toggle="popover" data-trigger="focus" title="More Info" data-html="true" data-content="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.<br><br>Note that is this asset is checked out, it will not change the location of the person, asset or location it is checked out to."><i class="fa fa-life-ring"></i></a>
+ </div>
+ </div>
+
+
<!-- Next Audit -->
<div class="form-group {{ $errors->has('next_audit_date') ? 'error' : '' }}">
{{ Form::label('next_audit_date', trans('general.next_audit_date'), array('class' => 'col-md-3 control-label')) }}