diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.php index c291a7fad0..67bb3a8076 100644 --- a/app/Http/Controllers/Assets/BulkAssetsController.php +++ b/app/Http/Controllers/Assets/BulkAssetsController.php @@ -253,23 +253,29 @@ class BulkAssetsController extends Controller Asset::find($assetId)->update($this->update_array); } } // endforeach ($assets) - ray($error_bag); + ray(['error_bag1' => $error_bag]); if(!empty($error_bag)) { // $errors = collect($error_bag)->unique(); // foreach ($errors as $key => $value) { // ray($value->message); // } $errors = []; - foreach ($error_bag as $key => $value) { - foreach($value as $key => $value) { - $errors[] = $value; + //find the customfield name from the name of the messagebag items + foreach ($error_bag as $key => $bag) { + ray($bag->keys()); + foreach($bag->keys() as $key => $value) { + CustomField::where('db_column', $value)->get()->map(function($item) use (&$errors) { + $errors[] = $item->name; + }); } - } - ray($error_bag); - Session::save('ids', $assets); + } + ray(['error_bag2' => $errors]); + + // Session::save('ids', $assets); + // return redirect()->route('hardware/bulkedit'); - return redirect()->back()->with('bulk_errors', $errors); + return redirect($bulk_back_url)->with('bulk_errors', array_unique($errors)); } return redirect($bulk_back_url)->with('success', trans('admin/hardware/message.update.success')); } diff --git a/resources/views/notifications.blade.php b/resources/views/notifications.blade.php index 26f432c3d9..b0630f8583 100755 --- a/resources/views/notifications.blade.php +++ b/resources/views/notifications.blade.php @@ -115,19 +115,19 @@ @endif -{{-- @if ($messages = Session::get('bulk_errors')) +@if ($messages = Session::get('bulk_errors'))
{{ trans('general.notification_error') }} The following fields had validation errors and were not edited: - @foreach($messages as $message => $value) -
{{ $value. }} + @foreach($messages as $message) +
{{ $message }} @endforeach
-@endif --}} +@endif @if ($message = Session::get('warning'))