Skip to content

A free open source IT asset/license management system

Simplified availableForCheckout() on asset

snipe9f7f1460e9c2
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index 86b30347ba..f84c2ca707 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -246,13 +246,18 @@ class Asset extends Depreciable
*/
public function availableForCheckout()
{
- if (
- ((!$this->assignedTo) && ($this->assetstatus->archived == 0)) ||
- ((empty($this->assigned_to)) &&
- (empty($this->deleted_at)) &&
- (($this->assetstatus) && ($this->assetstatus->deployable == 1))))
- {
- return true;
+
+ // This asset is not currently assigned to anyone and is not deleted...
+ if ((!$this->assigned_to) && (!$this->deleted_at)) {
+
+ // The asset status is not archived and is deployable
+ if (($this->assetstatus) && ($this->assetstatus->archived == '0')
+ && ($this->assetstatus->deployable == '1'))
+ {
+
+ return true;
+ }
+
}
return false;
}