Fixed #5472 - show_in_email for custom fields missing in edit field UI

This commit is contained in:
snipe 2018-05-03 08:06:28 -07:00
parent 276d2bc866
commit 3a1b432234
3 changed files with 14 additions and 12 deletions

View file

@ -166,13 +166,13 @@ class CustomFieldsController extends Controller
public function update(CustomFieldRequest $request, $id)
{
$field = CustomField::find($id);
$field->name = e($request->get("name"));
$field->element = e($request->get("element"));
$field->field_values = e($request->get("field_values"));
$field->field_encrypted = e($request->get("field_encrypted", 0));
$field->user_id = Auth::user()->id;
$field->help_text = $request->get("help_text");
$field->show_in_email = $request->get("show_in_email", 0);
if (!in_array(Input::get('format'), array_keys(CustomField::$PredefinedFormats))) {
$field->format = e($request->get("custom_format"));
@ -180,7 +180,6 @@ class CustomFieldsController extends Controller
$field->format = e($request->get("format"));
}
if ($field->save()) {
return redirect()->route("fields.index")->with("success", trans('admin/custom_fields/message.field.update.success'));
}

View file

@ -41,7 +41,8 @@ class CustomField extends Model
'format',
'field_values',
'field_encrypted',
'help_text'
'help_text',
'show_in_email',
];
// This is confusing, since it's actually the custom fields table that

View file

@ -102,14 +102,11 @@
</div>
</div>
@if (!$field->id)
<!-- Show in Email -->
<div class="form-group {{ $errors->has('show_in_email') ? ' has-error' : '' }}" id="show_in_email">
<div class="col-md-8 col-md-offset-4">
<label for="field_encrypted">
<input type="checkbox" name="show_in_email"class="minimal"{{ (Input::old('show_in_email') || $field->show_in_email) ? ' checked="checked"' : '' }}>
<input type="checkbox" name="show_in_email" value="1" class="minimal"{{ (Input::old('show_in_email') || $field->show_in_email) ? ' checked="checked"' : '' }}>
{{ trans('admin/custom_fields/general.show_in_email') }}
</label>
</div>
@ -117,6 +114,11 @@
</div>
@if (!$field->id)
<!-- Encrypted -->
<div class="form-group {{ $errors->has('encrypted') ? ' has-error' : '' }}">
<div class="col-md-8 col-md-offset-4">