From 2559c8566129e16b08a001e7943252141c016353 Mon Sep 17 00:00:00 2001 From: Janusz Kaczmarek Date: Sat, 7 Mar 2026 21:18:51 +0000 Subject: [PATCH] Bug 42020: (Bug 39482 follow-up) Library info link shown in OPAC without OpacLibraryInfo and library URL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prior to Bug 39482 a link to library info modal (with (i) icon) was generated only if OpacLibraryInfo was defined (cf. original Bug 29616). Now it is there even if there is no OpacLibraryInfo at all and no URL defined for the library. It is generated in any circumstances. The test on $item->holding_branch->opac_info( { lang => $lang } ) in opac-detail.pl now returns always true. This is because Koha::Library::opac_info returns a RS now, and not an object, as it was before (find_best_match --> search_for_display). This patch restores the original behavior designed in Bug 29616. Test plan: 1. Have a standard ktd installation. 2. Make sure there is no OpacLibraryInfo defined in HTML customizations. 3. Make sure there is no URL for any library. 4. In OPAC, perform any search. On a detail page you would see a link to an empty modal from the Current library items column. 5. Apply the patch ; restart_all. 6. Repeat p. 4. There should be no link generated now. 7. Extent the test to follow Bug 29616 logic: A. One with both branches.branchurl and OpacLibraryInfo defined B. One with branches.branchurl but no OpacLibraryInfo defined C. One with OpacLibraryInfo defined but no branches.branchurl D. One with neither branches.branchurl nor OpacLibraryInfo defined (neither for a specific library, nor default one) View the bibliographic detail page in the OPAC for title(s) which have holdings from the libraries you configured above. In the holdings table, check the behavior of the library name in the "Current library" or "Home library" columns * - Case A: The library name appears as a link with an "info" icon. Clicking it shows the library information in a modal window. In the modal footer, a "Visit web site" button should take you to the correct URL. - Case B: The library name appears as a link without an icon. Clicking the link takes you to the correct URL. - Case C: The library name appears as a link with an "info" icon. Clicking it shows the library information in a modal window. In the modal footer there is no "Visit web site" button. - Case D: The library name is plain text. * Display of "Current library" and/or "Home library" is controlled by the OpacLocationBranchToDisplay system preference. Sponsored-by: Pontificia Università di San Tommaso d'Aquino (Angelicum) Signed-off-by: David Nind --- opac/opac-detail.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index edf609cb02..fb4ecadb15 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -714,9 +714,10 @@ if ( not $viewallitems and $items->count > $max_items_to_display ) { # Get opac_info from Additional contents for home and holding library my ( $opac_info_home, $opac_info_holding ); $opac_info_holding = $library_info->{ $item->holdingbranch } - // $item->holding_branch->opac_info( { lang => $lang } ); + // $item->holding_branch->opac_info( { lang => $lang } )->next; $library_info->{ $item->holdingbranch } = $opac_info_holding; - $opac_info_home = $library_info->{ $item->homebranch } // $item->home_branch->opac_info( { lang => $lang } ); + $opac_info_home = $library_info->{ $item->homebranch } + // $item->home_branch->opac_info( { lang => $lang } )->next; $library_info->{ $item->homebranch } = $opac_info_home; $item_info->{holding_library_info} = $opac_info_holding if $opac_info_holding; $item_info->{home_library_info} = $opac_info_home if $opac_info_home; -- 2.39.5