Skip to content

Commit 91d3848

Browse files
committed
Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <[email protected]> # Conflicts: # config/version.php
2 parents c031f0b + 7daecdd commit 91d3848

File tree

7 files changed

+41
-8
lines changed

7 files changed

+41
-8
lines changed

app/Http/Controllers/Assets/AssetCheckinController.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Illuminate\Support\Facades\Log;
1515
use \Illuminate\Contracts\View\View;
1616
use \Illuminate\Http\RedirectResponse;
17+
use Illuminate\Support\Facades\Validator;
1718

1819
class AssetCheckinController extends Controller
1920
{
@@ -40,6 +41,15 @@ public function create(Asset $asset, $backto = null) : View | RedirectResponse
4041
if (!$asset->model) {
4142
return redirect()->route('hardware.show', $asset->id)->with('error', trans('admin/hardware/general.model_invalid_fix'));
4243
}
44+
45+
// Validate custom fields on existing asset
46+
$validator = Validator::make($asset->toArray(), $asset->customFieldValidationRules());
47+
48+
if ($validator->fails()) {
49+
return redirect()->route('hardware.edit', $asset)
50+
->withErrors($validator);
51+
}
52+
4353
$target_option = match ($asset->assigned_type) {
4454
'App\Models\Asset' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.asset_previous')]),
4555
'App\Models\Location' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.location')]),

app/Http/Controllers/Assets/AssetCheckoutController.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Illuminate\Support\Facades\Session;
1313
use \Illuminate\Contracts\View\View;
1414
use \Illuminate\Http\RedirectResponse;
15+
use Illuminate\Support\Facades\Validator;
1516

1617
class AssetCheckoutController extends Controller
1718
{
@@ -36,6 +37,14 @@ public function create(Asset $asset) : View | RedirectResponse
3637
->with('error', trans('admin/hardware/general.model_invalid_fix'));
3738
}
3839

40+
// Validate custom fields on existing asset
41+
$validator = Validator::make($asset->toArray(), $asset->customFieldValidationRules());
42+
43+
if ($validator->fails()) {
44+
return redirect()->route('hardware.edit', $asset)
45+
->withErrors($validator);
46+
}
47+
3948
if ($asset->availableForCheckout()) {
4049
return view('hardware/checkout', compact('asset'))
4150
->with('statusLabel_list', Helper::deployableStatusLabelList())

app/Http/Controllers/Assets/AssetsController.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,10 +877,19 @@ public function dueForCheckin()
877877
}
878878

879879

880-
public function audit(Asset $asset)
880+
public function audit(Asset $asset): View | RedirectResponse
881881
{
882-
$settings = Setting::getSettings();
883882
$this->authorize('audit', Asset::class);
883+
$settings = Setting::getSettings();
884+
885+
// Validate custom fields on existing asset
886+
$validator = Validator::make($asset->toArray(), $asset->customFieldValidationRules());
887+
888+
if ($validator->fails()) {
889+
return redirect()->route('hardware.edit', $asset)
890+
->withErrors($validator);
891+
}
892+
884893
$dt = Carbon::now()->addMonths($settings->audit_interval)->toDateString();
885894
return view('hardware/audit')->with('asset', $asset)->with('item', $asset)->with('next_audit_date', $dt)->with('locations_list');
886895
}

app/Http/Transformers/AssetsTransformer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ public function transformAsset(Asset $asset)
155155
'clone' => Gate::allows('create', Asset::class) ? true : false,
156156
'restore' => ($asset->deleted_at!='' && Gate::allows('create', Asset::class)) ? true : false,
157157
'update' => ($asset->deleted_at=='' && Gate::allows('update', Asset::class)) ? true : false,
158+
'audit' => Gate::allows('audit', Asset::class) ? true : false,
158159
'delete' => ($asset->deleted_at=='' && $asset->assigned_to =='' && Gate::allows('delete', Asset::class) && ($asset->deleted_at == '')) ? true : false,
159160
];
160161

config/version.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22
return array (
3-
'app_version' => 'v8.1.0',
4-
'full_app_version' => 'v8.1.0 - build 17855-gd81788345',
5-
'build_version' => '17855',
3+
'app_version' => 'v8.1.1',
4+
'full_app_version' => 'v8.1.1 - build 17874-gc031f0b45',
5+
'build_version' => '17874',
66
'prerelease_version' => '',
7-
'hash_version' => 'gd81788345',
8-
'full_hash' => 'v8.1.0-657-gd81788345',
7+
'hash_version' => 'gc031f0b45',
8+
'full_hash' => 'v8.1.1-14-gc031f0b45',
99
'branch' => 'master',
1010
);

resources/views/custom_fields/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ class="sr-only">{{ trans('admin/custom_fields/general.unique') }}</span></i></th
198198

199199
<th data-sortable="true" data-visible="false" data-searchable="false" class="text-center"
200200
data-tooltip="{{ trans('admin/custom_fields/general.display_audit') }}">
201-
<x-icon type="due" />
201+
<x-icon type="audit" />
202202
<span class="sr-only">
203203
{{ trans('admin/custom_fields/general.display_audit') }}
204204
</span>

resources/views/partials/bootstrap-table.blade.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,10 @@ function genericActionsFormatter(owner_name, element_name) {
371371
actions += '<a href="{{ config('app.url') }}/' + dest + '/' + row.id + '/clone" class="actions btn btn-sm btn-info" data-tooltip="true" title="{{ trans('general.clone_item') }}"><x-icon type="clone" /><span class="sr-only">{{ trans('general.clone_item') }}</span></a>&nbsp;';
372372
}
373373
374+
if ((row.available_actions) && (row.available_actions.audit === true)) {
375+
actions += '<a href="{{ config('app.url') }}/' + dest + '/' + row.id + '/audit" class="actions btn btn-sm btn-primary" data-tooltip="true" title="{{ trans('general.audit') }}"><x-icon type="audit" /><span class="sr-only">{{ trans('general.audit') }}</span></a>&nbsp;';
376+
}
377+
374378
if ((row.available_actions) && (row.available_actions.update === true)) {
375379
actions += '<a href="{{ config('app.url') }}/' + dest + '/' + row.id + '/edit" class="actions btn btn-sm btn-warning" data-tooltip="true" title="{{ trans('general.update') }}"><x-icon type="edit" /><span class="sr-only">{{ trans('general.update') }}</span></a>&nbsp;';
376380
} else {

0 commit comments

Comments
 (0)