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

(-)a/Koha/Biblio.pm (-2 / +8 lines)
Lines 951-957 Return all active recalls attached to this biblio, sorted by oldest first Link Here
951
=cut
951
=cut
952
952
953
sub recalls {
953
sub recalls {
954
    my ( $self ) = @_;
954
    my ( $self, $params ) = @_;
955
    if ( $params->{borrowernumber} ) {
956
        my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef, borrowernumber => $params->{borrowernumber} }, { order_by => { -asc => 'recalldate' } });
957
        return @recalls_rs;
958
    }
955
    my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef }, { order_by => { -asc => 'recalldate' } });
959
    my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef }, { order_by => { -asc => 'recalldate' } });
956
    return @recalls_rs;
960
    return @recalls_rs;
957
}
961
}
Lines 984-990 sub can_be_recalled { Link Here
984
    my @itemtypes;
988
    my @itemtypes;
985
    my @itemnumbers;
989
    my @itemnumbers;
986
    my @items;
990
    my @items;
991
    my @all_itemnumbers;
987
    foreach my $item ( @all_items ) {
992
    foreach my $item ( @all_items ) {
993
        push( @all_itemnumbers, $item->itemnumber );
988
        if ( $item->can_be_recalled({ patron => $patron }) ) {
994
        if ( $item->can_be_recalled({ patron => $patron }) ) {
989
            push( @itemtypes, $item->effective_itemtype );
995
            push( @itemtypes, $item->effective_itemtype );
990
            push( @itemnumbers, $item->itemnumber );
996
            push( @itemnumbers, $item->itemnumber );
Lines 1031-1037 sub can_be_recalled { Link Here
1031
        return 0 if ( $patron->recalls({ biblionumber => $self->biblionumber })->count >= $recalls_per_record );
1037
        return 0 if ( $patron->recalls({ biblionumber => $self->biblionumber })->count >= $recalls_per_record );
1032
1038
1033
        # check if any of the items under this biblio are already checked out by this borrower
1039
        # check if any of the items under this biblio are already checked out by this borrower
1034
        return 0 if ( Koha::Checkouts->search({ itemnumber => [ @itemnumbers ], borrowernumber => $patron->borrowernumber })->count > 0 );
1040
        return 0 if ( Koha::Checkouts->search({ itemnumber => [ @all_itemnumbers ], borrowernumber => $patron->borrowernumber })->count > 0 );
1035
    }
1041
    }
1036
1042
1037
    # check item availability
1043
    # check item availability
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/recalls.inc (-1 / +1 lines)
Lines 43-49 Link Here
43
43
44
                    [% UNLESS specific_patron %]
44
                    [% UNLESS specific_patron %]
45
                        <td class="recall-patron">
45
                        <td class="recall-patron">
46
                            <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% recall.borrowernumber | uri %]">[% recall.patron.firstname | html %] [% recall.patron.surname | html %] ([% recall.patron.cardnumber | html %])</a>
46
                            [% INCLUDE 'patron-title.inc' patron=recall.patron hide_patron_infos_if_needed=1 link_to="circulation_recalls" %]
47
                        </td>
47
                        </td>
48
                    [% END %]
48
                    [% END %]
49
49
(-)a/opac/opac-recall.pl (-1 / +1 lines)
Lines 46-52 if ( C4::Context->preference('UseRecalls') ) { Link Here
46
    my $items = Koha::Items->search({ biblionumber => $biblionumber });
46
    my $items = Koha::Items->search({ biblionumber => $biblionumber });
47
47
48
    # check if already recalled
48
    # check if already recalled
49
    my $recalled = scalar $biblio->recalls;
49
    my $recalled = scalar $biblio->recalls({ borrowernumber => $borrowernumber });
50
    if ( defined $recalled and $recalled > 0 ) {
50
    if ( defined $recalled and $recalled > 0 ) {
51
        my $recalls_per_record = Koha::CirculationRules->get_effective_rule({
51
        my $recalls_per_record = Koha::CirculationRules->get_effective_rule({
52
            categorycode => $patron->categorycode,
52
            categorycode => $patron->categorycode,
(-)a/recalls/request.pl (-2 / +2 lines)
Lines 18-25 Link Here
18
18
19
use Modern::Perl;
19
use Modern::Perl;
20
use CGI qw ( -utf8 );
20
use CGI qw ( -utf8 );
21
use C4::Auth;
21
use C4::Auth qw( get_template_and_user );
22
use C4::Output;
22
use C4::Output qw( output_html_with_http_headers );
23
use C4::Search;
23
use C4::Search;
24
use Koha::Recalls;
24
use Koha::Recalls;
25
use Koha::Biblios;
25
use Koha::Biblios;
(-)a/t/db_dependent/Holds.t (-1 / +1 lines)
Lines 7-13 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 72;
10
use Test::More tests => 73;
11
use MARC::Record;
11
use MARC::Record;
12
12
13
use C4::Biblio;
13
use C4::Biblio;
(-)a/t/db_dependent/Koha/Recall.t (-1 / +1 lines)
Lines 21-27 use Test::More tests => 27; Link Here
21
use t::lib::TestBuilder;
21
use t::lib::TestBuilder;
22
use t::lib::Mocks;
22
use t::lib::Mocks;
23
23
24
use Koha::DateUtils;
24
use Koha::DateUtils qw( dt_from_string );
25
25
26
BEGIN {
26
BEGIN {
27
    require_ok('Koha::Recall');
27
    require_ok('Koha::Recall');
(-)a/t/db_dependent/Koha/Recalls.t (-1 / +1 lines)
Lines 21-27 use Test::More tests => 19; Link Here
21
use t::lib::TestBuilder;
21
use t::lib::TestBuilder;
22
use t::lib::Mocks;
22
use t::lib::Mocks;
23
23
24
use Koha::DateUtils;
24
use Koha::DateUtils qw( dt_from_string );
25
25
26
BEGIN {
26
BEGIN {
27
    require_ok('Koha::Recall');
27
    require_ok('Koha::Recall');
(-)a/t/db_dependent/XSLT.t (-3 / +2 lines)
Lines 131-137 subtest 'buildKohaItemsNamespace status tests' => sub { Link Here
131
        }
131
        }
132
    });
132
    });
133
    $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
133
    $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
134
    like($xml,qr{<substatus>Waiting</substatus>},"Waiting status takes precedence over In transit (holds)");
134
    like($xml,qr{<substatus>Hold waiting</substatus>},"Waiting status takes precedence over In transit (holds)");
135
    $hold->cancel;
135
    $hold->cancel;
136
136
137
    $builder->build({ source => "TmpHoldsqueue", value => {
137
    $builder->build({ source => "TmpHoldsqueue", value => {
Lines 151-157 subtest 'buildKohaItemsNamespace status tests' => sub { Link Here
151
    }});
151
    }});
152
    $recall->set_waiting;
152
    $recall->set_waiting;
153
    $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
153
    $xml = C4::XSLT::buildKohaItemsNamespace( $item->biblionumber,[]);
154
    like($xml,qr{<status>Waiting</status>},"Waiting status takes precedence over In transit (recalls)");
154
    like($xml,qr{<substatus>Recall waiting</substatus>},"Waiting status takes precedence over In transit (recalls)");
155
155
156
};
156
};
157
157
158
- 

Return to bug 19532