Merge remote-tracking branch 'origin/develop'
Signed-off-by: snipe <snipe@snipe.net> # Conflicts: # config/version.php
This commit is contained in:
commit
91d3848246
7 changed files with 41 additions and 8 deletions
|
@ -14,6 +14,7 @@ use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use \Illuminate\Contracts\View\View;
|
use \Illuminate\Contracts\View\View;
|
||||||
use \Illuminate\Http\RedirectResponse;
|
use \Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
class AssetCheckinController extends Controller
|
class AssetCheckinController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -40,6 +41,15 @@ class AssetCheckinController extends Controller
|
||||||
if (!$asset->model) {
|
if (!$asset->model) {
|
||||||
return redirect()->route('hardware.show', $asset->id)->with('error', trans('admin/hardware/general.model_invalid_fix'));
|
return redirect()->route('hardware.show', $asset->id)->with('error', trans('admin/hardware/general.model_invalid_fix'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate custom fields on existing asset
|
||||||
|
$validator = Validator::make($asset->toArray(), $asset->customFieldValidationRules());
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->route('hardware.edit', $asset)
|
||||||
|
->withErrors($validator);
|
||||||
|
}
|
||||||
|
|
||||||
$target_option = match ($asset->assigned_type) {
|
$target_option = match ($asset->assigned_type) {
|
||||||
'App\Models\Asset' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.asset_previous')]),
|
'App\Models\Asset' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.asset_previous')]),
|
||||||
'App\Models\Location' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.location')]),
|
'App\Models\Location' => trans('admin/hardware/form.redirect_to_type', ['type' => trans('general.location')]),
|
||||||
|
|
|
@ -12,6 +12,7 @@ use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||||
use Illuminate\Support\Facades\Session;
|
use Illuminate\Support\Facades\Session;
|
||||||
use \Illuminate\Contracts\View\View;
|
use \Illuminate\Contracts\View\View;
|
||||||
use \Illuminate\Http\RedirectResponse;
|
use \Illuminate\Http\RedirectResponse;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
class AssetCheckoutController extends Controller
|
class AssetCheckoutController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -36,6 +37,14 @@ class AssetCheckoutController extends Controller
|
||||||
->with('error', trans('admin/hardware/general.model_invalid_fix'));
|
->with('error', trans('admin/hardware/general.model_invalid_fix'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate custom fields on existing asset
|
||||||
|
$validator = Validator::make($asset->toArray(), $asset->customFieldValidationRules());
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->route('hardware.edit', $asset)
|
||||||
|
->withErrors($validator);
|
||||||
|
}
|
||||||
|
|
||||||
if ($asset->availableForCheckout()) {
|
if ($asset->availableForCheckout()) {
|
||||||
return view('hardware/checkout', compact('asset'))
|
return view('hardware/checkout', compact('asset'))
|
||||||
->with('statusLabel_list', Helper::deployableStatusLabelList())
|
->with('statusLabel_list', Helper::deployableStatusLabelList())
|
||||||
|
|
|
@ -877,10 +877,19 @@ class AssetsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function audit(Asset $asset)
|
public function audit(Asset $asset): View | RedirectResponse
|
||||||
{
|
{
|
||||||
$settings = Setting::getSettings();
|
|
||||||
$this->authorize('audit', Asset::class);
|
$this->authorize('audit', Asset::class);
|
||||||
|
$settings = Setting::getSettings();
|
||||||
|
|
||||||
|
// Validate custom fields on existing asset
|
||||||
|
$validator = Validator::make($asset->toArray(), $asset->customFieldValidationRules());
|
||||||
|
|
||||||
|
if ($validator->fails()) {
|
||||||
|
return redirect()->route('hardware.edit', $asset)
|
||||||
|
->withErrors($validator);
|
||||||
|
}
|
||||||
|
|
||||||
$dt = Carbon::now()->addMonths($settings->audit_interval)->toDateString();
|
$dt = Carbon::now()->addMonths($settings->audit_interval)->toDateString();
|
||||||
return view('hardware/audit')->with('asset', $asset)->with('item', $asset)->with('next_audit_date', $dt)->with('locations_list');
|
return view('hardware/audit')->with('asset', $asset)->with('item', $asset)->with('next_audit_date', $dt)->with('locations_list');
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,6 +155,7 @@ class AssetsTransformer
|
||||||
'clone' => Gate::allows('create', Asset::class) ? true : false,
|
'clone' => Gate::allows('create', Asset::class) ? true : false,
|
||||||
'restore' => ($asset->deleted_at!='' && Gate::allows('create', Asset::class)) ? true : false,
|
'restore' => ($asset->deleted_at!='' && Gate::allows('create', Asset::class)) ? true : false,
|
||||||
'update' => ($asset->deleted_at=='' && Gate::allows('update', Asset::class)) ? true : false,
|
'update' => ($asset->deleted_at=='' && Gate::allows('update', Asset::class)) ? true : false,
|
||||||
|
'audit' => Gate::allows('audit', Asset::class) ? true : false,
|
||||||
'delete' => ($asset->deleted_at=='' && $asset->assigned_to =='' && Gate::allows('delete', Asset::class) && ($asset->deleted_at == '')) ? true : false,
|
'delete' => ($asset->deleted_at=='' && $asset->assigned_to =='' && Gate::allows('delete', Asset::class) && ($asset->deleted_at == '')) ? true : false,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
return array (
|
return array (
|
||||||
'app_version' => 'v8.1.0',
|
'app_version' => 'v8.1.1',
|
||||||
'full_app_version' => 'v8.1.0 - build 17855-gd81788345',
|
'full_app_version' => 'v8.1.1 - build 17874-gc031f0b45',
|
||||||
'build_version' => '17855',
|
'build_version' => '17874',
|
||||||
'prerelease_version' => '',
|
'prerelease_version' => '',
|
||||||
'hash_version' => 'gd81788345',
|
'hash_version' => 'gc031f0b45',
|
||||||
'full_hash' => 'v8.1.0-657-gd81788345',
|
'full_hash' => 'v8.1.1-14-gc031f0b45',
|
||||||
'branch' => 'master',
|
'branch' => 'master',
|
||||||
);
|
);
|
|
@ -198,7 +198,7 @@
|
||||||
|
|
||||||
<th data-sortable="true" data-visible="false" data-searchable="false" class="text-center"
|
<th data-sortable="true" data-visible="false" data-searchable="false" class="text-center"
|
||||||
data-tooltip="{{ trans('admin/custom_fields/general.display_audit') }}">
|
data-tooltip="{{ trans('admin/custom_fields/general.display_audit') }}">
|
||||||
<x-icon type="due" />
|
<x-icon type="audit" />
|
||||||
<span class="sr-only">
|
<span class="sr-only">
|
||||||
{{ trans('admin/custom_fields/general.display_audit') }}
|
{{ trans('admin/custom_fields/general.display_audit') }}
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -371,6 +371,10 @@
|
||||||
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> ';
|
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> ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((row.available_actions) && (row.available_actions.audit === true)) {
|
||||||
|
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> ';
|
||||||
|
}
|
||||||
|
|
||||||
if ((row.available_actions) && (row.available_actions.update === true)) {
|
if ((row.available_actions) && (row.available_actions.update === true)) {
|
||||||
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> ';
|
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> ';
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue