mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Fixed an error on audit due list when no audit_warning_days had been set [ch9764]
This commit is contained in:
parent
a73fd24695
commit
dd40ddf5a5
|
@ -821,9 +821,11 @@ class Asset extends Depreciable
|
||||||
|
|
||||||
public function scopeDueForAudit($query, $settings)
|
public function scopeDueForAudit($query, $settings)
|
||||||
{
|
{
|
||||||
|
$interval = $settings->audit_warning_days ?? 0;
|
||||||
|
|
||||||
return $query->whereNotNull('assets.next_audit_date')
|
return $query->whereNotNull('assets.next_audit_date')
|
||||||
->where('assets.next_audit_date', '>=', Carbon::now())
|
->where('assets.next_audit_date', '>=', Carbon::now())
|
||||||
->whereRaw("DATE_SUB(assets.next_audit_date, INTERVAL $settings->audit_warning_days DAY) <= '".Carbon::now()."'")
|
->whereRaw("DATE_SUB(assets.next_audit_date, INTERVAL $interval DAY) <= '".Carbon::now()."'")
|
||||||
->where('assets.archived', '=', 0)
|
->where('assets.archived', '=', 0)
|
||||||
->NotArchived();
|
->NotArchived();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue