mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Add ability to checkout an asset if the user it’s assigned_to isn’t valid
This would only happen if a merge-users went wonky
This commit is contained in:
parent
adf64361e8
commit
30d68309a9
|
@ -232,7 +232,10 @@ class Asset extends Depreciable
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines if an asset is available for checkout
|
* Determines if an asset is available for checkout.
|
||||||
|
* This checks to see if the it's checked out to an invalid (deleted) user
|
||||||
|
* OR if the assigned_to and deleted_at fields on the asset are empty AND
|
||||||
|
* that the status is deployable
|
||||||
*
|
*
|
||||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
* @author [A. Gianotto] [<snipe@snipe.net>]
|
||||||
* @since [v3.0]
|
* @since [v3.0]
|
||||||
|
@ -241,9 +244,10 @@ class Asset extends Depreciable
|
||||||
public function availableForCheckout()
|
public function availableForCheckout()
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
(empty($this->assigned_to)) &&
|
(!$this->assignedTo) ||
|
||||||
|
((empty($this->assigned_to)) &&
|
||||||
(empty($this->deleted_at)) &&
|
(empty($this->deleted_at)) &&
|
||||||
(($this->assetstatus) && ($this->assetstatus->deployable == 1)))
|
(($this->assetstatus) && ($this->assetstatus->deployable == 1))))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -424,7 +428,7 @@ class Asset extends Depreciable
|
||||||
*/
|
*/
|
||||||
public function assignedTo()
|
public function assignedTo()
|
||||||
{
|
{
|
||||||
return $this->morphTo('assigned', 'assigned_type', 'assigned_to');
|
return $this->morphTo('assigned', 'assigned_type', 'assigned_to')->withTrashed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue