mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Adds default values if the expiring alerts threshold is null
This commit is contained in:
parent
201b52baf8
commit
42d86bf57b
|
@ -665,13 +665,15 @@ class Asset extends Depreciable
|
|||
*/
|
||||
public static function getExpiringWarrantee($days = 30)
|
||||
{
|
||||
$days = (is_null($days)) ? 30 : $days;
|
||||
|
||||
return Asset::where('archived', '=', '0')
|
||||
->whereNotNull('warranty_months')
|
||||
->whereNotNull('purchase_date')
|
||||
->whereNull('deleted_at')
|
||||
->whereRaw(\DB::raw('DATE_ADD(`purchase_date`,INTERVAL `warranty_months` MONTH) <= DATE(NOW() + INTERVAL '
|
||||
. $days
|
||||
. ' DAY) AND DATE_ADD(`purchase_date`,INTERVAL `warranty_months` MONTH) > NOW()'))
|
||||
. ' DAY) AND DATE_ADD(`purchase_date`, INTERVAL `warranty_months` MONTH) > NOW()'))
|
||||
->orderBy('purchase_date', 'ASC')
|
||||
->get();
|
||||
}
|
||||
|
|
|
@ -627,7 +627,8 @@ class License extends Depreciable
|
|||
*/
|
||||
public static function getExpiringLicenses($days = 60)
|
||||
{
|
||||
|
||||
$days = (is_null($days)) ? 30 : $days;
|
||||
|
||||
return License::whereNotNull('expiration_date')
|
||||
->whereNull('deleted_at')
|
||||
->whereRaw(DB::raw('DATE_SUB(`expiration_date`,INTERVAL '.$days.' DAY) <= DATE(NOW()) '))
|
||||
|
|
Loading…
Reference in a new issue