Bug 40042

Summary: search_indexes.inc may have undefined index var
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: TemplatesAssignee: Fridolin Somers <fridolin.somers>
Status: Pushed to stable --- QA Contact: Marcel de Rooy <m.de.rooy>
Severity: minor    
Priority: P5 - low CC: m.de.rooy
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.01
Circulation function:
Bug Depends on: 30699    
Bug Blocks:    
Attachments: Bug 40042: Add default value 0 for index var in search_indexes.inc
Bug 40042: Add default value 0 for index var in search_indexes.inc
Bug 40042: Add default value 0 for index var in search_indexes.inc

Description Fridolin Somers 2025-06-02 08:00:17 UTC
In koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc some calls do not set 'index' var generating idx="idx_".
Set 0 has default value.
Comment 1 Fridolin Somers 2025-06-02 08:07:44 UTC Comment hidden (obsolete)
Comment 2 Magnus Enger 2025-06-04 10:54:36 UTC
Created attachment 182938 [details] [review]
Bug 40042: Add default value 0 for index var in search_indexes.inc

In koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc some calls do not set 'index' var generating idx="idx_".
Set 0 has default value.

Test plan :
1) Enable system preference 'IntranetCatalogSearchPulldown'
2) Go to catalogue advanced search
3) Look HTML source and check you see:
     <select class="advsearch" name="idx" id="idx_0">
     <select class="advsearch" name="idx" id="idx_1">
     <select class="advsearch" name="idx" id="idx_2">
4) In page page toolbar, click 'Search catalog'
5) Click on 'More options' icon
6) Look HTML source of this part and check you see:
      <select class="advsearch" name="idx" id="idx_0">
Without patch you see:
      <select class="advsearch" name="idx" id="idx_">

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Comment 3 Marcel de Rooy 2025-06-06 06:48:38 UTC
Created attachment 183041 [details] [review]
Bug 40042: Add default value 0 for index var in search_indexes.inc

In koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc some calls do not set 'index' var generating idx="idx_".
Set 0 has default value.

Test plan :
1) Enable system preference 'IntranetCatalogSearchPulldown'
2) Go to catalogue advanced search
3) Look HTML source and check you see:
     <select class="advsearch" name="idx" id="idx_0">
     <select class="advsearch" name="idx" id="idx_1">
     <select class="advsearch" name="idx" id="idx_2">
4) In page page toolbar, click 'Search catalog'
5) Click on 'More options' icon
6) Look HTML source of this part and check you see:
      <select class="advsearch" name="idx" id="idx_0">
Without patch you see:
      <select class="advsearch" name="idx" id="idx_">

Signed-off-by: Magnus Enger <magnus@libriotech.no>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Lucas Gass (lukeg) 2025-06-06 15:46:04 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 5 Paul Derscheid 2025-06-22 21:47:23 UTC
Nice work everyone!

Pushed to 25.05.x for 25.05.03