Skip to content

A free open source IT asset/license management system

wip

slong753815c77f9436b
diff --git a/app/Http/Controllers/Assets/BulkAssetsController.php b/app/Http/Controllers/Assets/BulkAssetsController.php
index 24712da278..1e1e765ea1 100644
--- a/app/Http/Controllers/Assets/BulkAssetsController.php
+++ b/app/Http/Controllers/Assets/BulkAssetsController.php
@@ -223,7 +223,7 @@ class BulkAssetsController extends Controller
$asset->save();
}
if (!$asset->save()) {
- $error_bag[] = $asset->getErrors();
+ $error_bag[] = $asset->getErrors()->toArray();
}
}
} else {
@@ -231,14 +231,18 @@ class BulkAssetsController extends Controller
}
} // endforeach ($assets)
if(!empty($error_bag)) {
- $ids = array_values($assets);
- // dd($ids);
- // return redirect()->back()
- // ->withInput(["ids" => $ids, "bulk_actions" => "edit"])
- // ->with('error_messages', $error_bag);
- // return $error_bag;
-
- return redirect($bulk_back_url)->with('error_messages', $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;
+ }
+ }
+ ray($errors);
+ return redirect($bulk_back_url)->with('bulk_errors', $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 0935c28582..4599577a1b 100755
--- a/resources/views/notifications.blade.php
+++ b/resources/views/notifications.blade.php
@@ -115,6 +115,21 @@
@endif
+@if ($messages = Session::get('bulk_errors'))
+<div class="col-md-12">
+ <div class="alert alert alert-danger fade in">
+ <button type="button" class="close" data-dismiss="alert">&times;</button>
+ <i class="fas fa-exclamation-triangle faa-pulse animated"></i>
+ <strong>{{ trans('general.notification_error') }} </strong>
+ The following fields had validation errors and were not edited:
+ @foreach($messages as $message => $value)
+ <br> {{ $value. }}
+ @endforeach
+ </div>
+</div>
+@endif
+
+
@if ($message = Session::get('warning'))
<div class="col-md-12">
<div class="alert alert-warning fade in">