Merge pull request #13309 from inietov/fixes/checkout_range_doesnt_include_today

Fixed #13300 Custom Asset Report, Checkout date range never includes current day
This commit is contained in:
snipe 2023-07-31 15:04:22 +01:00 committed by GitHub
commit ffb605a37c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -639,10 +639,16 @@ class ReportsController extends Controller
} }
if (($request->filled('created_start')) && ($request->filled('created_end'))) { if (($request->filled('created_start')) && ($request->filled('created_end'))) {
$assets->whereBetween('assets.created_at', [$request->input('created_start'), $request->input('created_end')]); $created_start = \Carbon::parse($request->input('created_start'))->startOfDay();
$created_end = \Carbon::parse($request->input('created_end'))->endOfDay();
$assets->whereBetween('assets.created_at', [$created_start, $created_end]);
} }
if (($request->filled('checkout_date_start')) && ($request->filled('checkout_date_end'))) { if (($request->filled('checkout_date_start')) && ($request->filled('checkout_date_end'))) {
$assets->whereBetween('assets.last_checkout', [$request->input('checkout_date_start'), $request->input('checkout_date_end')]); $checkout_start = \Carbon::parse($request->input('checkout_date_start'))->startOfDay();
$checkout_end = \Carbon::parse($request->input('checkout_date_end'))->endOfDay();
$assets->whereBetween('assets.last_checkout', [$checkout_start, $checkout_end]);
} }
if (($request->filled('expected_checkin_start')) && ($request->filled('expected_checkin_end'))) { if (($request->filled('expected_checkin_start')) && ($request->filled('expected_checkin_end'))) {
@ -650,7 +656,10 @@ class ReportsController extends Controller
} }
if (($request->filled('last_audit_start')) && ($request->filled('last_audit_end'))) { if (($request->filled('last_audit_start')) && ($request->filled('last_audit_end'))) {
$assets->whereBetween('assets.last_audit_date', [$request->input('last_audit_start'), $request->input('last_audit_end')]); $last_audit_start = \Carbon::parse($request->input('last_audit_start'))->startOfDay();
$last_audit_end = \Carbon::parse($request->input('last_audit_end'))->endOfDay();
$assets->whereBetween('assets.last_audit_date', [$last_audit_start, $last_audit_end]);
} }
if (($request->filled('next_audit_start')) && ($request->filled('next_audit_end'))) { if (($request->filled('next_audit_start')) && ($request->filled('next_audit_end'))) {