Custom field type of CUSTOM REGEX defaults back to ANY on editing
Debug mode
- [X] I have enabled debug mode
- [X] I have read checked the Common Issues page
Describe the bug
Custom field type of CUSTOM REGEX defaults back to ANY on editing. If you then save the field again without re-selecting "CUSTOM REGEX", the custom format is overwritten by the default value used by ANY.
I'm new to Laravel, but I don't see where in the blade template or the composer it takes into account this->format not being in Helper::PREDEFINED_FORMATS for the select's default value, which appears to map both "ANY" and "CUSTOM REGEX" to the same blank value. I noticed there's a "getFormatType()" function that does return "CUSTOM REGEX" but I don't see where that's referenced anywhere.
This occurs on both the live demo and the current hosted version.
Also see previously submitted issues: #5896 #7074 #8394
Reproduction steps
- Create new custom field.
- Set custom field type to CUSTOM REGEX.
- Add valid custom regex starting with "regex".
- Save custom field.
- Select to edit newly created custom field.
- Note custom field now has type of ANY.
- Save custom field.
- Select to edit custom field again.
- Change type from ANY to CUSTOM REGEX.
- Note custom format is now missing. ...
Expected behavior
Editing a custom field with custom regex should not default back to type of ANY.
Screenshots
No response
Snipe-IT Version
6.0.9
Operating System
Linux
Web Server
Whatever the demo uses
PHP Version
Whatever the demo uses
Operating System
No response
Browser
No response
Version
No response
Device
No response
Operating System
No response
Browser
No response
Version
No response
Error messages
No response
Additional context
No response