Merge pull request #12668 from inietov/fixes/undefined_array_key_0

Fixed ErrorException: Undefined array key 0 [sc-20424]
This commit is contained in:
snipe 2023-03-14 17:10:04 -07:00 committed by GitHub
commit 4c66267f3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1024,7 +1024,11 @@ class ReportsController extends Controller
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];
$logItem_res = $assetItem->checkouts()->where('created_at', '=', $acceptance->created_at)->get();
if ($logItem_res->isEmpty()){
return redirect()->route('reports/unaccepted_assets')->with('error', trans('general.bad_data'));
}
$logItem = $logItem_res[0];
}
if(!$assetItem->assignedTo->locale){