mirror of
https://github.com/snipe/snipe-it.git
synced 2025-02-21 03:15:45 -08:00
Fixes format property on invalid custom field object
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
7a1ab1292c
commit
884b6b0270
|
@ -178,20 +178,25 @@ class CustomFieldsController extends Controller
|
||||||
*/
|
*/
|
||||||
public function edit($id)
|
public function edit($id)
|
||||||
{
|
{
|
||||||
$field = CustomField::find($id);
|
if ($field = CustomField::find($id)) {
|
||||||
|
|
||||||
$this->authorize('update', $field);
|
$this->authorize('update', $field);
|
||||||
|
|
||||||
$customFormat = '';
|
$customFormat = '';
|
||||||
if((stripos($field->format, 'regex') === 0) && ($field->format !== CustomField::PREDEFINED_FORMATS['MAC'])) {
|
if((stripos($field->format, 'regex') === 0) && ($field->format !== CustomField::PREDEFINED_FORMATS['MAC'])) {
|
||||||
$customFormat = $field->format;
|
$customFormat = $field->format;
|
||||||
}
|
}
|
||||||
|
|
||||||
return view("custom_fields.fields.edit",[
|
return view("custom_fields.fields.edit",[
|
||||||
'field' => $field,
|
'field' => $field,
|
||||||
'customFormat' => $customFormat,
|
'customFormat' => $customFormat,
|
||||||
'predefinedFormats' => Helper::predefined_formats()
|
'predefinedFormats' => Helper::predefined_formats()
|
||||||
]);
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return redirect()->route("fields.index")
|
||||||
|
->with("error", trans('admin/custom_fields/message.field.invalid'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue