Bug 41545 - JS warning "redeclaration of let filters_options"
Summary: JS warning "redeclaration of let filters_options"
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low normal
Assignee: Jonathan Druart
QA Contact: Brendan Lawlor
URL:
Keywords:
Depends on: 38311
Blocks: 41579
  Show dependency treegraph
 
Reported: 2026-01-08 14:06 UTC by Jonathan Druart
Modified: 2026-02-16 15:45 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
26.05.00,25.11.02
Circulation function:


Attachments
Bug 41545: Remove JS warning "redeclaration of let filters_options" (1.20 KB, patch)
2026-01-08 14:08 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 41545: Remove JS warning "redeclaration of let filters_options" (1.25 KB, patch)
2026-01-08 23:37 UTC, David Nind
Details | Diff | Splinter Review
Bug 41545: Remove JS warning "redeclaration of let filters_options" (1.30 KB, patch)
2026-01-15 16:20 UTC, Brendan Lawlor
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2026-01-08 14:06:19 UTC

    
Comment 1 Jonathan Druart 2026-01-08 14:06:51 UTC
Same as bug 38190.
Comment 2 Jonathan Druart 2026-01-08 14:08:55 UTC Comment hidden (obsolete)
Comment 3 David Nind 2026-01-08 23:37:06 UTC Comment hidden (obsolete)
Comment 4 David Nind 2026-01-08 23:38:13 UTC
Testing notes (using KTD):

1. Go to Acquisitions > Suggestions
2. Use your web browser developer tools and have the console visible
3. Create a new suggestion: + New purchase suggestion
4. Note the warning in the console:
     Uncaught SyntaxError: Identifier 'filters_options' has already been declared
5. Apply the patch
6. Refresh the page
7. Note that there is no longer a warning
Comment 5 Brendan Lawlor 2026-01-15 16:20:03 UTC
Created attachment 191516 [details] [review]
Bug 41545: Remove JS warning "redeclaration of let filters_options"

On the suggestions page more than one patron search is injected into the
page that leads to JS warnings when the JS variable is defined with
"let". We should use "var" in this case.

Test plan:
/cgi-bin/koha/suggestion/suggestion.pl?op=add_form&branchcode=CPL
And notice that the warning does no longer appear when this patch is
applied.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 6 Brendan Lawlor 2026-01-15 16:49:58 UTC
This works to fix the error: Uncaught SyntaxError: Identifier 'filters_options' has already been declared.

It makes sense to change the declaration to var if patron-search.inc is included in the page.

When testing I noticed another odd js error is sometimes logged to the console within the Select manager modal, but it seems to be Chrome specific and only when selecting a value from autofill in the search field. 

Uncaught ReferenceError: code is not defined

But that is a different and very strange bug, so I am passing QA on this.
Comment 7 Lucas Gass (lukeg) 2026-01-16 21:11:21 UTC
Nice work everyone!

Pushed to main for 26.05
Comment 8 Jacob O'Mara 2026-02-16 15:45:22 UTC
Thanks all, pushed to 25.11.x