Skip to content

A free open source IT asset/license management system

fixes warranty part of expiring alerts query

Godfrey M2bad8c72e4af
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index e11c46197b..422b2dd538 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -950,7 +950,10 @@ class Asset extends Depreciable
})->orWhere(function ($query) use ($days) {
$query->whereNotNull('purchase_date')
->whereNotNull('warranty_months')
- ->whereBetween('purchase_date', [Carbon::now(), Carbon::now()->addMonths('assets.warranty_months')->addDays($days)]);
+ ->whereRaw(
+ 'DATE_ADD(purchase_date, INTERVAL warranty_months MONTH) BETWEEN ? AND ?',
+ [now(), now()->addDays($days)]
+ );
});
})
->orderBy('asset_eol_date', 'ASC')