Bug 15814

Summary: Templates for MARC modification: Edit action does not work when Description contains '
Product: Koha Reporter: Mirko Tietgen <mirko>
Component: ToolsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Nick Clemens <nick>
Severity: major    
Priority: P5 - low CC: arouss1980, e.betemps, fridolin.somers, jonathan.druart, lucas, martin.renvoize, nick, veron, victor
Version: Main   
Hardware: All   
OS: All   
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
Bug Depends on: 8015    
Bug Blocks:    
Attachments: Bug 15814: Handle correctly MMTA edit button
Bug 15814: Handle correctly MMTA edit button
Bug 15814: Add missing filters
Bug 15814: Handle correctly MMTA edit button
Bug 15814: Add missing filters

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