mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
Check that $this->get_depreciation() returns
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
ee36497acf
commit
1e09320ebe
|
@ -68,7 +68,7 @@ class Depreciable extends SnipeModel
|
||||||
*/
|
*/
|
||||||
public function getLinearDepreciatedValue() // TODO - for testing it might be nice to have an optional $relative_to param here, defaulted to 'now'
|
public function getLinearDepreciatedValue() // TODO - for testing it might be nice to have an optional $relative_to param here, defaulted to 'now'
|
||||||
{
|
{
|
||||||
if ($this->purchase_date) {
|
if (($this->get_depreciation()) && ($this->purchase_date)) {
|
||||||
$months_passed = ($this->purchase_date->diff(now())->m)+($this->purchase_date->diff(now())->y*12);
|
$months_passed = ($this->purchase_date->diff(now())->m)+($this->purchase_date->diff(now())->y*12);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in a new issue