Null and warn if editing asset to a non-deployabe state

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe
2024-09-11 16:43:33 +01:00
parent ab3b655312
commit 98323185de
3 changed files with 10 additions and 2 deletions
@@ -2,6 +2,7 @@
namespace App\Http\Controllers\Assets;
use App\Events\CheckoutableCheckedIn;
use App\Helpers\Helper;
use App\Http\Controllers\Controller;
use App\Http\Requests\ImageUploadRequest;
@@ -336,8 +337,14 @@ class AssetsController extends Controller
$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_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 == '') {