Bug 30629

Summary: <span> in title of patron card creator template needs to be removed
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: TemplatesAssignee: Owen Leonard <oleonard>
Status: CLOSED FIXED QA Contact: Victor Grousset/tuxayo <victor>
Severity: normal    
Priority: P5 - low CC: arthur.suzuki, david, fridolin.somers, lucas, victor
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31069
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This removes <span> tags incorrectly displaying in browser page titles for some pages in the staff interface (Tools > Patron card creator > Layouts; Tools > Label creator > Manage > Label batches; Administration > Budgets administration > select a budget > Plan by ...).
Version(s) released in:
22.11.00, 22.05.01
Bug Depends on: 29602    
Bug Blocks:    
Attachments: Bug 30629: fix <span> in title of some pages
Bug 30629: fix <span> in title of some pages
Bug 30629: fix <span> in title of some pages
Bug 30629: fix <span> in title of some pages

Description Katrin Fischer 2022-04-27 15:18:25 UTC
<title> elements are not allowed to have <span> elements, they show as such in the browser tab.

There is a wrong span in the template for:
/cgi-bin/koha/patroncards/manage.pl?card_element=template
Comment 1 Fridolin Somers 2022-04-27 20:12:30 UTC
Maybe keep the span in PROCESS and remove them in <title> creation.
I've tryed but could not use filters on a PROCESS.
Comment 2 Owen Leonard 2022-05-05 10:00:57 UTC
It would be nice to have at least the *possibility* of using a construction like "[% t('Layouts') | html %]" as proposed in Bug 26932. This would prevent a lot of ugly cases like this were we add useless <span>s.
Comment 3 Victor Grousset/tuxayo 2022-05-11 23:04:03 UTC
Bug 26932 looks like a typo, it's unrelated.
Comment 4 Victor Grousset/tuxayo 2022-05-12 20:46:34 UTC
Searching for <title> that processes a BLOCK with [% PROCESS %] shows that the following pages are affected:

modules/admin/aqplan.tt
block defined in budget_planning.inc

patroncards/manage.tt
block defined in same template

labels/label-manage.tt
block defined in same template
Comment 5 Fridolin Somers 2022-05-13 02:24:06 UTC
Maybe we could have a TT filter that removes all HTML tags.
Looks like it does not exist in current lib :
http://template-toolkit.org/docs/manual/Filters.html
Comment 6 Victor Grousset/tuxayo 2022-05-13 19:31:20 UTC Comment hidden (obsolete)
Comment 7 Victor Grousset/tuxayo 2022-05-13 19:39:10 UTC
Created attachment 134990 [details] [review]
Bug 30629: fix <span> in title of some pages

== Test plan ==
1. Go to http://localhost:8081/cgi-bin/koha/patroncards/manage.pl?card_element=layout
2. See that the page title in your browser window title is wrong because it contains <span>
3. Go to http://localhost:8081/cgi-bin/koha/labels/label-manage.pl?label_element=batch
4. See that the page title in your browser window title is wrong because it contains <span>
5. Go to http://localhost:8081/cgi-bin/koha/admin/aqbudgetperiods.pl
6. Administration => Budgets => Click on a budget => planning => plan by months
7. See that the page title in your browser window title is wrong because it contains <span>
8. Refresh the pages and see that the titles are correct
9. Sign off :)
Comment 8 Victor Grousset/tuxayo 2022-05-14 00:53:21 UTC
(In reply to Fridolin Somers from comment #5)
> Maybe we could have a TT filter that removes all HTML tags.

Looks like it would be a workaround on top of the other workaround which is our use of <span> to guide the translation string extractor.

t() works though.

Testing note: translatability has been checked.
And it's a string change so mind the string freeze. Because even if the strings are the same. They are moved from the staff .po to the messages .po and there is no existing occurrence of at least one of the strings.
Comment 9 David Nind 2022-05-14 22:22:30 UTC
Created attachment 135001 [details] [review]
Bug 30629: fix <span> in title of some pages

== Test plan ==
1. Go to http://localhost:8081/cgi-bin/koha/patroncards/manage.pl?card_element=layout
2. See that the page title in your browser window title is wrong because it contains <span>
3. Go to http://localhost:8081/cgi-bin/koha/labels/label-manage.pl?label_element=batch
4. See that the page title in your browser window title is wrong because it contains <span>
5. Go to http://localhost:8081/cgi-bin/koha/admin/aqbudgetperiods.pl
6. Administration => Budgets => Click on a budget => planning => plan by months
7. See that the page title in your browser window title is wrong because it contains <span>
8. Refresh the pages and see that the titles are correct
9. Sign off :)

Signed-off-by: David Nind <david@davidnind.com>
Comment 10 Jonathan Druart 2022-05-18 09:43:31 UTC
Created attachment 135096 [details] [review]
Bug 30629: fix <span> in title of some pages

== Test plan ==
1. Go to http://localhost:8081/cgi-bin/koha/patroncards/manage.pl?card_element=layout
2. See that the page title in your browser window title is wrong because it contains <span>
3. Go to http://localhost:8081/cgi-bin/koha/labels/label-manage.pl?label_element=batch
4. See that the page title in your browser window title is wrong because it contains <span>
5. Go to http://localhost:8081/cgi-bin/koha/admin/aqbudgetperiods.pl
6. Administration => Budgets => Click on a budget => planning => plan by months
7. See that the page title in your browser window title is wrong because it contains <span>
8. Refresh the pages and see that the titles are correct
9. Sign off :)

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 11 Tomás Cohen Arazi 2022-06-01 19:30:57 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 12 Lucas Gass 2022-06-10 15:27:54 UTC
Pushed to 22.05.x for 22.05.01
Comment 13 Arthur Suzuki 2022-06-21 12:50:55 UTC
that one depends on 29602, not sure it is relevant for 21.11.x.