Description
Andreas Roussos
2018-11-19 11:36:07 UTC
Created attachment 82482 [details] [review] Bug 21861: The MARC modification template actions editor does not always validate user input The MARC modification template actions editor does not validate user input when adding a conditional clause, making it possible to save a modification action without filling in all necessary fields. This patch fixes that. Test plan: 1) Create a MARC modification template and add a new action, e.g. "Copy All field(s) 200$a to field 600$a". Add a condition ("if" or "unless") but leave the relevant field and subfield textboxes empty. Add "matches" or "doesn't match" as a comparison operator. Check the "RegEx" checkbox, leave the regex textbox empty. 2) Click on "Add action" and notice how it accepts your input. Also notice the extra space in the Action column RegEx. 3) Edit your modification action and notice the missing "m/" before the conditional RegEx. 4) Apply the patch and hit CTRL-F5 to reload the relevant JS. 5) Edit the modification action you added previously (or add a new one). Try leaving the textboxes mentioned above empty and then submit your changes. You should get pop-up windows informing you about missing fields. 6) Now try typing a value in the conditional regex textbox and Update your action. In the Action column, there should be no spaces between the delimiters of the matching operator and the value you just entered. 7) Edit your action: notice how the "m/" before the regular expression and the "/" after it are now showing correctly. Created attachment 82528 [details] [review] Bug 21861: The MARC modification template actions editor does not always validate user input The MARC modification template actions editor does not validate user input when adding a conditional clause, making it possible to save a modification action without filling in all necessary fields. This patch fixes that. Test plan: 1) Create a MARC modification template and add a new action, e.g. "Copy All field(s) 200$a to field 600$a". Add a condition ("if" or "unless") but leave the relevant field and subfield textboxes empty. Add "matches" or "doesn't match" as a comparison operator. Check the "RegEx" checkbox, leave the regex textbox empty. 2) Click on "Add action" and notice how it accepts your input. Also notice the extra space in the Action column RegEx. 3) Edit your modification action and notice the missing "m/" before the conditional RegEx. 4) Apply the patch and hit CTRL-F5 to reload the relevant JS. 5) Edit the modification action you added previously (or add a new one). Try leaving the textboxes mentioned above empty and then submit your changes. You should get pop-up windows informing you about missing fields. 6) Now try typing a value in the conditional regex textbox and Update your action. In the Action column, there should be no spaces between the delimiters of the matching operator and the value you just entered. 7) Edit your action: notice how the "m/" before the regular expression and the "/" after it are now showing correctly. + document.getElementById('conditional_regex').onchange(); Please correct. (In reply to Marcel de Rooy from comment #3) > + document.getElementById('conditional_regex').onchange(); > > Please correct. Probably needs a dep tree when rebasing.. Created attachment 82581 [details] [review] Bug 21861: (follow-up) replace onchange() with jQuery equivalent Created attachment 82641 [details] [review] Bug 21861: The MARC modification template actions editor does not always validate user input The MARC modification template actions editor does not validate user input when adding a conditional clause, making it possible to save a modification action without filling in all necessary fields. This patch fixes that. Test plan: 1) Create a MARC modification template and add a new action, e.g. "Copy All field(s) 200$a to field 600$a". Add a condition ("if" or "unless") but leave the relevant field and subfield textboxes empty. Add "matches" or "doesn't match" as a comparison operator. Check the "RegEx" checkbox, leave the regex textbox empty. 2) Click on "Add action" and notice how it accepts your input. Also notice the extra space in the Action column RegEx. 3) Edit your modification action and notice the missing "m/" before the conditional RegEx. 4) Apply the patch and hit CTRL-F5 to reload the relevant JS. 5) Edit the modification action you added previously (or add a new one). Try leaving the textboxes mentioned above empty and then submit your changes. You should get pop-up windows informing you about missing fields. 6) Now try typing a value in the conditional regex textbox and Update your action. In the Action column, there should be no spaces between the delimiters of the matching operator and the value you just entered. 7) Edit your action: notice how the "m/" before the regular expression and the "/" after it are now showing correctly. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Created attachment 82642 [details] [review] Bug 21861: (follow-up) replace onchange() with jQuery equivalent Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> String changes, heading for 19.05 ;) (In reply to paxed from comment #2) You forgot a signoff line.. Moving to PQA now since paxed also tested (see above) Awesome work everyone! Pushed to master for 19.05 Pushed to 18.11.x for 18.11.01 backported to 18.05 for 18.05.07 Pushed to 17.11.x for 17.11.13 |