mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Null and warn if editing asset to a non-deployabe state
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
ab3b655312
commit
98323185de
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Assets;
|
namespace App\Http\Controllers\Assets;
|
||||||
|
|
||||||
|
use App\Events\CheckoutableCheckedIn;
|
||||||
use App\Helpers\Helper;
|
use App\Helpers\Helper;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Http\Requests\ImageUploadRequest;
|
use App\Http\Requests\ImageUploadRequest;
|
||||||
|
@ -336,8 +337,14 @@ class AssetsController extends Controller
|
||||||
|
|
||||||
$status = Statuslabel::find($asset->status_id);
|
$status = Statuslabel::find($asset->status_id);
|
||||||
|
|
||||||
if ($status && $status->archived) {
|
// This is a non-deployable status label - we should check the asset back in.
|
||||||
|
if (($status && $status->getStatuslabelType() != 'deployable') && (is_null($target = $asset->assignedTo))) {
|
||||||
|
|
||||||
|
$originalValues = $asset->getRawOriginal();
|
||||||
$asset->assigned_to = null;
|
$asset->assigned_to = null;
|
||||||
|
$asset->assigned_type = null;
|
||||||
|
|
||||||
|
event(new CheckoutableCheckedIn($asset, $target, auth()->user(), 'Checkin on asset update', date('Y-m-d H:i:s'), $originalValues));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($asset->assigned_to == '') {
|
if ($asset->assigned_to == '') {
|
||||||
|
|
|
@ -55,6 +55,7 @@ return [
|
||||||
'asset_location_update_default' => 'Update only default location',
|
'asset_location_update_default' => 'Update only default location',
|
||||||
'asset_location_update_actual' => 'Update only actual location',
|
'asset_location_update_actual' => 'Update only actual location',
|
||||||
'asset_not_deployable' => 'That asset status is not deployable. This asset cannot be checked out.',
|
'asset_not_deployable' => 'That asset status is not deployable. This asset cannot be checked out.',
|
||||||
|
'asset_not_deployable_checkin' => 'That asset status is not deployable. Using this status label will checkin the asset.',
|
||||||
'asset_deployable' => 'That status is deployable. This asset can be checked out.',
|
'asset_deployable' => 'That status is deployable. This asset can be checked out.',
|
||||||
'processing_spinner' => 'Processing... (This might take a bit of time on large files)',
|
'processing_spinner' => 'Processing... (This might take a bit of time on large files)',
|
||||||
'optional_infos' => 'Optional Information',
|
'optional_infos' => 'Optional Information',
|
||||||
|
|
|
@ -263,7 +263,7 @@
|
||||||
$("#assignto_selector").hide();
|
$("#assignto_selector").hide();
|
||||||
$("#selected_status_status").removeClass('text-success');
|
$("#selected_status_status").removeClass('text-success');
|
||||||
$("#selected_status_status").addClass('text-danger');
|
$("#selected_status_status").addClass('text-danger');
|
||||||
$("#selected_status_status").html('<x-icon type="warning" /> {{ trans('admin/hardware/form.asset_not_deployable')}} ');
|
$("#selected_status_status").html('<x-icon type="warning" /> {{ (($item->assignedTo) && ($item->deleted_at == '')) ? trans('admin/hardware/form.asset_not_deployable_checkin') : trans('admin/hardware/form.asset_not_deployable') }} ');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue