diff --git a/app/Http/Controllers/AssetModelsController.php b/app/Http/Controllers/AssetModelsController.php index 1e5d5547e3..74ac57f296 100755 --- a/app/Http/Controllers/AssetModelsController.php +++ b/app/Http/Controllers/AssetModelsController.php @@ -155,7 +155,6 @@ class AssetModelsController extends Controller $model->requestable = $request->input('requestable', '0'); - $this->removeCustomFieldsDefaultValues($model); if ($request->input('custom_fieldset')=='') { @@ -464,8 +463,7 @@ class AssetModelsController extends Controller foreach ($defaultValues as $customFieldId => $defaultValue) { if(is_array($defaultValue)){ $model->defaultValues()->attach($customFieldId, ['default_value' => implode(',', $defaultValue)]); - } - if ($defaultValue) { + }elseif ($defaultValue) { $model->defaultValues()->attach($customFieldId, ['default_value' => $defaultValue]); } } diff --git a/resources/assets/js/components/forms/asset-models/fieldset-default-values.vue b/resources/assets/js/components/forms/asset-models/fieldset-default-values.vue index c84fa36c89..96eec2c9a0 100644 --- a/resources/assets/js/components/forms/asset-models/fieldset-default-values.vue +++ b/resources/assets/js/components/forms/asset-models/fieldset-default-values.vue @@ -47,7 +47,7 @@
- +
{$field->db_column_name()})) ? ' checked="checked"' : '') : (Request::old($field->db_column_name()) != '' ? ' checked="checked"' : '') }}> + {$field->db_column_name()})) ? ' checked="checked"' : '') : (Request::old($field->db_column_name()) != '' ? ' checked="checked"' : (in_array($key, explode(',', $field->defaultValue($model->id))) ? ' checked="checked"' : '')) }}> {{ $value }}