From 92927429f1c0c9ba12a8dda97521990181e0a142 Mon Sep 17 00:00:00 2001 From: Jake Deery Date: Mon, 1 Dec 2025 14:47:58 +0000 Subject: [PATCH] Bug 14962: On Display code for OPAC scripts & templates This patch makes the necessary changes to the OPAC to make sure effective locations, collection codes, and branches are correctly displayed. Please see the test files commit for instructions on how to test this bundle of patches. --- .../opac-tmpl/bootstrap/en/modules/opac-basket.tt | 4 ++-- opac/opac-detail.pl | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt index a19db309bf0..5263dd9487e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt @@ -292,7 +292,7 @@ [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
  • [% Branches.GetName(ITEM_RESULT.holdingbranch) | html %] - [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ITEM_RESULT.location, opac => 1 ) | html %] + [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ITEM_RESULT.effective_location, opac => 1 ) | html %] [% IF ( ITEM_RESULT.itemcallnumber ) %] ([% ITEM_RESULT.itemcallnumber | html %]) [% END %] @@ -374,7 +374,7 @@ >[% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
  • [% Branches.GetName(ITEM_RESULT.holdingbranch) | html %] - [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ITEM_RESULT.location, opac => 1 ) | html %] + [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ITEM_RESULT.effective_location, opac => 1 ) | html %] [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode', authorised_value => ITEM_RESULT.ccode, opac => 1 ) | html %] [% IF ( ITEM_RESULT.itemcallnumber ) %] ([% ITEM_RESULT.itemcallnumber | html %]) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 211dac36ea1..b42b97ac429 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -739,8 +739,15 @@ if ( not $viewallitems and $items->count > $max_items_to_display ) { && defined($copynumber) && exists( $copynumbers->{$copynumber} ) ); - if ( defined $item->location ) { - $item_info->{'location_description'} = $shelflocations->{ $item->location }; + if ( defined $item->effective_location ) { + my $effective_loc = $item->effective_location; + + # If it starts with "DISPLAY:", use it as-is, otherwise look it up + if ( $effective_loc =~ /^DISPLAY:/ ) { + $item_info->{'location_description'} = $effective_loc; + } else { + $item_info->{'location_description'} = $shelflocations->{$effective_loc}; + } } my $itemtype = $item->itemtype; -- 2.50.1 (Apple Git-155)