mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Fixed #7003 - crash when warranty months or purchase date is null
This commit is contained in:
parent
486c708911
commit
23fa5d0bf4
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue