stable

Clone or download

Read-only

request #27171 Clear default values when form element is changed from a multiple list to a simple list

Since type change is only available for list fields, I took the opportunity to rename FormElementTypeUpdater to ListFormElementTypeUpdater. Moreover, I have extracted the treatment related to the actual type change from Tracker_FormElementFactory and place the code into ListFormElementTypeUpdater. The factory had nothing to do with types change in the first place, and was the one to do the job instead of the dedicated class (feature envy). How to test: - Pick up a tracker having a multiple list field (checkbox/multiple selectbox) - define several default values - save - Now change its type to a simple list field (radio button/selectbox) --> There is now a simple <select> instead of a multiple select to define default value --> It has no default value anymore Change-Id: I42e66ae899477b4ac7f211aa5d17f95a4254c3df

Modified Files

Name
A plugins/tracker/include/Tracker/FormElement/FormElementTypeCannotBeChangedException.php +33 −0 Go to diff View file
R plugins/tracker/include/Tracker/FormElement/FormElementTypeUpdater.php Go to diff View file
M plugins/tracker/include/Tracker/FormElement/Tracker_FormElement.php +5 −16 Go to diff View file
M plugins/tracker/include/Tracker/FormElement/Tracker_FormElementFactory.php +5 −19 Go to diff View file
M plugins/tracker/include/Tracker/FormElement/Tracker_FormElement_Field_List.php +33 −1 Go to diff View file
D plugins/tracker/tests/unit/Tracker/FormElement/FormElementTypeUpdaterTest.php +0 −172 Go to diff View file
A plugins/tracker/tests/unit/Tracker/FormElement/ListFormElementTypeUpdaterTest.php +295 −0 Go to diff View file