mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
Only override fieldset_id with custom_fieldset_id if it’s present
This is mostly to support prior versions. I have NFC why we did this in the first place. I’m sure I had a stellar reason, but couldn’t tell you what it is today. Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
e9cb17394c
commit
85712a1960
|
@ -154,7 +154,19 @@ class AssetModelsController extends Controller
|
||||||
$this->authorize('update', AssetModel::class);
|
$this->authorize('update', AssetModel::class);
|
||||||
$assetmodel = AssetModel::findOrFail($id);
|
$assetmodel = AssetModel::findOrFail($id);
|
||||||
$assetmodel->fill($request->all());
|
$assetmodel->fill($request->all());
|
||||||
$assetmodel->fieldset_id = $request->get("custom_fieldset_id");
|
|
||||||
|
/**
|
||||||
|
* Allow custom_fieldset_id to override and populate fieldset_id.
|
||||||
|
* This is stupid, but required for legacy API support.
|
||||||
|
*
|
||||||
|
* I have no idea why we manually overrode that field name
|
||||||
|
* in previous versions. I assume there was a good reason for
|
||||||
|
* it, but I'll be damned if I can think of one. - snipe
|
||||||
|
*/
|
||||||
|
if ($request->filled('custom_fieldset_id')) {
|
||||||
|
$assetmodel->fieldset_id = $request->get("custom_fieldset_id");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($assetmodel->save()) {
|
if ($assetmodel->save()) {
|
||||||
return response()->json(Helper::formatStandardApiResponse('success', $assetmodel, trans('admin/models/message.update.success')));
|
return response()->json(Helper::formatStandardApiResponse('success', $assetmodel, trans('admin/models/message.update.success')));
|
||||||
|
|
Loading…
Reference in a new issue