Skip to content

A free open source IT asset/license management system

Allow pending as an asset status that does not automatically check the asset in

snipe5344ef4a1a51
diff --git a/app/Http/Controllers/Api/StatuslabelsController.php b/app/Http/Controllers/Api/StatuslabelsController.php
index 7e4851ff5a..b3503ff152 100644
--- a/app/Http/Controllers/Api/StatuslabelsController.php
+++ b/app/Http/Controllers/Api/StatuslabelsController.php
@@ -290,10 +290,12 @@ class StatuslabelsController extends Controller
/**
* Returns a boolean response based on whether the status label
- * is one that is deployable.
+ * is one that is deployable or pending.
*
* This is used by the hardware create/edit view to determine whether
- * we should provide a dropdown of users for them to check the asset out to.
+ * we should provide a dropdown of users for them to check the asset out to,
+ * and whether we show a warning that the asset will be checked in if it's already
+ * assigned but the status is changed to one that isn't pending or deployable
*
* @author [A. Gianotto] [<[email protected]>]
* @since [v4.0]
@@ -301,7 +303,7 @@ class StatuslabelsController extends Controller
public function checkIfDeployable($id) : string
{
$statuslabel = Statuslabel::findOrFail($id);
- if ($statuslabel->getStatuslabelType() == 'deployable') {
+ if (($statuslabel->getStatuslabelType() == 'pending') || ($statuslabel->getStatuslabelType() == 'deployable')) {
return '1';
}
diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.php
index f3b2de3e7d..c8b9364252 100755
--- a/app/Http/Controllers/Assets/AssetsController.php
+++ b/app/Http/Controllers/Assets/AssetsController.php
@@ -340,15 +340,14 @@ class AssetsController extends Controller
$status = Statuslabel::find($request->input('status_id'));
- // This is a non-deployable status label - we should check the asset back in.
- if (($status && $status->getStatuslabelType() != 'deployable') && ($target = $asset->assignedTo)) {
-
+ // This is an archived or undeployable - we should check the asset back in.
+ // Pending is allowed here
+ if (($status) && (($status->getStatuslabelType() != 'pending') || ($status->getStatuslabelType() != 'deployable')) && ($target = $asset->assignedTo)) {
$originalValues = $asset->getRawOriginal();
$asset->assigned_to = null;
$asset->assigned_type = null;
$asset->accepted = null;
-
- event(new CheckoutableCheckedIn($asset, $target, auth()->user(), 'Checkin on asset update', date('Y-m-d H:i:s'), $originalValues));
+ event(new CheckoutableCheckedIn($asset, $target, auth()->user(), 'Checkin on asset update with '.$status->getStatuslabelType().' status', date('Y-m-d H:i:s'), $originalValues));
}
if ($asset->assigned_to == '') {