Skip to content

A free open source IT asset/license management system

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

snipe3a1b43223482
diff --git a/app/Http/Controllers/CustomFieldsController.php b/app/Http/Controllers/CustomFieldsController.php
index d73f544af4..9b74c040d1 100644
--- a/app/Http/Controllers/CustomFieldsController.php
+++ b/app/Http/Controllers/CustomFieldsController.php
@@ -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'));
}
diff --git a/app/Models/CustomField.php b/app/Models/CustomField.php
index c59483dcc6..ad9a2ab36a 100644
--- a/app/Models/CustomField.php
+++ b/app/Models/CustomField.php
@@ -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
diff --git a/resources/views/custom_fields/fields/edit.blade.php b/resources/views/custom_fields/fields/edit.blade.php
index 282328b5a1..ea33cd2f07 100644
--- a/resources/views/custom_fields/fields/edit.blade.php
+++ b/resources/views/custom_fields/fields/edit.blade.php
@@ -102,19 +102,21 @@
</div>
</div>
+ <!-- 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" 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>
+
+ </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"' : '' }}>
- {{ trans('admin/custom_fields/general.show_in_email') }}
- </label>
- </div>
- </div>
<!-- Encrypted -->