Skip to content

A free open source IT asset/license management system

Check that $this->get_depreciation() returns

snipe1e09320ebe68
diff --git a/app/Models/Depreciable.php b/app/Models/Depreciable.php
index 9bbf4fcbf8..cfc42aa945 100644
--- a/app/Models/Depreciable.php
+++ b/app/Models/Depreciable.php
@@ -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'
{
- 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);
} else {
return null;