Simplified availableForCheckout() on asset

This commit is contained in:
snipe
2021-01-26 22:12:24 -08:00
parent 8e17818f1e
commit 9f7f1460e9
+12 -7
View File
@@ -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;
}