Bug 41545

Summary: JS warning "redeclaration of let filters_options"
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: david
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38190
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 38311    
Bug Blocks:    
Attachments: Bug 41545: Remove JS warning "redeclaration of let filters_options"
Bug 41545: Remove JS warning "redeclaration of let filters_options"

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
Created attachment 191026 [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.
Comment 3 David Nind 2026-01-08 23:37:06 UTC
Created attachment 191038 [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>
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