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 1997-2025 Link Here
1997
2003
1998
            $(".library_info").on("click", function(e){
2004
            $(".library_info").on("click", function(e){
1999
                e.preventDefault();
2005
                e.preventDefault();
2000
                var branchcode = $(this).data("branchcode");
2006
                var library_name = $(this).data("name");
2007
                var opac_info = $(this).data("info");
2001
                var url = $(this).attr("href");
2008
                var url = $(this).attr("href");
2002
                $.ajax({
2009
                if( 1 ) {
2003
                    url: "/api/v1/public/libraries/" + branchcode,
2010
                    $("#libraryInfoModalLabel").html( library_name );
2004
                    type: 'GET',
2011
                    $("#libraryInfo").html( opac_info );
2005
                    dataType: 'json',
2012
                    if( url ){
2006
                    success: function(result) {
2013
                        $("#libraryInfoLink").attr("href", url );
2007
                        $("#libraryInfoModalLabel").html( result.name );
2014
                        $("#libraryInfoLink").show();
2008
                        $("#libraryInfo").html( result.opac_info );
2015
                    } else {
2009
                        if( result.url ){
2016
                        $("#libraryInfoLink").hide();
2010
                            $("#libraryInfoLink").attr("href", result.url );
2011
                            $("#libraryInfoLink").show();
2012
                        } else {
2013
                            $("#libraryInfoLink").hide();
2014
                        }
2015
                        $("#libraryInfoModal").modal("show");
2016
                    },
2017
                    error: function(xhr, status, error) {
2018
                        if( url ){
2019
                            location.href = url;
2020
                        }
2021
                    }
2017
                    }
2022
                });
2018
                    $("#libraryInfoModal").modal("show");
2019
                } else { // FIXME Temporary disabled: see BZ 29144
2020
                    $.ajax({
2021
                        url: "/api/v1/public/libraries/" + branchcode,
2022
                        type: 'GET',
2023
                        dataType: 'json',
2024
                        success: function(result) {
2025
                            $("#libraryInfoModalLabel").html( result.name );
2026
                            $("#libraryInfo").html( opac_info );
2027
                            if( result.url ){
2028
                                $("#libraryInfoLink").attr("href", result.url );
2029
                                $("#libraryInfoLink").show();
2030
                            } else {
2031
                                $("#libraryInfoLink").hide();
2032
                            }
2033
                            $("#libraryInfoModal").modal("show");
2034
                        },
2035
                        error: function(xhr, status, error) {
2036
                            if( url ){
2037
                                location.href = url;
2038
                            }
2039
                        }
2040
                    });
2041
                }
2023
            });
2042
            });
2024
            $("#libraryInfoModal").on("hide.bs.modal", function(){
2043
            $("#libraryInfoModal").on("hide.bs.modal", function(){
2025
                $("#libraryInfoModalLabel, #libraryInfo").html("");
2044
                $("#libraryInfoModalLabel, #libraryInfo").html("");
(-)a/opac/opac-detail.pl (-2 / +12 lines)
Lines 627-637 if ( $showcomp eq 'both' || $showcomp eq 'opac' ) { Link Here
627
627
628
# XSLT processing of some stuff
628
# XSLT processing of some stuff
629
my $variables = {};
629
my $variables = {};
630
my $lang = C4::Languages::getlanguage();
630
my @plugin_responses = Koha::Plugins->call(
631
my @plugin_responses = Koha::Plugins->call(
631
    'opac_detail_xslt_variables',
632
    'opac_detail_xslt_variables',
632
    {
633
    {
633
        biblio_id => $biblionumber,
634
        biblio_id => $biblionumber,
634
        lang      => C4::Languages::getlanguage(),
635
        lang      => $lang,
635
        patron_id => $borrowernumber,
636
        patron_id => $borrowernumber,
636
    },
637
    },
637
);
638
);
Lines 680-690 if ( not $viewallitems and $items->count > $max_items_to_display ) { Link Here
680
    );
681
    );
681
}
682
}
682
else {
683
else {
684
    my $library_info;
683
    while ( my $item = $items->next ) {
685
    while ( my $item = $items->next ) {
684
        my $item_info = $item->unblessed;
686
        my $item_info = $item->unblessed;
685
        $item_info->{holds_count} = $item_reserves{ $item->itemnumber };
687
        $item_info->{holds_count} = $item_reserves{ $item->itemnumber };
686
        $item_info->{priority}    = $priority{ $item->itemnumber };
688
        $item_info->{priority}    = $priority{ $item->itemnumber };
687
689
690
        # Get opac_info from Additional contents for home and holding library
691
        my ( $opac_info_home, $opac_info_holding );
692
        $opac_info_holding = $library_info->{ $item->holdingbranch } // $item->holding_branch->opac_info({ lang => $lang });
693
        $library_info->{ $item->holdingbranch } = $opac_info_holding;
694
        $opac_info_home = $library_info->{ $item->homebranch } // $item->home_branch->opac_info({ lang => $lang });
695
        $library_info->{ $item->homebranch } = $opac_info_home;
696
        $item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding;
697
        $item_info->{home_library_info} = $opac_info_home->content if $opac_info_home;
698
688
        $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy(
699
        $allow_onshelf_holds = Koha::CirculationRules->get_onshelfholds_policy(
689
            { item => $item, patron => $patron } )
700
            { item => $item, patron => $patron } )
690
          unless $allow_onshelf_holds;
701
          unless $allow_onshelf_holds;
691
- 

Return to bug 29144