Bug 21704

Summary: Editing subfields in bibliographic frameworks is broken (TT filter)
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: TemplatesAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: critical    
Priority: P5 - low CC: gmcharlt, katrin.fischer, martin.renvoize, nick
Version: master   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21703
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21706
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 13618    
Bug Blocks: 23153    
Attachments: Bug 21704: Edit framework subfield link is broken (TT filter)
Bug 21704: (follow-up) Remove unused 'frameworkcode' template param
Bug 21704: Edit framework subfield link is broken (TT filter)
Bug 21704: (follow-up) Remove unused 'frameworkcode' template param
Bug 21704: Edit framework subfield link is broken (TT filter)
Bug 21704: (follow-up) Remove unused 'frameworkcode' template param
Bug 21704: (QA follow-up) Fix evil tabs

Description Tomás Cohen Arazi 2018-10-28 11:41:10 UTC
The subfield_link attribute is already escaped, so the uri filter breaks it. 

To test:
- Go to Home > Administration > MARC frameworks
- Pick any of them subfield (dropdown on the right, Subfields option)
=> FAIL: 'not found' error screen
Comment 1 Tomás Cohen Arazi 2018-10-28 11:44:14 UTC
I'll try to provide a fix tomorrow. Just a note for anyone beating me due to timezones: if we changed the template filter to (say) 'url' to fix this, we might be just hiding the fact that we shouldn't build the links in the .pl script. It should be done in the templates, using the 'uri' filter for the query parameters.
Comment 2 Tomás Cohen Arazi 2018-10-28 12:44:41 UTC
Created attachment 81405 [details] [review]
Bug 21704: Edit framework subfield link is broken (TT filter)

This patch removes URL building from the controller
(admin/marctagstructure.pl) and does it on the templates, using the
right 'uri' filter for the query parameters.

It also removes:
- No longer used attributes that are passed to the template
- Duplicated code in the templates

To test:
- Go to Home > Administration > MARC bibliographic framework
- On any of the listed frameworks, pick the 'MARC structure' action in
the dropdown
- On any subfield, hover on the actions dropdown
=> FAIL: The URLs are wrongly formed
- Click on the links
=> FAIL: You get errors because of the bad URL
- Apply this patch
- Reload the 'MARC structure' page
- On any subfield, hover on the actions dropdown
=> SUCCESS: LInks look correct
- Click on any of them
=> SUCCESS: They work!
- Use the 'Display only used tags/subfields' checkbox
=> SUCCESS: No behaviour change!
- Sign off :-D
Comment 3 Tomás Cohen Arazi 2018-10-28 12:59:37 UTC
Created attachment 81407 [details] [review]
Bug 21704: (follow-up) Remove unused 'frameworkcode' template param

This patch removes the 'frameworkcode' template parameter. Now the
'framework' object is passed, and everytime the frameworkcode is needed
on the template, framework.frameworkcode is called.

To test:
- Apply this patch
- Run:
  $ grep ' frameworkcode ' koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt
=> SUCCESS: There's no use of 'frameworkcode' in the template
- Sign off :-D
Comment 4 Michal Denar 2018-10-28 20:33:57 UTC
Created attachment 81428 [details] [review]
Bug 21704: Edit framework subfield link is broken (TT filter)

This patch removes URL building from the controller
(admin/marctagstructure.pl) and does it on the templates, using the
right 'uri' filter for the query parameters.

It also removes:
- No longer used attributes that are passed to the template
- Duplicated code in the templates

To test:
- Go to Home > Administration > MARC bibliographic framework
- On any of the listed frameworks, pick the 'MARC structure' action in
the dropdown
- On any subfield, hover on the actions dropdown
=> FAIL: The URLs are wrongly formed
- Click on the links
=> FAIL: You get errors because of the bad URL
- Apply this patch
- Reload the 'MARC structure' page
- On any subfield, hover on the actions dropdown
=> SUCCESS: LInks look correct
- Click on any of them
=> SUCCESS: They work!
- Use the 'Display only used tags/subfields' checkbox
=> SUCCESS: No behaviour change!
- Sign off :-D

Sponsored-by: Theke Solutions

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 5 Michal Denar 2018-10-28 20:34:01 UTC
Created attachment 81429 [details] [review]
Bug 21704: (follow-up) Remove unused 'frameworkcode' template param

This patch removes the 'frameworkcode' template parameter. Now the
'framework' object is passed, and everytime the frameworkcode is needed
on the template, framework.frameworkcode is called.

To test:
- Apply this patch
- Run:
  $ grep ' frameworkcode ' koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt
=> SUCCESS: There's no use of 'frameworkcode' in the template
- Sign off :-D

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 6 Katrin Fischer 2018-10-28 22:05:08 UTC
We need another patch for authority frameworks: bug 21706
Comment 7 Katrin Fischer 2018-10-28 22:09:32 UTC
Created attachment 81432 [details] [review]
Bug 21704: Edit framework subfield link is broken (TT filter)

This patch removes URL building from the controller
(admin/marctagstructure.pl) and does it on the templates, using the
right 'uri' filter for the query parameters.

It also removes:
- No longer used attributes that are passed to the template
- Duplicated code in the templates

To test:
- Go to Home > Administration > MARC bibliographic framework
- On any of the listed frameworks, pick the 'MARC structure' action in
the dropdown
- On any subfield, hover on the actions dropdown
=> FAIL: The URLs are wrongly formed
- Click on the links
=> FAIL: You get errors because of the bad URL
- Apply this patch
- Reload the 'MARC structure' page
- On any subfield, hover on the actions dropdown
=> SUCCESS: LInks look correct
- Click on any of them
=> SUCCESS: They work!
- Use the 'Display only used tags/subfields' checkbox
=> SUCCESS: No behaviour change!
- Sign off :-D

Sponsored-by: Theke Solutions

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>
Comment 8 Katrin Fischer 2018-10-28 22:09:36 UTC
Created attachment 81433 [details] [review]
Bug 21704: (follow-up) Remove unused 'frameworkcode' template param

This patch removes the 'frameworkcode' template parameter. Now the
'framework' object is passed, and everytime the frameworkcode is needed
on the template, framework.frameworkcode is called.

To test:
- Apply this patch
- Run:
  $ grep ' frameworkcode ' koha-tmpl/intranet-tmpl/prog/en/modules/admin/marctagstructure.tt
=> SUCCESS: There's no use of 'frameworkcode' in the template
- Sign off :-D

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Michal Denar <black23@gmail.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 9 Katrin Fischer 2018-10-28 22:09:40 UTC
Created attachment 81434 [details] [review]
Bug 21704: (QA follow-up) Fix evil tabs

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 10 Nick Clemens 2018-10-29 01:17:13 UTC
Awesome work all!

Pushed to master for 18.11
Comment 11 Martin Renvoize 2018-11-08 15:26:10 UTC
Caused by bug 13618 not in 18.05.x series.