Bug 37634

Summary: Missing "USE Koha" causes JS errors and missing "Last patron" menu
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: TemplatesAssignee: 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, jonathan.druart, kyle, m.de.rooy, martin.renvoize, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
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
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

Description Katrin Fischer 2024-08-13 17:00:20 UTC
When showLastPatron is active, there is a JS error when looking at the details of a debit:

Uncaught ReferenceError: showLastPatronCount is not defined
    <anonymous> http://localhost:8081/intranet-tmpl/prog/js/staff-global_24.0600023.js:215
    jQuery 13


To test:
* Activate showLastPatron
* Go to a patron account (Henry will do)
* Add a manual invoice
* Click on the "Details" for this invoice
* Verify there is a JS error on the page
Comment 1 Fridolin Somers 2024-11-25 11:28:15 UTC
Also in "Files" tab
Comment 2 Owen Leonard 2024-11-26 12:30:29 UTC Comment hidden (obsolete)
Comment 3 David Nind 2024-11-30 17:53:31 UTC Comment hidden (obsolete)
Comment 4 David Nind 2024-11-30 18:09:27 UTC
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-).)
Comment 5 Owen Leonard 2024-12-13 13:18:21 UTC Comment hidden (obsolete)
Comment 6 Martin Renvoize (ashimema) 2024-12-17 07:38:33 UTC Comment hidden (obsolete)
Comment 7 Martin Renvoize (ashimema) 2024-12-17 07:58:06 UTC Comment hidden (obsolete)
Comment 8 Martin Renvoize (ashimema) 2024-12-17 07:58:09 UTC
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.
Comment 9 Martin Renvoize (ashimema) 2024-12-17 07:58:13 UTC
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.
Comment 10 Martin Renvoize (ashimema) 2024-12-17 07:59:24 UTC
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.
Comment 11 Martin Renvoize (ashimema) 2024-12-17 09:14:13 UTC
Obsoleted my follow-ups and moved them to their own bug.
Comment 12 Jonathan Druart 2024-12-17 09:29:07 UTC
Are we going to add it even if the template does not use it?

I don't think it's a good idea...
Comment 13 Katrin Fischer 2024-12-23 09:14:51 UTC
Glad to see this fixed :)
Comment 14 Katrin Fischer 2024-12-23 09:37:14 UTC
Pushed for 25.05!

Well done everyone, thank you!