From cb65c0f0196b9c51ebd76689c596cac08d5be002 Mon Sep 17 00:00:00 2001 From: Jake Deery Date: Tue, 3 Mar 2026 09:29:23 +0000 Subject: [PATCH] Bug 14962: (QA follow-up) Fix misuse of effective_etcbranch in OPAC scripts Fixed a regression caused by an update to the nomenclature of effective_etcbranch vs. effective_etc_library (the former being an accessor for the home or holding branch's code, the latter being an accessor for the entire Koha::Library object). Sponsored-by: ByWater Solutions --- opac/opac-detail.pl | 36 ++++++++++++------------------------ opac/opac-reserve.pl | 30 ++++++------------------------ 2 files changed, 18 insertions(+), 48 deletions(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index c9aacc45c90..2502905d297 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -744,36 +744,24 @@ if ( not $viewallitems and $items->count > $max_items_to_display ) { $item_info->{holding_branch} = $item->holding_branch; $item_info->{home_branch} = $item->home_branch; - if ( C4::Context->preference('UseDisplayModule') && $item->effective_homebranch ) { - my $effective_homebranch = $item->effective_homebranch; - my $effective_homebranch_id = $item->effective_homebranch->branchcode; - my $effective_homebranch_opac_info = $item->effective_homebranch->opac_info( { lang => $lang } ); + if ( C4::Context->preference('UseDisplayModule') && $item->effective_home_library ) { + my $effective_home_library = $item->effective_home_library; + my $effective_home_library_opac_info = $effective_home_library->opac_info( { lang => $lang } ); - $item_info->{home_library_info} = $effective_homebranch_opac_info - if ($effective_homebranch_opac_info); + $item_info->{home_library_info} = $effective_home_library_opac_info + if ($effective_home_library_opac_info); - # If it starts with "DISPLAY:", use it as-is, otherwise look it up - if ( $effective_homebranch_id =~ /^DISPLAY:/ ) { - $item_info->{home_branch} = $effective_homebranch_id; - } else { - $item_info->{home_branch} = $effective_homebranch; - } + $item_info->{home_branch} = $effective_home_library; } - if ( C4::Context->preference('UseDisplayModule') && $item->effective_holdingbranch ) { - my $effective_holdingbranch = $item->effective_holdingbranch; - my $effective_holdingbranch_id = $item->effective_holdingbranch->branchcode; - my $effective_holdingbranch_opac_info = $item->effective_homebranch->opac_info( { lang => $lang } ); + if ( C4::Context->preference('UseDisplayModule') && $item->effective_holding_library ) { + my $effective_holding_library = $item->effective_holding_library; + my $effective_holding_library_opac_info = $effective_holding_library->opac_info( { lang => $lang } ); - $item_info->{holding_library_info} = $effective_holdingbranch_opac_info - if ($effective_holdingbranch_opac_info); + $item_info->{holding_library_info} = $effective_holding_library_opac_info + if ($effective_holding_library_opac_info); - # If it starts with "DISPLAY:", use it as-is, otherwise look it up - if ( $effective_holdingbranch_id =~ /^DISPLAY:/ ) { - $item_info->{holding_branch} = $effective_holdingbranch_id; - } else { - $item_info->{holding_branch} = $effective_holdingbranch; - } + $item_info->{holding_branch} = $effective_holding_library; } my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype ); diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 52e60dd61d1..ef9c02c12b5 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -350,8 +350,8 @@ foreach my $biblioNumber (@biblionumbers) { foreach my $item ( $items->as_list ) { $item->{'ccode'} = $item->effective_collection_code; - $item->holdingbranch( $item->effective_holdingbranch->branchcode ); - $item->homebranch( $item->effective_homebranch->branchcode ); + $item->holdingbranch( $item->effective_holdingbranch ); + $item->homebranch( $item->effective_homebranch ); push @{ $biblioData->{items} }, $item; # FIXME Potentially a lot in memory here! } @@ -441,29 +441,11 @@ foreach my $biblioNum (@biblionumbers) { $item_info->{'ccode'} = $item->effective_collection_code if ( C4::Context->preference('UseDisplayModule') && $item->effective_collection_code ); - if ( C4::Context->preference('UseDisplayModule') && $item->effective_homebranch ) { - my $effective_homebranch = $item->effective_homebranch; - my $effective_homebranch_id = $item->effective_homebranch->branchcode; + $item_info->{home_branch} = $item->effective_homebranch + if ( C4::Context->preference('UseDisplayModule') && $item->effective_homebranch ); - # If it starts with "DISPLAY:", use it as-is, otherwise look it up - if ( $effective_homebranch_id =~ /^DISPLAY:/ ) { - $item_info->{holding_branch} = $effective_homebranch_id; - } else { - $item_info->{holding_branch} = $effective_homebranch; - } - } - - if ( C4::Context->preference('UseDisplayModule') && $item->effective_holdingbranch ) { - my $effective_holdingbranch = $item->effective_holdingbranch; - my $effective_holdingbranch_id = $item->effective_holdingbranch->branchcode; - - # If it starts with "DISPLAY:", use it as-is, otherwise look it up - if ( $effective_holdingbranch_id =~ /^DISPLAY:/ ) { - $item_info->{home_branch} = $effective_holdingbranch_id; - } else { - $item_info->{home_branch} = $effective_holdingbranch; - } - } + $item_info->{holding_branch} = $item->effective_holdingbranch + if ( C4::Context->preference('UseDisplayModule') && $item->effective_holdingbranch ); if ($itemLevelTypes) { my $itemtype = $item->itemtype; -- 2.50.1 (Apple Git-155)