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 1246-1261 Link Here
1246
                        <link property="itemOffered" href="#record" />
1246
                        <link property="itemOffered" href="#record" />
1247
                        <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
1247
                        <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
1248
1248
1249
                        [% IF ( ITEM_RESULT.holding_branch_opac_info ) %]
1249
                        [%# Show opac_info or branchurl from holding library %]
1250
                            <a href="[% ITEM_RESULT.branchurl | url %]" class="library_info" data-branchcode="[% ITEM_RESULT.branchcode | html %]">
1250
                        [% SET holding_library_name = ITEM_RESULT.branchname %]
1251
                                <i class="fa fa-info-circle" aria-hidden="true"></i> [% ITEM_RESULT.branchname | html %]
1251
                        [% SET holding_library_url = Branches.GetURL( ITEM_RESULT.holdingbranch ) %]
1252
                        [% IF ( ITEM_RESULT.holding_library_info ) %]
1253
                            <a href="[% holding_library_url | url %]" class="library_info" data-info="[% ITEM_RESULT.holding_library_info | html %]" data-name="[% holding_library_name | html %]">
1254
                                <i class="fa fa-info-circle" aria-hidden="true"></i> [% holding_library_name | html %]
1252
                            </a>
1255
                            </a>
1253
                        [% ELSIF ( ITEM_RESULT.branchurl ) %]
1256
                        [% ELSIF holding_library_url %]
1254
                            <a href="[% ITEM_RESULT.branchurl | url %]">
1257
                            <a href="[% holding_library_url | url %]">
1255
                                [% ITEM_RESULT.branchname | html %]
1258
                                [% holding_library_name | html %]
1256
                            </a>
1259
                            </a>
1257
                        [% ELSE %]
1260
                        [% ELSE %]
1258
                            <span>[% ITEM_RESULT.branchname | html %]</span>
1261
                            <span>[% holding_library_name | html %]</span>
1259
                        [% END %]
1262
                        [% END %]
1260
1263
1261
                        [% IF ( Koha.Preference('OpacLocationOnDetail') == 'holding' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
1264
                        [% IF ( Koha.Preference('OpacLocationOnDetail') == 'holding' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
Lines 1270-1285 Link Here
1270
                        <link property="itemOffered" href="#record" />
1273
                        <link property="itemOffered" href="#record" />
1271
                        <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
1274
                        <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
1272
1275
1273
                        [% IF ( ITEM_RESULT.holding_branch_opac_info ) %]
1276
                        [%# Show opac_info or branchurl from home library %]
1274
                            <a href="[% Branches.GetURL( ITEM_RESULT.homebranch ) | url %]" class="library_info" data-branchcode="[% ITEM_RESULT.homebranch | html %]">
1277
                        [% SET home_library_name = Branches.GetName( ITEM_RESULT.homebranch ) %]
1275
                                <i class="fa fa-info-circle" aria-hidden="true"></i> [% Branches.GetName( ITEM_RESULT.homebranch ) | html %]
1278
                        [% SET home_library_url = Branches.GetURL( ITEM_RESULT.homebranch ) %]
1279
                        [% IF ( ITEM_RESULT.home_library_info ) %]
1280
                            <a href="[% home_library_url | url %]" class="library_info" data-info="[% ITEM_RESULT.home_library_info | html %]" data-name="[% home_library_name | html %]">
1281
                                <i class="fa fa-info-circle" aria-hidden="true"></i> [% home_library_name | html %]
1276
                            </a>
1282
                            </a>
1277
                        [% ELSIF ( Branches.GetURL( ITEM_RESULT.homebranch ) ) %]
1283
                        [% ELSIF home_library_url %]
1278
                            <a href="[% Branches.GetURL( ITEM_RESULT.homebranch ) | url %]">
1284
                            <a href="[% home_library_url | url %]">
1279
                                [% Branches.GetName( ITEM_RESULT.homebranch ) | html %]
1285
                                [% home_library_name | html %]
1280
                            </a>
1286
                            </a>
1281
                        [% ELSE %]
1287
                        [% ELSE %]
1282
                            <span>[% Branches.GetName( ITEM_RESULT.homebranch ) | html %]</span>
1288
                            <span>[% home_library_name | html %]</span>
1283
                        [% END %]
1289
                        [% END %]
1284
1290
1285
                        [% IF ( Koha.Preference('OpacLocationOnDetail') == 'home' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
1291
                        [% IF ( Koha.Preference('OpacLocationOnDetail') == 'home' || Koha.Preference('OpacLocationOnDetail') == 'both' ) %]
Lines 1991-2019 Link Here
1991
1997
1992
            $(".library_info").on("click", function(e){
1998
            $(".library_info").on("click", function(e){
1993
                e.preventDefault();
1999
                e.preventDefault();
1994
                var branchcode = $(this).data("branchcode");
2000
                var library_name = $(this).data("name");
2001
                var opac_info = $(this).data("info");
1995
                var url = $(this).attr("href");
2002
                var url = $(this).attr("href");
1996
                $.ajax({
2003
                if( 1 ) {
1997
                    url: "/api/v1/public/libraries/" + branchcode,
2004
                    $("#libraryInfoModalLabel").html( library_name );
1998
                    type: 'GET',
2005
                    $("#libraryInfo").html( opac_info );
1999
                    dataType: 'json',
2006
                    if( url ){
2000
                    success: function(result) {
2007
                        $("#libraryInfoLink").attr("href", url );
2001
                        $("#libraryInfoModalLabel").html( result.name );
2008
                        $("#libraryInfoLink").show();
2002
                        $("#libraryInfo").html( result.opac_info );
2009
                    } else {
2003
                        if( result.url ){
2010
                        $("#libraryInfoLink").hide();
2004
                            $("#libraryInfoLink").attr("href", result.url );
2005
                            $("#libraryInfoLink").show();
2006
                        } else {
2007
                            $("#libraryInfoLink").hide();
2008
                        }
2009
                        $("#libraryInfoModal").modal("show");
2010
                    },
2011
                    error: function(xhr, status, error) {
2012
                        if( url ){
2013
                            location.href = url;
2014
                        }
2015
                    }
2011
                    }
2016
                });
2012
                    $("#libraryInfoModal").modal("show");
2013
                } else { // FIXME Temporary disabled: see BZ 29144
2014
                    $.ajax({
2015
                        url: "/api/v1/public/libraries/" + branchcode,
2016
                        type: 'GET',
2017
                        dataType: 'json',
2018
                        success: function(result) {
2019
                            $("#libraryInfoModalLabel").html( result.name );
2020
                            $("#libraryInfo").html( opac_info );
2021
                            if( result.url ){
2022
                                $("#libraryInfoLink").attr("href", result.url );
2023
                                $("#libraryInfoLink").show();
2024
                            } else {
2025
                                $("#libraryInfoLink").hide();
2026
                            }
2027
                            $("#libraryInfoModal").modal("show");
2028
                        },
2029
                        error: function(xhr, status, error) {
2030
                            if( url ){
2031
                                location.href = url;
2032
                            }
2033
                        }
2034
                    });
2035
                }
2017
            });
2036
            });
2018
            $("#libraryInfoModal").on("hide.bs.modal", function(){
2037
            $("#libraryInfoModal").on("hide.bs.modal", function(){
2019
                $("#libraryInfoModalLabel, #libraryInfo").html("");
2038
                $("#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