Summary: | Missing "USE Koha" causes JS errors and missing "Last patron" menu | ||
---|---|---|---|
Product: | Koha | Reporter: | Katrin Fischer <katrin.fischer> |
Component: | Templates | Assignee: | Owen Leonard <oleonard> |
Status: | Pushed to main --- | QA Contact: | Martin Renvoize (ashimema) <martin.renvoize> |
Severity: | minor | ||
Priority: | P5 - low | CC: | baptiste.wojtkowski, david, fridolin.somers, jesse, jonathan.druart, kyle, m.de.rooy, martin.renvoize, nick, paul.derscheid, tomascohen, wainuiwitikapark |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Medium patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: |
This fixes the cause of the "Last patron" menu not displaying on many staff interface pages, or generating JavaScript errors (where showLastPatron is enabled). (It adds "[% USE Koha %]" to templates where it was missing. It also removes some duplicate USE entries.)
|
|
Version(s) released in: |
25.05.00,24.11.02
|
Circulation function: | |
Bug Depends on: | |||
Bug Blocks: | 38723 | ||
Attachments: |
Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu
Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu Bug 37634: (follow-up) Add 'Koha' to LOAD_PLUGINS Bug 37634: Remove [% USE Koha %] from all templates Bug 37634: [24.04] Missing "USE Koha" causes JS errors and missing "Last patron" menu |
Description
Katrin Fischer
2024-08-13 17:00:20 UTC
Also in "Files" tab Created attachment 174986 [details] [review] Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu This patch adds "[% USE Koha %]" to templates which lack it. Without this, the "Last patron" menu item doesn't work and will cause a JS error on many pages. The patch also removes some USE entries which were duplicates. To test, apply the patch and test all 176 different pages to confirm they all work correctly. I mean, maybe. Or maybe sample a few to confirm they work? - Go to Administration -> System preferences and enable "showLastPatron" - If the preference was not enabled, you probably need to go to Circulation and open a patron account for checkout so that there is a "last patron" to show. - Test a sampling of pages affected by this patch: - Acquisitions -> Acquisitions home page - Administration -> Cities and towns - Catalog -> Item search - Cataloging -> Label creator - Patrons -> Patron account -> Set permissions - Reports -> Items lost - Serials -> Serials home page - Tools -> Calendar - Pages which had duplicate lines (not necessarily "USE Koha"): - Acquisitions -> Vendor -> Receive shipments - Administration -> Manage jobs - Administration -> Record overlay rules - Catalog -> Search results - Catalog -> Bibliographic detail page -> Items - Circulation -> Holds queue - Patrons -> Patron detail page -> Accounting -> Transactions tab - Serials -> Subscription details -> Create/edit routing list - OPAC -> Search results -> Request article Sponsored-by: Athens County Public Libraries Created attachment 175038 [details] [review] Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu This patch adds "[% USE Koha %]" to templates which lack it. Without this, the "Last patron" menu item doesn't work and will cause a JS error on many pages. The patch also removes some USE entries which were duplicates. To test, apply the patch and test all 176 different pages to confirm they all work correctly. I mean, maybe. Or maybe sample a few to confirm they work? - Go to Administration -> System preferences and enable "showLastPatron" - If the preference was not enabled, you probably need to go to Circulation and open a patron account for checkout so that there is a "last patron" to show. - Test a sampling of pages affected by this patch: - Acquisitions -> Acquisitions home page - Administration -> Cities and towns - Catalog -> Item search - Cataloging -> Label creator - Patrons -> Patron account -> Set permissions - Reports -> Items lost - Serials -> Serials home page - Tools -> Calendar - Pages which had duplicate lines (not necessarily "USE Koha"): - Acquisitions -> Vendor -> Receive shipments - Administration -> Manage jobs - Administration -> Record overlay rules - Catalog -> Search results - Catalog -> Bibliographic detail page -> Items - Circulation -> Holds queue - Patrons -> Patron detail page -> Accounting -> Transactions tab - Serials -> Subscription details -> Create/edit routing list - OPAC -> Search results -> Request article Sponsored-by: Athens County Public Libraries Signed-off-by: David Nind <david@davidnind.com> Testing notes (using KTD): 1. The pages to check in the test plan: 1.1 JavaScript error message only generated on Patrons > Patron account > Set permissions 1.2 Before the patch, most pages were missing the "Last patron" menu. 1.3 After the patch, the "Last patron" menu now appears on all pages checked. Should we add a test or something to the QA tools to check for "[% USE Koha %]" in all template pages? (I don't know how this is to do 8-).) Created attachment 175447 [details] [review] Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu This patch adds "[% USE Koha %]" to templates which lack it. Without this, the "Last patron" menu item doesn't work and will cause a JS error on many pages. The patch also removes some USE entries which were duplicates. To test, apply the patch and test all 176 different pages to confirm they all work correctly. I mean, maybe. Or maybe sample a few to confirm they work? - Go to Administration -> System preferences and enable "showLastPatron" - If the preference was not enabled, you probably need to go to Circulation and open a patron account for checkout so that there is a "last patron" to show. - Test a sampling of pages affected by this patch: - Acquisitions -> Acquisitions home page - Administration -> Cities and towns - Catalog -> Item search - Cataloging -> Label creator - Patrons -> Patron account -> Set permissions - Reports -> Items lost - Serials -> Serials home page - Tools -> Calendar - Pages which had duplicate lines (not necessarily "USE Koha"): - Acquisitions -> Vendor -> Receive shipments - Administration -> Manage jobs - Administration -> Record overlay rules - Catalog -> Search results - Catalog -> Bibliographic detail page -> Items - Circulation -> Holds queue - Patrons -> Patron detail page -> Accounting -> Transactions tab - Serials -> Subscription details -> Create/edit routing list - OPAC -> Search results -> Request article Sponsored-by: Athens County Public Libraries Signed-off-by: David Nind <david@davidnind.com> Created attachment 175591 [details] [review] Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu This patch adds "[% USE Koha %]" to templates which lack it. Without this, the "Last patron" menu item doesn't work and will cause a JS error on many pages. The patch also removes some USE entries which were duplicates. To test, apply the patch and test all 176 different pages to confirm they all work correctly. I mean, maybe. Or maybe sample a few to confirm they work? - Go to Administration -> System preferences and enable "showLastPatron" - If the preference was not enabled, you probably need to go to Circulation and open a patron account for checkout so that there is a "last patron" to show. - Test a sampling of pages affected by this patch: - Acquisitions -> Acquisitions home page - Administration -> Cities and towns - Catalog -> Item search - Cataloging -> Label creator - Patrons -> Patron account -> Set permissions - Reports -> Items lost - Serials -> Serials home page - Tools -> Calendar - Pages which had duplicate lines (not necessarily "USE Koha"): - Acquisitions -> Vendor -> Receive shipments - Administration -> Manage jobs - Administration -> Record overlay rules - Catalog -> Search results - Catalog -> Bibliographic detail page -> Items - Circulation -> Holds queue - Patrons -> Patron detail page -> Accounting -> Transactions tab - Serials -> Subscription details -> Create/edit routing list - OPAC -> Search results -> Request article Sponsored-by: Athens County Public Libraries Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 175592 [details] [review] Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu This patch adds "[% USE Koha %]" to templates which lack it. Without this, the "Last patron" menu item doesn't work and will cause a JS error on many pages. The patch also removes some USE entries which were duplicates. To test, apply the patch and test all 176 different pages to confirm they all work correctly. I mean, maybe. Or maybe sample a few to confirm they work? - Go to Administration -> System preferences and enable "showLastPatron" - If the preference was not enabled, you probably need to go to Circulation and open a patron account for checkout so that there is a "last patron" to show. - Test a sampling of pages affected by this patch: - Acquisitions -> Acquisitions home page - Administration -> Cities and towns - Catalog -> Item search - Cataloging -> Label creator - Patrons -> Patron account -> Set permissions - Reports -> Items lost - Serials -> Serials home page - Tools -> Calendar - Pages which had duplicate lines (not necessarily "USE Koha"): - Acquisitions -> Vendor -> Receive shipments - Administration -> Manage jobs - Administration -> Record overlay rules - Catalog -> Search results - Catalog -> Bibliographic detail page -> Items - Circulation -> Holds queue - Patrons -> Patron detail page -> Accounting -> Transactions tab - Serials -> Subscription details -> Create/edit routing list - OPAC -> Search results -> Request article Sponsored-by: Athens County Public Libraries Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Created attachment 175593 [details] [review] Bug 37634: (follow-up) Add 'Koha' to LOAD_PLUGINS This patch adds the Koha plugin that's used in almost every template and include for some basic functions to the LOAD_PLUGINS directive on Template load.. this way we shouldn't need to keep adding it to the top of every TT file. Created attachment 175594 [details] [review] Bug 37634: Remove [% USE Koha %] from all templates We now load this plugin by default using LOAD_PLUGINS so we no longer need to reference it in a USE statement in every template file. So.. it felt a bit mad adding all these USE statements to pretty much every template file in Koha so I asked myself.. "Can't we just load that plugin by default?" Setting back to NSO to get some attention and testing. Obsoleted my follow-ups and moved them to their own bug. Are we going to add it even if the template does not use it? I don't think it's a good idea... Glad to see this fixed :) Pushed for 25.05! Well done everyone, thank you! (In reply to Jonathan Druart from comment #12) > Are we going to add it even if the template does not use it? > > I don't think it's a good idea... Too bad this has been ignored. I am not sure it has been. But isn't the last patron available on all pages? We could have wrapped it into an IF/END maybe in case the feature is turned off. This bug should have been fixed by adding [% USE Koha %] to koha-tmpl/intranet-tmpl/prog/en/includes/last-borrower.inc This was the proper fix, because this file is using Koha.Preference. Now it's still missing from this include file (which is wrong IMO) and we have USE Koha where it's not needed (ie. when we don't use the Koha TT plugin). (In reply to Jonathan Druart from comment #17) > This bug should have been fixed by adding [% USE Koha %] to > koha-tmpl/intranet-tmpl/prog/en/includes/last-borrower.inc > This was the proper fix, because this file is using Koha.Preference. > Now it's still missing from this include file (which is wrong IMO) and we > have USE Koha where it's not needed (ie. when we don't use the Koha TT > plugin). Would the "double declaration" be a problem if it's in the include and on the page itself or could that be safely ignored? keep the code clean? It's all what I am talking about. (In reply to Jonathan Druart from comment #19) > keep the code clean? It's all what I am talking about. Sorry, I am trying to understand the issue. If we move it to the include, we'd end up with a lot of multiple "USE Koha" on pages. I was wondering if that was not worse than adding it to the templates or if it could be ignored. (In reply to Katrin Fischer from comment #20) > (In reply to Jonathan Druart from comment #19) > > keep the code clean? It's all what I am talking about. > > Sorry, I am trying to understand the issue. If we move it to the include, > we'd end up with a lot of multiple "USE Koha" on pages. I was wondering if > that was not worse than adding it to the templates or if it could be ignored. We have this already in several places, it's not a problem. I guess TT won't load the plugin if it has been loaded already. I confirm this is a problem. If you include sub-header.inc to use the breadcrumb from a plugin, you get: Template process failed: undef error - : filter not found at /kohadevbox/koha/C4/Templates.pm line 134 Absolutely not meaningful. This is because shortcut.inc is using Koha.Preference without 'USE Koha' This is in the commit log for 24.11, though not noted here yet. Not backporting to 24.05.x unless requested Nice work everyone! Pushed to 24.11.x for 24.11.02. Merge conflicts with 24.05.x Please resolve if needed in 24.05.x Created attachment 183152 [details] [review] Bug 37634: [24.04] Missing "USE Koha" causes JS errors and missing "Last patron" menu This patch adds "[% USE Koha %]" to templates which lack it. Without this, the "Last patron" menu item doesn't work and will cause a JS error on many pages. The patch also removes some USE entries which were duplicates. To test, apply the patch and test all 176 different pages to confirm they all work correctly. I mean, maybe. Or maybe sample a few to confirm they work? - Go to Administration -> System preferences and enable "showLastPatron" - If the preference was not enabled, you probably need to go to Circulation and open a patron account for checkout so that there is a "last patron" to show. - Test a sampling of pages affected by this patch: - Acquisitions -> Acquisitions home page - Administration -> Cities and towns - Catalog -> Item search - Cataloging -> Label creator - Patrons -> Patron account -> Set permissions - Reports -> Items lost - Serials -> Serials home page - Tools -> Calendar - Pages which had duplicate lines (not necessarily "USE Koha"): - Acquisitions -> Vendor -> Receive shipments - Administration -> Manage jobs - Administration -> Record overlay rules - Catalog -> Search results - Catalog -> Bibliographic detail page -> Items - Circulation -> Holds queue - Patrons -> Patron detail page -> Accounting -> Transactions tab - Serials -> Subscription details -> Create/edit routing list - OPAC -> Search results -> Request article Sponsored-by: Athens County Public Libraries Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> (In reply to Owen Leonard from comment #26) > Created attachment 183152 [details] [review] [review] > Bug 37634: [24.04] Missing "USE Koha" causes JS errors and missing "Last > patron" menu Sorry that should be [24.05] of course! |