Bug 15814 - Templates for MARC modification: Edit action does not work when Description contains '
Summary: Templates for MARC modification: Edit action does not work when Description c...
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Nick Clemens
URL:
Keywords:
Depends on: 8015
Blocks:
  Show dependency treegraph
 
Reported: 2016-02-13 10:41 UTC by Mirko Tietgen
Modified: 2020-06-04 20:32 UTC (History)
9 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.02


Attachments
Bug 15814: Handle correctly MMTA edit button (11.38 KB, patch)
2019-05-30 02:36 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15814: Handle correctly MMTA edit button (11.44 KB, patch)
2019-06-11 17:10 UTC, Mark Tompsett
Details | Diff | Splinter Review
Bug 15814: Add missing filters (2.19 KB, patch)
2019-06-18 01:08 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15814: Handle correctly MMTA edit button (11.49 KB, patch)
2019-06-21 10:50 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 15814: Add missing filters (2.24 KB, patch)
2019-06-21 10:50 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Mirko Tietgen 2016-02-13 10:41:20 UTC
There is an edit button in the tool for MARC template modification for every action of a template.

Expected: click edit for an action, get a form populated with the related values.
Actual result: page is scrolled to "Add new action", fields are empty.
Comment 1 Mirko Tietgen 2016-02-13 11:00:16 UTC
It does work, unless you have ' in the description, which leads to

> SyntaxError: unterminated string literal

in Firebug.
Comment 3 Owen Leonard 2017-11-09 16:22:04 UTC
I'd really like to see this template overhauled to eliminate all the onclicks.
Comment 4 Jonathan Druart 2019-05-30 02:36:50 UTC
Created attachment 90196 [details] [review]
Bug 15814: Handle correctly MMTA edit button

The MARC modification template action edit buton does not correctly
handle variable escaping.
Assigning a JS variable containing the JSON representation of the
hashref will make the processing much more easier.

Test plan:
Create a MARC Modification Template with several actions.
In the description you should use the following characters, to try to
break this patch: \ ' " \n \r
(not sure what we handled \n and \r)
Then edit the action, modify and save again.
Comment 5 Mark Tompsett 2019-06-11 17:10:02 UTC
Created attachment 90511 [details] [review]
Bug 15814: Handle correctly MMTA edit button

The MARC modification template action edit buton does not correctly
handle variable escaping.
Assigning a JS variable containing the JSON representation of the
hashref will make the processing much more easier.

Test plan:
Create a MARC Modification Template with several actions.
In the description you should use the following characters, to try to
break this patch: \ ' " \n \r
(not sure what we handled \n and \r)
Then edit the action, modify and save again.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 6 Martin Renvoize 2019-06-14 11:24:59 UTC
QA Script failures..

I think the first one is valid.. not sure about the second

 FAIL   koha-tmpl/intranet-tmpl/prog/en/modules/tools/marc_modification_templates.tt
   FAIL   filters
                missing_filter at line 166 (                                            <a class="btn btn-default btn-xs edit_action" href="#modaction" data-mmta_id="[% ActionsLoo.mmta_id %]"><i class="fa fa-pencil"></i> Edit</a>)
                missing_filter at line 342 (        var mmtas = [% ActionsLoop.json %])
Comment 7 Jonathan Druart 2019-06-18 01:08:27 UTC
Created attachment 90712 [details] [review]
Bug 15814: Add missing filters
Comment 8 Nick Clemens 2019-06-21 10:50:55 UTC
Created attachment 90891 [details] [review]
Bug 15814: Handle correctly MMTA edit button

The MARC modification template action edit buton does not correctly
handle variable escaping.
Assigning a JS variable containing the JSON representation of the
hashref will make the processing much more easier.

Test plan:
Create a MARC Modification Template with several actions.
In the description you should use the following characters, to try to
break this patch: \ ' " \n \r
(not sure what we handled \n and \r)
Then edit the action, modify and save again.

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 9 Nick Clemens 2019-06-21 10:50:57 UTC
Created attachment 90892 [details] [review]
Bug 15814: Add missing filters

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Martin Renvoize 2019-06-21 12:13:41 UTC
Nice work!

Pushed to master for 19.11.00
Comment 11 Fridolin Somers 2019-07-16 06:32:19 UTC
Pushed to 19.05.x for 19.05.02
Comment 12 Lucas Gass 2019-07-19 19:06:04 UTC
backported to 18.11.x for 18.11.08