Skip to content

A free open source IT asset/license management system

One more query tweak

snipee977771fe447
diff --git a/app/Console/Commands/SendExpirationAlerts.php b/app/Console/Commands/SendExpirationAlerts.php
index 27f2683b41..8beaa1488e 100644
--- a/app/Console/Commands/SendExpirationAlerts.php
+++ b/app/Console/Commands/SendExpirationAlerts.php
@@ -53,7 +53,7 @@ class SendExpirationAlerts extends Command
->filter(fn($item) => !empty($item))
->all();
// Expiring Assets
- $assets = Asset::getExpiringWarranteeOrEol($alert_interval);
+ $assets = Asset::getExpiringWarrantyOrEol($alert_interval);
if ($assets->count() > 0) {
$this->info(trans_choice('mail.assets_warrantee_alert', $assets->count(), ['count' => $assets->count(), 'threshold' => $alert_interval]));
diff --git a/app/Models/Asset.php b/app/Models/Asset.php
index 3caed663cb..e6eb590a48 100644
--- a/app/Models/Asset.php
+++ b/app/Models/Asset.php
@@ -823,9 +823,9 @@ class Asset extends Depreciable
* @since [v2.0]
* @return mixed
*/
- public static function getExpiringWarranteeOrEol($days = 30)
+ public static function getExpiringWarrantyOrEol($days = 30)
{
-
+
return self::where('archived', '=', '0')
->NotArchived()
->whereNull('deleted_at')
@@ -838,10 +838,9 @@ class Asset extends Depreciable
})->orWhere(function ($query) use ($days) {
$query->whereNotNull('purchase_date')
->whereNotNull('warranty_months')
- ->whereDate('purchase_date', '<=', Carbon::now()->addMonths('assets.warranty_months')->addDays($days));
+ ->whereBetween('purchase_date', [Carbon::now(), Carbon::now()->addMonths('assets.warranty_months')->addDays($days)]);
});
})
-
->orderBy('asset_eol_date', 'ASC')
->orderBy('purchase_date', 'ASC')
->get();