A free open source IT asset/license management system
Added check for purchase date
snipeadf58a06da86
diff --git a/app/Models/Depreciable.php b/app/Models/Depreciable.phpindex 7211358739..6139cda089 100644--- a/app/Models/Depreciable.php+++ b/app/Models/Depreciable.php@@ -158,17 +158,20 @@ class Depreciable extends SnipeModelpublic function time_until_depreciated(){- // @link http://www.php.net/manual/en/class.datetime.php- $d1 = new \DateTime();- $d2 = $this->depreciated_date();-- // @link http://www.php.net/manual/en/class.dateinterval.php- $interval = $d1->diff($d2);- if (! $interval->invert) {- return $interval;- } else {- return new \DateInterval('PT0S'); //null interval (zero seconds from now)+ if ($this->depreciated_date()) {+ // @link http://www.php.net/manual/en/class.datetime.php+ $d1 = new \DateTime();+ $d2 = $this->depreciated_date();++ // @link http://www.php.net/manual/en/class.dateinterval.php+ $interval = $d1->diff($d2);+ if (! $interval->invert) {+ return $interval;+ } else {+ return new \DateInterval('PT0S'); //null interval (zero seconds from now)+ }}+ return false;}public function depreciated_date()