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.holding_branch.branchurl | url %]" class="library_info" data-branchcode="[% ITEM_RESULT.holding_branch.branchcode | html %]">
1250
                        [% SET holding_library_name = ITEM_RESULT.branchname %]
1251
                                <i class="fa fa-info-circle" aria-hidden="true"></i> [% ITEM_RESULT.holding_branch.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.holding_branch.branchurl ) %]
1256
                        [% ELSIF holding_library_url %]
1254
                            <a href="[% ITEM_RESULT.branchurl | url %]">
1257
                            <a href="[% holding_library_url | url %]">
1255
                                [% ITEM_RESULT.holding_branch.branchname | html %]
1258
                                [% holding_library_name | html %]
1256
                            </a>
1259
                            </a>
1257
                        [% ELSE %]
1260
                        [% ELSE %]
1258
                            <span>[% ITEM_RESULT.holding_branch.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 ) %] [%# FIXME Shouldn't this be home_branch instead of holding_branch? %]
1276
                        [%# Show opac_info or branchurl from home library %]
1274
                            <a href="[% ITEM_RESULT.home_branch.branchurl | url %]" class="library_info" data-branchcode="[% ITEM_RESULT.home_branch.branchchode | html %]">
1277
                        [% SET home_library_name = Branches.GetName( ITEM_RESULT.homebranch ) %]
1275
                                <i class="fa fa-info-circle" aria-hidden="true"></i> [% ITEM_RESULT.home_branch.branchname | 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 ( ITEM_RESULT.home_branch.branchurl ) %]
1283
                        [% ELSIF home_library_url %]
1278
                            <a href="[% ITEM_RESULT.home_branch.branchurl | url %]">
1284
                            <a href="[% home_library_url | url %]">
1279
                                [% ITEM_RESULT.home_branch.branchname | html %]
1285
                                [% home_library_name | html %]
1280
                            </a>
1286
                            </a>
1281
                        [% ELSE %]
1287
                        [% ELSE %]
1282
                            <span>[% ITEM_RESULT.home_branch.branchname | 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 1955-1983 Link Here
1955
1961
1956
            $(".library_info").on("click", function(e){
1962
            $(".library_info").on("click", function(e){
1957
                e.preventDefault();
1963
                e.preventDefault();
1958
                var branchcode = $(this).data("branchcode");
1964
                var library_name = $(this).data("name");
1965
                var opac_info = $(this).data("info");
1959
                var url = $(this).attr("href");
1966
                var url = $(this).attr("href");
1960
                $.ajax({
1967
                if( 1 ) {
1961
                    url: "/api/v1/public/libraries/" + branchcode,
1968
                    $("#libraryInfoModalLabel").html( library_name );
1962
                    type: 'GET',
1969
                    $("#libraryInfo").html( opac_info );
1963
                    dataType: 'json',
1970
                    if( url ){
1964
                    success: function(result) {
1971
                        $("#libraryInfoLink").attr("href", url );
1965
                        $("#libraryInfoModalLabel").html( result.name );
1972
                        $("#libraryInfoLink").show();
1966
                        $("#libraryInfo").html( result.opac_info );
1973
                    } else {
1967
                        if( result.url ){
1974
                        $("#libraryInfoLink").hide();
1968
                            $("#libraryInfoLink").attr("href", result.url );
1969
                            $("#libraryInfoLink").show();
1970
                        } else {
1971
                            $("#libraryInfoLink").hide();
1972
                        }
1973
                        $("#libraryInfoModal").modal("show");
1974
                    },
1975
                    error: function(xhr, status, error) {
1976
                        if( url ){
1977
                            location.href = url;
1978
                        }
1979
                    }
1975
                    }
1980
                });
1976
                    $("#libraryInfoModal").modal("show");
1977
                } else { // FIXME Temporary disabled: see BZ 29144
1978
                    $.ajax({
1979
                        url: "/api/v1/public/libraries/" + branchcode,
1980
                        type: 'GET',
1981
                        dataType: 'json',
1982
                        success: function(result) {
1983
                            $("#libraryInfoModalLabel").html( result.name );
1984
                            $("#libraryInfo").html( opac_info );
1985
                            if( result.url ){
1986
                                $("#libraryInfoLink").attr("href", result.url );
1987
                                $("#libraryInfoLink").show();
1988
                            } else {
1989
                                $("#libraryInfoLink").hide();
1990
                            }
1991
                            $("#libraryInfoModal").modal("show");
1992
                        },
1993
                        error: function(xhr, status, error) {
1994
                            if( url ){
1995
                                location.href = url;
1996
                            }
1997
                        }
1998
                    });
1999
                }
1981
            });
2000
            });
1982
            $("#libraryInfoModal").on("hide.bs.modal", function(){
2001
            $("#libraryInfoModal").on("hide.bs.modal", function(){
1983
                $("#libraryInfoModalLabel, #libraryInfo").html("");
2002
                $("#libraryInfoModalLabel, #libraryInfo").html("");
(-)a/opac/opac-detail.pl (-2 / +12 lines)
Lines 626-636 if ( $showcomp eq 'both' || $showcomp eq 'opac' ) { Link Here
626
626
627
# XSLT processing of some stuff
627
# XSLT processing of some stuff
628
my $variables = {};
628
my $variables = {};
629
my $lang = C4::Languages::getlanguage();
629
my @plugin_responses = Koha::Plugins->call(
630
my @plugin_responses = Koha::Plugins->call(
630
    'opac_detail_xslt_variables',
631
    'opac_detail_xslt_variables',
631
    {
632
    {
632
        biblio_id => $biblionumber,
633
        biblio_id => $biblionumber,
633
        lang      => C4::Languages::getlanguage(),
634
        lang      => $lang,
634
        patron_id => $borrowernumber,
635
        patron_id => $borrowernumber,
635
    },
636
    },
636
);
637
);
Lines 679-689 if ( not $viewallitems and $items->count > $max_items_to_display ) { Link Here
679
    );
680
    );
680
}
681
}
681
else {
682
else {
683
    my $library_info;
682
    while ( my $item = $items->next ) {
684
    while ( my $item = $items->next ) {
683
        my $item_info = $item->unblessed;
685
        my $item_info = $item->unblessed;
684
        $item_info->{holds_count} = $item_reserves{ $item->itemnumber };
686
        $item_info->{holds_count} = $item_reserves{ $item->itemnumber };
685
        $item_info->{priority}    = $priority{ $item->itemnumber };
687
        $item_info->{priority}    = $priority{ $item->itemnumber };
686
688
689
        # Get opac_info from Additional contents for home and holding library
690
        my ( $opac_info_home, $opac_info_holding );
691
        $opac_info_holding = $library_info->{ $item->holdingbranch } // $item->holding_branch->opac_info({ lang => $lang });
692
        $library_info->{ $item->holdingbranch } = $opac_info_holding;
693
        $opac_info_home = $library_info->{ $item->homebranch } // $item->home_branch->opac_info({ lang => $lang });
694
        $library_info->{ $item->homebranch } = $opac_info_home;
695
        $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding;
696
        $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home;
697
687
        $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy(
698
        $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy(
688
            { item => $item, patron => $patron } )
699
            { item => $item, patron => $patron } )
689
          unless $allow_onshelf_holds;
700
          unless $allow_onshelf_holds;
690
- 

Return to bug 29144