diff --git a/Koha/Library.pm b/Koha/Library.pm
index 74172260e9..b6efcef1db 100644
--- a/Koha/Library.pm
+++ b/Koha/Library.pm
@@ -377,7 +377,7 @@ sub to_api_mapping {
$library->opac_info({ lang => $lang });
-Returns additional contents block OpacLibraryInfo for $lang or 'default'.
+Returns all additional contents blocks OpacLibraryInfo by library and $lang (or 'default').
Note: This replaces the former branches.opac_info column.
@@ -385,7 +385,7 @@ Note: This replaces the former branches.opac_info column.
sub opac_info {
my ( $self, $params ) = @_;
- return Koha::AdditionalContents->find_best_match(
+ return Koha::AdditionalContents->search_for_display(
{
category => 'html_customizations',
location => 'OpacLibraryInfo',
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt
index 89dc574b46..4d2bc18fe5 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt
@@ -29,6 +29,18 @@
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("lib/codemirror/codemirror.min.css") | $raw %]
[% Asset.css("lib/codemirror/lint.min.css") | $raw %]
+[% FILTER collapse %]
+
+[% END %]
@@ -330,10 +342,20 @@
[% IF OpacLibraryInfo %]
-
[% OpacLibraryInfo.content | $raw %]
- Edit HTML content
+ [% FOREACH info IN OpacLibraryInfo %]
+ [% IF library.branchcode == info.branchcode %]
+
[% info.content | $raw %]
+ [% IF ( CAN_user_tools_edit_additional_contents ) %]
+
+ Edit HTML content
+
+ [% END %]
+ [% END %]
+ [% END %]
[% ELSE %]
- Add HTML content
+ [% IF ( CAN_user_tools_edit_additional_contents ) %]
+ Add HTML content
+ [% END %]
[% END %]
@@ -741,7 +763,23 @@
OPAC information
-
[% OpacLibraryInfo.content | $raw %]
+ [% IF OpacLibraryInfo %]
+
+ [% FOREACH info IN OpacLibraryInfo %]
+ [% IF library.branchcode == info.branchcode %]
+
[% info.content | $raw %]
+ [% IF ( CAN_user_tools_edit_additional_contents ) %]
+
+ Edit HTML content
+
+ [% END %]
+ [% END %]
+ [% END %]
+ [% ELSE %]
+ [% IF ( CAN_user_tools_edit_additional_contents ) %]
+ Add HTML content
+ [% END %]
+ [% END %]
[% IF OpacLibraryInfo %][% OpacLibraryInfo.content | $raw %][% END %]
+
+ [% FOREACH info IN OpacLibraryInfo %]
+
[% info.content | $raw %]
+ [% END %]
+
[% END %]
[% BLOCK library_info %]
diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
index 211dac36ea..edf609cb02 100755
--- a/opac/opac-detail.pl
+++ b/opac/opac-detail.pl
@@ -718,8 +718,8 @@ if ( not $viewallitems and $items->count > $max_items_to_display ) {
$library_info->{ $item->holdingbranch } = $opac_info_holding;
$opac_info_home = $library_info->{ $item->homebranch } // $item->home_branch->opac_info( { lang => $lang } );
$library_info->{ $item->homebranch } = $opac_info_home;
- $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding;
- $item_info->{home_library_info} = $opac_info_home->content if $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;
# We only need to check if we haven't determined holds can be placed
# and if we don't have patron, we have already decided