Merge pull request #13674 from snipe/bug/sc-23774

Fixed bug where license checkout/checkin notes were not being saved
This commit is contained in:
snipe 2023-09-28 18:37:47 +01:00 committed by GitHub
commit 96c6c93197
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 6 deletions

View file

@ -76,7 +76,7 @@ class LicenseCheckinController extends Controller
// Declare the rules for the form validation // Declare the rules for the form validation
$rules = [ $rules = [
'note' => 'string|nullable', 'notes' => 'string|nullable',
]; ];
// Create a new validator instance from our validation rules // Create a new validator instance from our validation rules
@ -97,6 +97,7 @@ class LicenseCheckinController extends Controller
// Update the asset data // Update the asset data
$licenseSeat->assigned_to = null; $licenseSeat->assigned_to = null;
$licenseSeat->asset_id = null; $licenseSeat->asset_id = null;
$licenseSeat->notes = $request->input('notes');
// Was the asset updated? // Was the asset updated?
if ($licenseSeat->save()) { if ($licenseSeat->save()) {

View file

@ -63,6 +63,7 @@ class LicenseCheckoutController extends Controller
$licenseSeat = $this->findLicenseSeatToCheckout($license, $seatId); $licenseSeat = $this->findLicenseSeatToCheckout($license, $seatId);
$licenseSeat->user_id = Auth::id(); $licenseSeat->user_id = Auth::id();
$licenseSeat->notes = $request->input('notes');
$checkoutMethod = 'checkoutTo'.ucwords(request('checkout_to_type')); $checkoutMethod = 'checkoutTo'.ucwords(request('checkout_to_type'));

View file

@ -45,6 +45,7 @@ class LicenseSeatsTransformer
'name'=> e($seat->location()->name), 'name'=> e($seat->location()->name),
] : null, ] : null,
'reassignable' => (bool) $seat->license->reassignable, 'reassignable' => (bool) $seat->license->reassignable,
'notes' => e($seat->notes),
'user_can_checkout' => (($seat->assigned_to == '') && ($seat->asset_id == '')), 'user_can_checkout' => (($seat->assigned_to == '') && ($seat->asset_id == '')),
]; ];

View file

@ -254,6 +254,14 @@ class LicensePresenter extends Presenter
'visible' => true, 'visible' => true,
'formatter' => 'locationsLinkObjFormatter', 'formatter' => 'locationsLinkObjFormatter',
], ],
[
'field' => 'notes',
'searchable' => false,
'sortable' => false,
'visible' => false,
'title' => trans('general.notes'),
'formatter' => 'notesFormatter'
],
[ [
'field' => 'checkincheckout', 'field' => 'checkincheckout',
'searchable' => false, 'searchable' => false,

View file

@ -49,11 +49,11 @@
</div> </div>
<!-- Note --> <!-- Note -->
<div class="form-group {{ $errors->has('note') ? 'error' : '' }}"> <div class="form-group {{ $errors->has('notes') ? 'error' : '' }}">
<label for="note" class="col-md-2 control-label">{{ trans('admin/hardware/form.notes') }}</label> <label for="note" class="col-md-2 control-label">{{ trans('admin/hardware/form.notes') }}</label>
<div class="col-md-7"> <div class="col-md-7">
<textarea class="col-md-6 form-control" id="note" name="note">{{ old('note', $licenseSeat->note) }}</textarea> <textarea class="col-md-6 form-control" id="notes" name="notes"></textarea>
{!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!} {!! $errors->first('notes', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div> </div>
</div> </div>
<div class="box-footer"> <div class="box-footer">

View file

@ -55,10 +55,10 @@
<!-- Note --> <!-- Note -->
<div class="form-group {{ $errors->has('note') ? 'error' : '' }}"> <div class="form-group {{ $errors->has('notes') ? 'error' : '' }}">
<label for="note" class="col-md-3 control-label">{{ trans('admin/hardware/form.notes') }}</label> <label for="note" class="col-md-3 control-label">{{ trans('admin/hardware/form.notes') }}</label>
<div class="col-md-7"> <div class="col-md-7">
<textarea class="col-md-6 form-control" id="note" name="note">{{ old('note') }}</textarea> <textarea class="col-md-6 form-control" id="notes" name="notes">{{ old('note') }}</textarea>
{!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!} {!! $errors->first('note', '<span class="alert-msg" aria-hidden="true"><i class="fas fa-times" aria-hidden="true"></i> :message</span>') !!}
</div> </div>
</div> </div>