Skip to content

A free open source IT asset/license management system

Fixed #18939 - blank audit field in scanner audit screen

sniped5d0d00ecce8
diff --git a/app/Http/Controllers/Api/AssetsController.php b/app/Http/Controllers/Api/AssetsController.php
index 86749b8924..43ae8ccf32 100644
--- a/app/Http/Controllers/Api/AssetsController.php
+++ b/app/Http/Controllers/Api/AssetsController.php
@@ -1164,7 +1164,7 @@ class AssetsController extends Controller
'asset_tag' => e($asset->asset_tag),
'audit_by_field' => e(Str::headline($audit_by_field)),
'audit_key' => e($audit_key),
- 'note' => e($request->input('note')),
+ 'note' => $request->filled('note') ? e($request->input('note')) : null,
'status_label' => e($asset->status?->display_name),
'status_type' => $asset->status?->getStatuslabelType(),
'next_audit_date' => Helper::getFormattedDateObject($asset->next_audit_date),
@@ -1205,7 +1205,7 @@ class AssetsController extends Controller
// Validate the rest of the data before we turn off the event dispatcher
if ($asset->isInvalid()) {
- return response()->json(Helper::formatStandardApiResponse('error', ['asset_tag' => $asset->asset_tag], $asset->getErrors()));
+ return response()->json(Helper::formatStandardApiResponse('error', $payload, $asset->getErrors()));
}
/**
diff --git a/resources/views/hardware/quickscan.blade.php b/resources/views/hardware/quickscan.blade.php
index e5c5d14128..1d3fe61953 100644
--- a/resources/views/hardware/quickscan.blade.php
+++ b/resources/views/hardware/quickscan.blade.php
@@ -30,7 +30,7 @@
<div class="form-group {{ $errors->has('audit_by_field') ? 'error' : '' }}">
<label for="audit_by_field" class="col-md-3 control-label" id="audit_by_field">{{ trans('general.audit_by_field') }}</label>
<div class="col-md-8">
- <select name="audit_by_field" data-minimum-results-for-search="Infinity" id="audit_by_field" class="form-control select2" aria-label="audit_by_field" required>
+ <select name="audit_by_field" data-minimum-results-for-search="Infinity" id="audit_by_field" style="width: 100% !important" class="form-control select2" aria-label="audit_by_field" required>
<option value="asset_tag">{{ trans('general.asset_tag') }}</option>
<option value="serial" {{ (($settings->unique_serial != '1') ? 'disabled' : '') }}>{{ trans('general.serial_number') }}</option>
</select>
@@ -45,10 +45,11 @@
</div>
<!-- Tag/Serial -->
- <div class="form-group {{ $errors->has('asset_tag') ? 'error' : '' }}">
+ <div class="form-group {{ $errors->has('audit_key') ? 'error' : '' }}">
<label for="audit_key" class="col-md-3 control-label" id="audit_key_label">{{ trans('general.asset_tag') }}</label>
<div class="col-md-8">
- <input type="text" class="form-control" name="audit_key" required value="{{ old('audit_key') }}">
+ <input type="text" class="form-control" name="audit_key" id="audit_key" required
+ value="{{ old('audit_key') }}">
{!! $errors->first('audit_key', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div>
</div>