Fixed #7003 - crash when warranty months or purchase date is null

This commit is contained in:
snipe 2019-05-07 15:33:57 -04:00
parent 486c708911
commit 23fa5d0bf4

View file

@ -492,9 +492,13 @@ class AssetPresenter extends Presenter
*/
public function warrantee_expires()
{
$date = date_create($this->purchase_date);
date_add($date, date_interval_create_from_date_string($this->warranty_months . ' months'));
return date_format($date, 'Y-m-d');
if (($this->purchase_date) && ($this->warranty_months)) {
$date = date_create($this->purchase_date);
date_add($date, date_interval_create_from_date_string($this->warranty_months . ' months'));
return date_format($date, 'Y-m-d');
}
return false;
}
/**