mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 22:07:29 -08:00
Refactored numRemaining, removed unnecessary numCheckout
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
46e3e8a3dd
commit
dceb77d4d4
|
@ -327,20 +327,6 @@ class Accessory extends SnipeModel
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check how many items within an accessory are checked out
|
|
||||||
*
|
|
||||||
* @author [A. Gianotto] [<snipe@snipe.net>]
|
|
||||||
* @since [v5.0]
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function numCheckedOut()
|
|
||||||
{
|
|
||||||
$checkedout = 0;
|
|
||||||
$checkedout = $this->users->count();
|
|
||||||
|
|
||||||
return $checkedout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check how many items of an accessory remain
|
* Check how many items of an accessory remain
|
||||||
|
@ -351,11 +337,11 @@ class Accessory extends SnipeModel
|
||||||
*/
|
*/
|
||||||
public function numRemaining()
|
public function numRemaining()
|
||||||
{
|
{
|
||||||
$checkedout = $this->users->count();
|
$checkedout = $this->users_count;
|
||||||
$total = $this->qty;
|
$total = $this->qty;
|
||||||
$remaining = $total - $checkedout;
|
$remaining = $total - $checkedout;
|
||||||
|
|
||||||
return $remaining;
|
return (int) $remaining;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue