diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 68f12af20f..dbff25e8d8 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -1068,8 +1068,10 @@ class Asset extends Depreciable public function scopeDueOrOverdueForAudit($query, $settings) { + $interval = $settings->audit_warning_days ?? 0; + return $query->whereNotNull('assets.next_audit_date') - ->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) ->NotArchived(); } diff --git a/routes/web/hardware.php b/routes/web/hardware.php index 495b08086e..1eeed11ccf 100644 --- a/routes/web/hardware.php +++ b/routes/web/hardware.php @@ -31,12 +31,12 @@ Route::group( Route::get('audit/due', [ 'as' => 'assets.audit.due', - 'uses' => 'AssetsController@dueForAudit' + 'uses' => 'Assets\AssetsController@dueForAudit' ]); Route::get('audit/overdue', [ 'as' => 'assets.audit.overdue', - 'uses' => 'AssetsController@overdueForAudit' + 'uses' => 'Assets\AssetsController@overdueForAudit' ]); Route::get('audit/{id}', [