Fixes error 500 if checkout_acceptances table have a created_at null column

This commit is contained in:
Ivan Nieto Vivanco 2022-08-17 22:02:13 -05:00
parent 40bc13a946
commit e5cc6ec972

View file

@ -1006,7 +1006,11 @@ class ReportsController extends Controller
}
$assetItem = $acceptance->checkoutable;
$logItem = $assetItem->checkouts()->where('created_at', '=', $acceptance->created_at)->get()[0];
if (is_null($acceptance->created_at)){
return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.bad_data'));
} else {
$logItem = $assetItem->checkouts()->where('created_at', '=', $acceptance->created_at)->get()[0];
}
if(!$assetItem->assignedTo->locale){
Notification::locale(Setting::getSettings()->locale)->send(