Bug 37634 - Missing "USE Koha" causes JS errors and missing "Last patron" menu
Summary: Missing "USE Koha" causes JS errors and missing "Last patron" menu
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Owen Leonard
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks: 38723
  Show dependency treegraph
 
Reported: 2024-08-13 17:00 UTC by Katrin Fischer
Modified: 2024-12-23 09:37 UTC (History)
9 users (show)

See Also:
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:


Attachments
Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu (90.18 KB, patch)
2024-11-26 12:30 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu (90.22 KB, patch)
2024-11-30 17:53 UTC, David Nind
Details | Diff | Splinter Review
Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu (89.74 KB, patch)
2024-12-13 13:18 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu (90.14 KB, patch)
2024-12-17 07:38 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37634: Missing "USE Koha" causes JS errors and missing "Last patron" menu (90.14 KB, patch)
2024-12-17 07:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37634: (follow-up) Add 'Koha' to LOAD_PLUGINS (4.00 KB, patch)
2024-12-17 07:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 37634: Remove [% USE Koha %] from all templates (244.07 KB, patch)
2024-12-17 07:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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!