Skip to content

Commit

Permalink
Merge pull request #13225 from inietov/fixes/change_default_location_…
Browse files Browse the repository at this point in the history
…at_checkin

Fixed #13167 Default location not being set/updated upon check-in
  • Loading branch information
snipe authored Jul 12, 2023
2 parents 44b8558 + f4ca29b commit 44231fa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/Http/Controllers/Assets/AssetCheckinController.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,18 @@ public function store(AssetCheckinRequest $request, $assetId = null, $backto = n
\Log::debug('Manually override the location IDs');
\Log::debug('Original Location ID: '.$asset->location_id);
$asset->location_id = '';
\Log::debug('New RTD Location ID: '.$asset->location_id);
\Log::debug('New Location ID: '.$asset->location_id);
}

$asset->location_id = $asset->rtd_location_id;

if ($request->filled('location_id')) {
\Log::debug('NEW Location ID: '.$request->get('location_id'));
$asset->location_id = e($request->get('location_id'));
$asset->location_id = $request->get('location_id');

if ($request->get('update_default_location') == 0){
$asset->rtd_location_id = $request->get('location_id');
}
}

$checkin_at = date('Y-m-d H:i:s');
Expand Down
2 changes: 1 addition & 1 deletion resources/views/hardware/checkin.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</div>
</div>

@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id', 'help_text' => ($asset->defaultLoc) ? 'You can choose to check this asset in to a location other than the default location of '.$asset->defaultLoc->name.' if one is set.' : null])
@include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id', 'help_text' => ($asset->defaultLoc) ? 'You can choose to check this asset in to a location other than the default location of '.$asset->defaultLoc->name.' if one is set.' : null, 'hide_location_radio' => true])

<!-- Checkout/Checkin Date -->
<div class="form-group{{ $errors->has('checkin_at') ? ' has-error' : '' }}">
Expand Down
15 changes: 15 additions & 0 deletions resources/views/partials/forms/edit/location-select.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
</div>
@endif

@if (isset($hide_location_radio))
<!-- Update actual location -->
<div class="form-group">
<div class="col-md-9 col-md-offset-3">
<label class="form-control">
{{ Form::radio('update_default_location', '1', old('update_default_location'), ['checked'=> 'checked', 'aria-label'=>'update_default_location']) }}
{{ trans('admin/hardware/form.asset_location') }}
</label>
<label class="form-control">
{{ Form::radio('update_default_location', '0', old('update_default_location'), ['aria-label'=>'update_default_location']) }}
{{ trans('admin/hardware/form.asset_location_update_default_current') }}
</label>
</div>
</div> <!--/form-group-->
@endif

</div>

Expand Down

0 comments on commit 44231fa

Please sign in to comment.