Merge pull request #11489 from Godmartinz/bug/sc-19333/expiring-assets-report-email-content-ordering

Fixed the order expiring assets are listed in notifications
This commit is contained in:
snipe 2022-08-29 12:37:01 -07:00 committed by GitHub
commit 7fa9214beb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -695,15 +695,15 @@ class Asset extends Depreciable
public static function getExpiringWarrantee($days = 30)
{
$days = (is_null($days)) ? 30 : $days;
return self::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 '
->whereRaw('DATE_ADD(`purchase_date`,INTERVAL `warranty_months` MONTH) <= DATE(NOW() + INTERVAL '
. $days
. ' DAY) AND DATE_ADD(`purchase_date`, INTERVAL `warranty_months` MONTH) > NOW()'))
->orderBy('purchase_date', 'ASC')
. ' DAY) AND DATE_ADD(`purchase_date`, INTERVAL `warranty_months` MONTH) > NOW()')
->orderByRaw('DATE_ADD(`purchase_date`,INTERVAL `warranty_months` MONTH)')
->get();
}