@@ -, +, @@
---
.../bootstrap/en/modules/opac-detail.tt | 89 +++++++++++--------
opac/opac-detail.pl | 13 ++-
2 files changed, 66 insertions(+), 36 deletions(-)
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
+++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
@@ -1246,16 +1246,19 @@
- [% IF ( ITEM_RESULT.holding_branch.opac_info ) %]
-
- [% ITEM_RESULT.holding_branch.branchname | html %]
+ [%# Show opac_info or branchurl from holding library %]
+ [% SET holding_library_name = ITEM_RESULT.branchname %]
+ [% SET holding_library_url = Branches.GetURL( ITEM_RESULT.holdingbranch ) %]
+ [% IF ( ITEM_RESULT.holding_library_info ) %]
+
+ [% holding_library_name | html %]
- [% ELSIF ( ITEM_RESULT.holding_branch.branchurl ) %]
-
- [% ITEM_RESULT.holding_branch.branchname | html %]
+ [% ELSIF holding_library_url %]
+
+ [% holding_library_name | html %]
[% ELSE %]
- [% ITEM_RESULT.holding_branch.branchname | html %]
+ [% holding_library_name | html %]
[% END %]
[% IF ( Koha.Preference('OpacLocationOnDetail') == 'holding' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
@@ -1270,16 +1273,19 @@
- [% IF ( ITEM_RESULT.holding_branch.opac_info ) %] [%# FIXME Shouldn't this be home_branch instead of holding_branch? %]
-
- [% ITEM_RESULT.home_branch.branchname | html %]
+ [%# Show opac_info or branchurl from home library %]
+ [% SET home_library_name = Branches.GetName( ITEM_RESULT.homebranch ) %]
+ [% SET home_library_url = Branches.GetURL( ITEM_RESULT.homebranch ) %]
+ [% IF ( ITEM_RESULT.home_library_info ) %]
+
+ [% home_library_name | html %]
- [% ELSIF ( ITEM_RESULT.home_branch.branchurl ) %]
-
- [% ITEM_RESULT.home_branch.branchname | html %]
+ [% ELSIF home_library_url %]
+
+ [% home_library_name | html %]
[% ELSE %]
- [% ITEM_RESULT.home_branch.branchname | html %]
+ [% home_library_name | html %]
[% END %]
[% IF ( Koha.Preference('OpacLocationOnDetail') == 'home' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
@@ -1997,29 +2003,42 @@
$(".library_info").on("click", function(e){
e.preventDefault();
- var branchcode = $(this).data("branchcode");
+ var library_name = $(this).data("name");
+ var opac_info = $(this).data("info");
var url = $(this).attr("href");
- $.ajax({
- url: "/api/v1/public/libraries/" + branchcode,
- type: 'GET',
- dataType: 'json',
- success: function(result) {
- $("#libraryInfoModalLabel").html( result.name );
- $("#libraryInfo").html( result.opac_info );
- if( result.url ){
- $("#libraryInfoLink").attr("href", result.url );
- $("#libraryInfoLink").show();
- } else {
- $("#libraryInfoLink").hide();
- }
- $("#libraryInfoModal").modal("show");
- },
- error: function(xhr, status, error) {
- if( url ){
- location.href = url;
- }
+ if( 1 ) {
+ $("#libraryInfoModalLabel").html( library_name );
+ $("#libraryInfo").html( opac_info );
+ if( url ){
+ $("#libraryInfoLink").attr("href", url );
+ $("#libraryInfoLink").show();
+ } else {
+ $("#libraryInfoLink").hide();
}
- });
+ $("#libraryInfoModal").modal("show");
+ } else { // FIXME Temporary disabled: see BZ 29144
+ $.ajax({
+ url: "/api/v1/public/libraries/" + branchcode,
+ type: 'GET',
+ dataType: 'json',
+ success: function(result) {
+ $("#libraryInfoModalLabel").html( result.name );
+ $("#libraryInfo").html( opac_info );
+ if( result.url ){
+ $("#libraryInfoLink").attr("href", result.url );
+ $("#libraryInfoLink").show();
+ } else {
+ $("#libraryInfoLink").hide();
+ }
+ $("#libraryInfoModal").modal("show");
+ },
+ error: function(xhr, status, error) {
+ if( url ){
+ location.href = url;
+ }
+ }
+ });
+ }
});
$("#libraryInfoModal").on("hide.bs.modal", function(){
$("#libraryInfoModalLabel, #libraryInfo").html("");
--- a/opac/opac-detail.pl
+++ a/opac/opac-detail.pl
@@ -627,11 +627,12 @@ if ( $showcomp eq 'both' || $showcomp eq 'opac' ) {
# XSLT processing of some stuff
my $variables = {};
+my $lang = C4::Languages::getlanguage();
my @plugin_responses = Koha::Plugins->call(
'opac_detail_xslt_variables',
{
biblio_id => $biblionumber,
- lang => C4::Languages::getlanguage(),
+ lang => $lang,
patron_id => $borrowernumber,
},
);
@@ -680,11 +681,21 @@ if ( not $viewallitems and $items->count > $max_items_to_display ) {
);
}
else {
+ my $library_info;
while ( my $item = $items->next ) {
my $item_info = $item->unblessed;
$item_info->{holds_count} = $item_reserves{ $item->itemnumber };
$item_info->{priority} = $priority{ $item->itemnumber };
+ # 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 });
+ $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;
+
$allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy(
{ item => $item, patron => $patron } )
unless $allow_onshelf_holds;
--