Bug 21861: The MARC modification template actions editor does not always validate...
authorAndreas Roussos <arouss1980@gmail.com>
Sat, 17 Nov 2018 18:03:36 +0000 (20:03 +0200)
committerLucas Gass <lucas@bywatersolutions.com>
Fri, 14 Dec 2018 17:47:30 +0000 (17:47 +0000)
commit4baf83a09a2c1ae8c9def18c967eb256564ef719
tree54a1825658b2302fc296541d8a3cf1e3f1ba1b61
parent82a55e971c74bd3c7e16a2e372fcfcdecdb62489
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>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 3e1e1448e9132dce81571a4c3f31eb67816f14f9)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit a616b9fc0266fdc9a5d299d5927f8b4a2236c559)

Conflicts:
koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt
koha-tmpl/intranet-tmpl/prog/js/marc_modification_templates.js