When editing an existing patron restriction type you'll always get an error on saving: Label is already in use Of course the label is already in use... for the restriction type I am just editing. To test: * Activate use of patron restriction types * Edit any of the system types * Save --> Notice error :(
Is this on a specific version, Katrin? I can't replicate it here
I was testing on master yesterday - I'll repeat the test now.
Hm, I still have the issue, git pulled master, restart_all and in a new private window. Edit MANUAL Change nothing Try to save > Error
Quick guess: Maybe the one you edit shouldn't be in the list of existing ones? <script> var MSG_DUPLICATE_CODE = _("Restriction code is already in use"); var MSG_DUPLICATE_DISPLAY_TEXT = _("Label is already in use"); var existing = { DISCHARGE: 'Discharge tkk', MANUAL: 'Manual', OVERDUES: 'Overdues', SUSPENSION: 'Suspension', }; </script> jQuery.validator.addMethod( "restrictionDisplayText", function(value){ var ex = Object.values(existing).map(function(el) { return el.toLowerCase(); }); return (value.length > 0 && ex.indexOf(value.toLowerCase()) > -1) ? false : true; }, MSG_DUPLICATE_DISPLAY_TEXT);
Created attachment 150957 [details] [review] Bug 33578: Fix patron restriction types edition When editing an existing patron restriction type you'll always get an error on saving: Label is already in use To test: * Activate use of patron restriction types * Edit any of the system types * Create new ones
This patch works for the form validation error, but I see something else too: If you open the restriction edit form and submit it without changing anything you'll be returned to the "Patron restrictions" page where there will be a message, " Another restriction already has this label"
Created attachment 150976 [details] [review] Bug 33578: Fix controller when editing a restriction type Do not display a warning when we are editing a restriction type and no other types with this description exists.
(In reply to Jonathan Druart from comment #7) > Created attachment 150976 [details] [review] [review] > Bug 33578: Fix controller when editing a restriction type > > Do not display a warning when we are editing a restriction type and no > other types with this description exists. Still seeing the message that Owen reported.
Created attachment 151478 [details] [review] Bug 33578: Fix patron restriction types edition When editing an existing patron restriction type you'll always get an error on saving: Label is already in use To test: * Activate use of patron restriction types * Edit any of the system types * Create new ones Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Created attachment 151479 [details] [review] Bug 33578: Fix controller when editing a restriction type Do not display a warning when we are editing a restriction type and no other types with this description exists. Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu>
Created attachment 152610 [details] [review] Bug 33578: Fix patron restriction types edition When editing an existing patron restriction type you'll always get an error on saving: Label is already in use To test: * Activate use of patron restriction types * Edit any of the system types * Create new ones Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 152611 [details] [review] Bug 33578: Fix controller when editing a restriction type Do not display a warning when we are editing a restriction type and no other types with this description exists. Signed-off-by: Michaela Sieber <michaela.sieber@kit.edu> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Pushed to master for 23.11. Nice work everyone, thanks!
Thanks for all the hard work! Pushed to 23.05.x for the next release
Nice work everyone! Pushed to 22.11.x for next release