mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
make super safe
This commit is contained in:
parent
31516d7f24
commit
d6e266cec1
|
@ -358,7 +358,11 @@ class BulkAssetsController extends Controller
|
||||||
* to someone/something.
|
* to someone/something.
|
||||||
*/
|
*/
|
||||||
if ($request->filled('status_id')) {
|
if ($request->filled('status_id')) {
|
||||||
$updated_status = Statuslabel::find($request->input('status_id'));
|
try {
|
||||||
|
$updated_status = Statuslabel::findOrFail($request->input('status_id'));
|
||||||
|
} catch (ModelNotFoundException $e) {
|
||||||
|
return redirect($bulk_back_url)->with('error', trans('admin/statuslabels/message.does_not_exist'));
|
||||||
|
}
|
||||||
|
|
||||||
// We cannot assign a non-deployable status type if the asset is already assigned.
|
// We cannot assign a non-deployable status type if the asset is already assigned.
|
||||||
// This could probably be added to a form request.
|
// This could probably be added to a form request.
|
||||||
|
@ -366,7 +370,7 @@ class BulkAssetsController extends Controller
|
||||||
// Otherwise we need to make sure the status type is still a deployable one.
|
// Otherwise we need to make sure the status type is still a deployable one.
|
||||||
if (
|
if (
|
||||||
($asset->assigned_to == '')
|
($asset->assigned_to == '')
|
||||||
|| ($updated_status->deployable == '1') && ($asset->assetstatus->deployable == '1')
|
|| ($updated_status->deployable == '1') && ($asset->assetstatus?->deployable == '1')
|
||||||
) {
|
) {
|
||||||
$this->update_array['status_id'] = $updated_status->id;
|
$this->update_array['status_id'] = $updated_status->id;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue