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

(-)a/catalogue/search.pl (+16 lines)
Lines 160-165 use Koha::SearchFilters; Link Here
160
160
161
use URI::Escape;
161
use URI::Escape;
162
use JSON qw( decode_json encode_json );
162
use JSON qw( decode_json encode_json );
163
use Koha::DateUtils qw( dt_from_string );
163
164
164
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
165
my $DisplayMultiPlaceHold = C4::Context->preference("DisplayMultiPlaceHold");
165
166
Lines 694-699 if ($hits) { Link Here
694
            $line->{has_local_cover_image} =
695
            $line->{has_local_cover_image} =
695
                $line->{biblio_object} ? $line->{biblio_object}->cover_images->count : 0;
696
                $line->{biblio_object} ? $line->{biblio_object}->cover_images->count : 0;
696
        }
697
        }
698
699
        if ( $line->{biblio_object} ) {
700
            my $bookable_items_count = $line->{biblio_object}->bookable_items->count;
701
            if ( $bookable_items_count > 0 ) {
702
                my $today = dt_from_string()->ymd;
703
                $line->{future_bookings_count} = $line->{biblio_object}->bookings->search({
704
                    start_date => { '>=' => $today },
705
                    status => { '-not_in' => ['cancelled', 'completed'] }
706
                })->count;
707
                $line->{has_bookable_items} = 1;
708
            } else {
709
                $line->{future_bookings_count} = 0;
710
                $line->{has_bookable_items} = 0;
711
            }
712
        }
697
    }
713
    }
698
    my (
714
    my (
699
        $page_numbers, $hits_to_paginate, $pages, $current_page_number, $previous_page_offset, $next_page_offset,
715
        $page_numbers, $hits_to_paginate, $pages, $current_page_number, $previous_page_offset, $next_page_offset,
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-1 / +3 lines)
Lines 708-713 Link Here
708
                                                [% ELSE %]
708
                                                [% ELSE %]
709
                                                    <span>Holds ([% SEARCH_RESULT.biblio_object.holds.count | html %])</span>
709
                                                    <span>Holds ([% SEARCH_RESULT.biblio_object.holds.count | html %])</span>
710
                                                [% END %]
710
                                                [% END %]
711
                                                [% IF Koha.Preference('EnableBooking') && CAN_user_circulate_manage_bookings && SEARCH_RESULT.has_bookable_items %]
712
                                                    | <a href="/cgi-bin/koha/bookings/list.pl?biblionumber=[% SEARCH_RESULT.biblionumber | html %]#bookings">Bookings ([% SEARCH_RESULT.future_bookings_count | html %])</a>
713
                                                [% END %]
711
                                            [% END # /IF SEARCH_RESULT.norequests %]
714
                                            [% END # /IF SEARCH_RESULT.norequests %]
712
                                            [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %]
715
                                            [% IF Koha.Preference('UseRecalls') and CAN_user_recalls %]
713
                                                |
716
                                                |
714
- 

Return to bug 42000