Discussion:
[Koha-bugs] [Bug 21861] New: The MARC modification template actions editor does not always validate user input
b***@bugs.koha-community.org
2018-11-19 11:36:07 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Bug ID: 21861
Summary: The MARC modification template actions editor does not
always validate user input
Change sponsored?: ---
Product: Koha
Version: master
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5 - low
Component: Tools
Assignee: koha-***@lists.koha-community.org
Reporter: ***@gmail.com
QA Contact: ***@bugs.koha-community.org

When editing a MARC modification template action, you have the option
of adding a conditional clause ("if/unless") to the action you want to
perform. The conditional clause can be further fine-tuned by selecting
one of four comparison operators ("exists/doesn't exist/matches/doesn't
match") from a drop-down list.

There are currently four issues when adding such a clause, namely:

1) When you pick a condition (e.g. "unless") and click on 'Add action'
or 'Update action', the jQuery function that validates your input
does not check whether you have actually filled in a value for the
MARC field (mandatory) or the comparison operator (mandatory).

2) If you pick "matches" or "doesn't match" as a comparison operator,
the textbox next to the operator can be left blank when saving the
modification action (the textbox _should_ have a value because the
operator is meaningless without it).

3) If you check the "RegEx" checkbox and then enter a value in the
relevant textbox, when you Add/Update the action the "Action"
column in the actions table will display extra spaces between the
regex pattern and its delimiters.

4) If you check the "RegEx" checkbox and then enter a value in the
relevant textbox, when you later edit that modification action
the "m/ /" characters surrounding the regex textbox are not shown
anymore.
--
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-19 11:37:22 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Andreas Roussos <***@gmail.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|koha-***@lists.koha-commun |***@gmail.com
|ity.org |
--
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-19 12:31:08 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Andreas Roussos <***@gmail.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Patch complexity|--- |Medium patch
Status|ASSIGNED |Needs Signoff
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-19 12:31:11 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

--- Comment #1 from Andreas Roussos <***@gmail.com> ---
Created attachment 82482
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82482&action=edit
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.
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-20 06:34:40 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

paxed <***@joensuu.fi> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|Needs Signoff |Signed Off
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-20 06:34:46 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

paxed <***@joensuu.fi> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #82482|0 |1
is obsolete| |

--- Comment #2 from paxed <***@joensuu.fi> ---
Created attachment 82528
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82528&action=edit
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.
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-21 15:30:07 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Marcel de Rooy <***@rijksmuseum.nl> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@rijksmuseum.nl

--- Comment #3 from Marcel de Rooy <***@rijksmuseum.nl> ---
+ document.getElementById('conditional_regex').onchange();

Please correct.
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-21 15:39:24 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

--- Comment #4 from Marcel de Rooy <***@rijksmuseum.nl> ---
(In reply to Marcel de Rooy from comment #3)
Post by b***@bugs.koha-community.org
+ document.getElementById('conditional_regex').onchange();
Please correct.
Probably needs a dep tree when rebasing..
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-22 14:04:14 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Andreas Roussos <***@gmail.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|Signed Off |Needs Signoff
Depends on| |21867


Referenced Bugs:

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21867
[Bug 21867] Replace remaining document.element.onchange calls in
marc_modification_templates.js
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-22 14:04:19 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

--- Comment #5 from Andreas Roussos <***@gmail.com> ---
Created attachment 82581
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82581&action=edit
Bug 21861: (follow-up) replace onchange() with jQuery equivalent
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-26 13:21:52 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Marcel de Rooy <***@rijksmuseum.nl> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|Needs Signoff |Signed Off
Patch complexity|Medium patch |Small patch
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-26 13:21:56 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Marcel de Rooy <***@rijksmuseum.nl> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #82528|0 |1
is obsolete| |

--- Comment #6 from Marcel de Rooy <***@rijksmuseum.nl> ---
Created attachment 82641
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82641&action=edit
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 <***@rijksmuseum.nl>
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-26 13:22:35 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Marcel de Rooy <***@rijksmuseum.nl> changed:

What |Removed |Added
----------------------------------------------------------------------------
Attachment #82581|0 |1
is obsolete| |

--- Comment #7 from Marcel de Rooy <***@rijksmuseum.nl> ---
Created attachment 82642
-->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=82642&action=edit
Bug 21861: (follow-up) replace onchange() with jQuery equivalent

Signed-off-by: Marcel de Rooy <***@rijksmuseum.nl>
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-26 13:22:57 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

--- Comment #8 from Marcel de Rooy <***@rijksmuseum.nl> ---
String changes, heading for 19.05 ;)
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-26 13:23:40 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

--- Comment #9 from Marcel de Rooy <***@rijksmuseum.nl> ---
(In reply to paxed from comment #2)
You forgot a signoff line..
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-26 19:54:07 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Josef Moravec <***@gmail.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@gmail.com
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-29 11:27:23 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Marcel de Rooy <***@rijksmuseum.nl> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|Signed Off |Passed QA
QA Contact|***@bugs.koha-communit |***@rijksmuseum.nl
|y.org |

--- Comment #10 from Marcel de Rooy <***@rijksmuseum.nl> ---
Moving to PQA now since paxed also tested (see above)
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-11-29 19:16:01 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Nick Clemens <***@bywatersolutions.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |***@bywatersolutions.com
Status|Passed QA |Pushed to Master

--- Comment #11 from Nick Clemens <***@bywatersolutions.com> ---
Awesome work everyone!

Pushed to master for 19.05
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
b***@bugs.koha-community.org
2018-12-10 09:48:02 UTC
Permalink
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21861

Martin Renvoize <***@ptfs-europe.com> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|Pushed to Master |Pushed to Stable
CC| |***@ptfs-europe
| |.com

--- Comment #12 from Martin Renvoize <***@ptfs-europe.com> ---
Pushed to 18.11.x for 18.11.01
--
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-***@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/
Loading...