View | Details | Raw Unified | Return to bug 29144
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt (-35 / +54 lines)
Lines 1226-1241 Link Here
1226
                        <link property="itemOffered" href="#record" />
1226
                        <link property="itemOffered" href="#record" />
1227
                        <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
1227
                        <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
1228
1228
1229
                        [% IF ( ITEM_RESULT.holding_branch_opac_info ) %]
1229
                        [%# Show opac_info or branchurl from holding library %]
1230
                            <a href="[% ITEM_RESULT.branchurl | url %]" class="library_info" data-branchcode="[% ITEM_RESULT.branchcode | html %]">
1230
                        [% SET holding_library_name = ITEM_RESULT.branchname %]
1231
                                <i class="fa fa-info-circle" aria-hidden="true"></i> [% ITEM_RESULT.branchname | html %]
1231
                        [% SET holding_library_url = Branches.GetURL( ITEM_RESULT.holdingbranch ) %]
1232
                        [% IF ( ITEM_RESULT.holding_library_info ) %]
1233
                            <a href="[% holding_library_url | url %]" class="library_info" data-info="[% ITEM_RESULT.holding_library_info | html %]" data-name="[% holding_library_name | html %]">
1234
                                <i class="fa fa-info-circle" aria-hidden="true"></i> [% holding_library_name | html %]
1232
                            </a>
1235
                            </a>
1233
                        [% ELSIF ( ITEM_RESULT.branchurl ) %]
1236
                        [% ELSIF holding_library_url %]
1234
                            <a href="[% ITEM_RESULT.branchurl | url %]">
1237
                            <a href="[% holding_library_url | url %]">
1235
                                [% ITEM_RESULT.branchname | html %]
1238
                                [% holding_library_name | html %]
1236
                            </a>
1239
                            </a>
1237
                        [% ELSE %]
1240
                        [% ELSE %]
1238
                            <span>[% ITEM_RESULT.branchname | html %]</span>
1241
                            <span>[% holding_library_name | html %]</span>
1239
                        [% END %]
1242
                        [% END %]
1240
1243
1241
                        [% IF ( Koha.Preference('OpacLocationOnDetail') == 'holding' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
1244
                        [% IF ( Koha.Preference('OpacLocationOnDetail') == 'holding' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
Lines 1250-1265 Link Here
1250
                        <link property="itemOffered" href="#record" />
1253
                        <link property="itemOffered" href="#record" />
1251
                        <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
1254
                        <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
1252
1255
1253
                        [% IF ( ITEM_RESULT.holding_branch_opac_info ) %]
1256
                        [%# Show opac_info or branchurl from home library %]
1254
                            <a href="[% Branches.GetURL( ITEM_RESULT.homebranch ) | url %]" class="library_info" data-branchcode="[% ITEM_RESULT.homebranch | html %]">
1257
                        [% SET home_library_name = Branches.GetName( ITEM_RESULT.homebranch ) %]
1255
                                <i class="fa fa-info-circle" aria-hidden="true"></i> [% Branches.GetName( ITEM_RESULT.homebranch ) | html %]
1258
                        [% SET home_library_url = Branches.GetURL( ITEM_RESULT.homebranch ) %]
1259
                        [% IF ( ITEM_RESULT.home_library_info ) %]
1260
                            <a href="[% home_library_url | url %]" class="library_info" data-info="[% ITEM_RESULT.home_library_info | html %]" data-name="[% home_library_name | html %]">
1261
                                <i class="fa fa-info-circle" aria-hidden="true"></i> [% home_library_name | html %]
1256
                            </a>
1262
                            </a>
1257
                        [% ELSIF ( Branches.GetURL( ITEM_RESULT.homebranch ) ) %]
1263
                        [% ELSIF home_library_url %]
1258
                            <a href="[% Branches.GetURL( ITEM_RESULT.homebranch ) | url %]">
1264
                            <a href="[% home_library_url | url %]">
1259
                                [% Branches.GetName( ITEM_RESULT.homebranch ) | html %]
1265
                                [% home_library_name | html %]
1260
                            </a>
1266
                            </a>
1261
                        [% ELSE %]
1267
                        [% ELSE %]
1262
                            <span>[% Branches.GetName( ITEM_RESULT.homebranch ) | html %]</span>
1268
                            <span>[% home_library_name | html %]</span>
1263
                        [% END %]
1269
                        [% END %]
1264
1270
1265
                        [% IF ( Koha.Preference('OpacLocationOnDetail') == 'home' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
1271
                        [% IF ( Koha.Preference('OpacLocationOnDetail') == 'home' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
Lines 1971-1999 Link Here
1971
1977
1972
            $(".library_info").on("click", function(e){
1978
            $(".library_info").on("click", function(e){
1973
                e.preventDefault();
1979
                e.preventDefault();
1974
                var branchcode = $(this).data("branchcode");
1980
                var library_name = $(this).data("name");
1981
                var opac_info = $(this).data("info");
1975
                var url = $(this).attr("href");
1982
                var url = $(this).attr("href");
1976
                $.ajax({
1983
                if( 1 ) {
1977
                    url: "/api/v1/public/libraries/" + branchcode,
1984
                    $("#libraryInfoModalLabel").html( library_name );
1978
                    type: 'GET',
1985
                    $("#libraryInfo").html( opac_info );
1979
                    dataType: 'json',
1986
                    if( url ){
1980
                    success: function(result) {
1987
                        $("#libraryInfoLink").attr("href", url );
1981
                        $("#libraryInfoModalLabel").html( result.name );
1988
                        $("#libraryInfoLink").show();
1982
                        $("#libraryInfo").html( result.opac_info );
1989
                    } else {
1983
                        if( result.url ){
1990
                        $("#libraryInfoLink").hide();
1984
                            $("#libraryInfoLink").attr("href", result.url );
1985
                            $("#libraryInfoLink").show();
1986
                        } else {
1987
                            $("#libraryInfoLink").hide();
1988
                        }
1989
                        $("#libraryInfoModal").modal("show");
1990
                    },
1991
                    error: function(xhr, status, error) {
1992
                        if( url ){
1993
                            location.href = url;
1994
                        }
1995
                    }
1991
                    }
1996
                });
1992
                    $("#libraryInfoModal").modal("show");
1993
                } else { // FIXME Temporary disabled: see BZ 29144
1994
                    $.ajax({
1995
                        url: "/api/v1/public/libraries/" + branchcode,
1996
                        type: 'GET',
1997
                        dataType: 'json',
1998
                        success: function(result) {
1999
                            $("#libraryInfoModalLabel").html( result.name );
2000
                            $("#libraryInfo").html( opac_info );
2001
                            if( result.url ){
2002
                                $("#libraryInfoLink").attr("href", result.url );
2003
                                $("#libraryInfoLink").show();
2004
                            } else {
2005
                                $("#libraryInfoLink").hide();
2006
                            }
2007
                            $("#libraryInfoModal").modal("show");
2008
                        },
2009
                        error: function(xhr, status, error) {
2010
                            if( url ){
2011
                                location.href = url;
2012
                            }
2013
                        }
2014
                    });
2015
                }
1997
            });
2016
            });
1998
            $("#libraryInfoModal").on("hide.bs.modal", function(){
2017
            $("#libraryInfoModal").on("hide.bs.modal", function(){
1999
                $("#libraryInfoModalLabel, #libraryInfo").html("");
2018
                $("#libraryInfoModalLabel, #libraryInfo").html("");
(-)a/opac/opac-detail.pl (-2 / +12 lines)
Lines 657-667 if ( $showcomp eq 'both' || $showcomp eq 'opac' ) { Link Here
657
657
658
# XSLT processing of some stuff
658
# XSLT processing of some stuff
659
my $variables = {};
659
my $variables = {};
660
my $lang = C4::Languages::getlanguage();
660
my @plugin_responses = Koha::Plugins->call(
661
my @plugin_responses = Koha::Plugins->call(
661
    'opac_detail_xslt_variables',
662
    'opac_detail_xslt_variables',
662
    {
663
    {
663
        biblio_id => $biblionumber,
664
        biblio_id => $biblionumber,
664
        lang      => C4::Languages::getlanguage(),
665
        lang      => $lang,
665
        patron_id => $borrowernumber,
666
        patron_id => $borrowernumber,
666
    },
667
    },
667
);
668
);
Lines 709-719 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
709
        items_count => scalar( @items ),
710
        items_count => scalar( @items ),
710
    );
711
    );
711
} else {
712
} else {
713
  my $library_info;
712
  for my $itm (@items) {
714
  for my $itm (@items) {
713
    my $item = Koha::Items->find( $itm->{itemnumber} );
715
    my $item = Koha::Items->find( $itm->{itemnumber} );
714
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
716
    $itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
715
    $itm->{priority} = $priority{ $itm->{itemnumber} };
717
    $itm->{priority} = $priority{ $itm->{itemnumber} };
716
718
719
    # Get opac_info from Additional contents for home and holding library
720
    my ( $opac_info_home, $opac_info_holding );
721
    $opac_info_holding = $library_info->{ $itm->{holdingbranch} } // $item->holding_branch->opac_info({ lang => $lang });
722
    $library_info->{ $itm->{holdingbranch} } = $opac_info_holding;
723
    $opac_info_home = $library_info->{ $itm->{homebranch} } // $item->home_branch->opac_info({ lang => $lang });
724
    $library_info->{ $itm->{homebranch} } = $opac_info_home;
725
    $itm->{holding_library_info} = $opac_info_holding->content if $opac_info_holding;
726
    $itm->{home_library_info} = $opac_info_home->content if $opac_info_home;
727
717
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
728
    $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy( { item => $item, patron => $patron } )
718
      unless $allow_onshelf_holds;
729
      unless $allow_onshelf_holds;
719
730
720
- 

Return to bug 29144