Merge pull request #10527 from inietov/fixes/pdo_exception_syntax_error_when_sendexpirationalers_is_called

Fixes PDO exeception syntax error when Expiring Alerts Threshold is not set
This commit is contained in:
snipe 2022-01-18 12:43:08 -08:00 committed by GitHub
commit f9647614ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 1 deletions

View file

@ -665,13 +665,15 @@ class Asset extends Depreciable
*/ */
public static function getExpiringWarrantee($days = 30) public static function getExpiringWarrantee($days = 30)
{ {
$days = (is_null($days)) ? 30 : $days;
return Asset::where('archived', '=', '0') return Asset::where('archived', '=', '0')
->whereNotNull('warranty_months') ->whereNotNull('warranty_months')
->whereNotNull('purchase_date') ->whereNotNull('purchase_date')
->whereNull('deleted_at') ->whereNull('deleted_at')
->whereRaw(\DB::raw('DATE_ADD(`purchase_date`,INTERVAL `warranty_months` MONTH) <= DATE(NOW() + INTERVAL ' ->whereRaw(\DB::raw('DATE_ADD(`purchase_date`,INTERVAL `warranty_months` MONTH) <= DATE(NOW() + INTERVAL '
. $days . $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') ->orderBy('purchase_date', 'ASC')
->get(); ->get();
} }

View file

@ -627,6 +627,7 @@ class License extends Depreciable
*/ */
public static function getExpiringLicenses($days = 60) public static function getExpiringLicenses($days = 60)
{ {
$days = (is_null($days)) ? 60 : $days;
return License::whereNotNull('expiration_date') return License::whereNotNull('expiration_date')
->whereNull('deleted_at') ->whereNull('deleted_at')