Skip to content

A free open source IT asset/license management system

Fixed #8726 - disallow archived assets to be checked out

snipef0e04ab9e4e6
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index 8404a0e1d7..376be08fcb 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -244,11 +244,12 @@ class Asset extends Depreciable
*/
public function availableForCheckout()
{
+ \Log::debug($this->assetstatus);
if (
- (!$this->assignedTo) ||
+ ((!$this->assignedTo) && ($this->assetstatus->archived == 0)) ||
((empty($this->assigned_to)) &&
(empty($this->deleted_at)) &&
- (($this->assetstatus) && ($this->assetstatus->deployable == 1))))
+ (($this->assetstatus) && ($this->assetstatus->deployable == 1))))
{
return true;
}