Bug 40873

Summary: AV dropdowns in OPAC don't use lib_opac values
Product: Koha Reporter: Eric Phetteplace <ephetteplace>
Component: OPACAssignee: Eric Phetteplace <ephetteplace>
Status: Pushed to oldstable --- QA Contact: Baptiste Wojtkowski (bwoj) <baptiste.wojtkowski>
Severity: minor    
Priority: P5 - low CC: baptiste.wojtkowski, david, dcook, fridolin.somers
Version: Main   
Hardware: All   
OS: All   
GIT URL: Initiative type: ---
Sponsorship status: Sponsored Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes the value displayed in dropdown lists for authorized values in the OPAC. The value entered in the 'Description (OPAC)' field is now shown for authorized value dropdown lists. Previously, the value shown was what was in the 'Description' field. Example: for the SUGGEST_FORMAT authorized value category, the value in 'Description (OPAC)' is now shown in the dropdown list for the item type field on the purchase suggestion form in the OPAC.
Version(s) released in:
25.11.00,25.05.06,24.11.11
Circulation function:
Attachments: Bug 40873: AV dropdowns in OPAC don't use lib_opac
Bug 40873: AV dropdowns in OPAC don't use lib_opac
Bug 40873: AV dropdowns in OPAC don't use lib_opac

Description Eric Phetteplace 2025-09-24 19:29:06 UTC
The OPAC version of av-build-dropbox.inc uses av.lib instead of av.lib_opac so even if your AV category has OPAC-friendly text it is not used.

I discovered this specifically when using the SUGGEST_FORMAT item types for purchase suggestions. I created the category, added several values, gave them all a concise "lib" value and some a more explanatory "lib_opac" value. When I visited the OPAC's suggestions page /cgi-bin/koha/opac-suggestions.pl?op=add_form I saw the form only used the "lib" values.

The code is in koha-tmpl/opac-tmpl/bootstrap/en/includes/av-build-dropbox.inc

I suspect many patron-facing AVs don't have lib_opac values because they're not used anywhere, so changing the dropbox code to use lib_opac could have negative side effects for many existing instances. Would it make sense to check if an AV has lib_opac, use that, and default to lib if not available? This should make the transition seamless, unless libraries put inaccurate values in their lib_opac which they wouldn't notice until now.
Comment 1 Eric Phetteplace 2025-09-24 19:41:41 UTC
Well I see why I discovered this on the purchase suggestions, that appears to be the only place the OPAC av-build-dropbox.inc is used. But if this include is used again in the future, it would really be nice if it worked with the lib_opac values. Patch forthcoming.
Comment 2 Eric Phetteplace 2025-09-24 19:51:43 UTC
Created attachment 186901 [details] [review]
Bug 40873: AV dropdowns in OPAC don't use lib_opac

To test (ktd):
- Sign into the admin side
- Go to Administration > Authorized Values
- Edit or add to SUGGEST_FORMAT such that one AV has a different lib_opac
- Sign into the public catalog
- Go to purchase suggestions /cgi-bin/koha/opac-suggestions.pl?op=add_form
- Note that the AV in the 'Item type' dropdown does not use your lib_opac text
- Apply the patch and refresh the page
- Now the AV uses the lib_opac text

Sponsored-By: California College of the Arts
Comment 3 David Nind 2025-11-28 03:42:43 UTC
Created attachment 190002 [details] [review]
Bug 40873: AV dropdowns in OPAC don't use lib_opac

To test (ktd):
- Sign into the admin side
- Go to Administration > Authorized Values
- Edit or add to SUGGEST_FORMAT such that one AV has a different lib_opac
- Sign into the public catalog
- Go to purchase suggestions /cgi-bin/koha/opac-suggestions.pl?op=add_form
- Note that the AV in the 'Item type' dropdown does not use your lib_opac text
- Apply the patch and refresh the page
- Now the AV uses the lib_opac text

Sponsored-By: California College of the Arts
Signed-off-by: David Nind <david@davidnind.com>
Comment 4 Baptiste Wojtkowski (bwoj) 2025-11-28 13:51:47 UTC
Created attachment 190026 [details] [review]
Bug 40873: AV dropdowns in OPAC don't use lib_opac

To test (ktd):
- Sign into the admin side
- Go to Administration > Authorized Values
- Edit or add to SUGGEST_FORMAT such that one AV has a different lib_opac
- Sign into the public catalog
- Go to purchase suggestions /cgi-bin/koha/opac-suggestions.pl?op=add_form
- Note that the AV in the 'Item type' dropdown does not use your lib_opac text
- Apply the patch and refresh the page
- Now the AV uses the lib_opac text

Sponsored-By: California College of the Arts
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Baptiste Wojtkowski <baptiste.wojtkowski@biblibre.com>
Comment 5 Lucas Gass (lukeg) 2025-12-01 15:36:04 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 6 Paul Derscheid 2025-12-03 16:03:06 UTC
Nice work everyone!

Pushed to 25.05.x
Comment 7 Fridolin Somers 2025-12-04 14:27:14 UTC
Pushed to 24.11.x for 24.11.11
Comment 8 Fridolin Somers 2025-12-05 10:19:10 UTC
(In reply to Fridolin Somers from comment #7)
> Pushed to 24.11.x for 24.11.11

Pushed a fix to make Jenkins happy :
Bug 40873: [24.11.x] Use valid TT syntax