Skip to content

Commit 9bca591

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 23756ba + b54d222 commit 9bca591

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/Console/Commands/SendExpirationAlerts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function handle()
5353
->filter(fn($item) => !empty($item))
5454
->all();
5555
// Expiring Assets
56-
$assets = Asset::getExpiringWarranteeOrEol($alert_interval);
56+
$assets = Asset::getExpiringWarrantyOrEol($alert_interval);
5757

5858
if ($assets->count() > 0) {
5959
$this->info(trans_choice('mail.assets_warrantee_alert', $assets->count(), ['count' => $assets->count(), 'threshold' => $alert_interval]));

app/Models/Asset.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -823,9 +823,9 @@ public function model()
823823
* @since [v2.0]
824824
* @return mixed
825825
*/
826-
public static function getExpiringWarranteeOrEol($days = 30)
826+
public static function getExpiringWarrantyOrEol($days = 30)
827827
{
828-
828+
829829
return self::where('archived', '=', '0')
830830
->NotArchived()
831831
->whereNull('deleted_at')
@@ -838,10 +838,9 @@ public static function getExpiringWarranteeOrEol($days = 30)
838838
})->orWhere(function ($query) use ($days) {
839839
$query->whereNotNull('purchase_date')
840840
->whereNotNull('warranty_months')
841-
->whereDate('purchase_date', '<=', Carbon::now()->addMonths('assets.warranty_months')->addDays($days));
841+
->whereBetween('purchase_date', [Carbon::now(), Carbon::now()->addMonths('assets.warranty_months')->addDays($days)]);
842842
});
843843
})
844-
845844
->orderBy('asset_eol_date', 'ASC')
846845
->orderBy('purchase_date', 'ASC')
847846
->get();

0 commit comments

Comments
 (0)