Merge pull request #14690 from marcusmoore/import-settings-properly

Load settings in `SendUpcomingAuditReport` command
This commit is contained in:
snipe 2024-05-07 07:42:34 +01:00 committed by GitHub
commit fd929f5dd9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -43,12 +43,11 @@ class SendUpcomingAuditReport extends Command
*/
public function handle()
{
$settings = Setting::getSettings();
$interval = $settings->audit_warning_days ?? 0;
$today = Carbon::now();
$interval_date = $today->copy()->addDays($interval);
$settings = Setting::getSettings();
$assets = Asset::whereNull('deleted_at')->DueOrOverdueForAudit($settings)->orderBy('assets.next_audit_date', 'desc')->get();
$this->info($assets->count().' assets must be audited in on or before '.$interval_date.' is deadline');