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

(-)a/C4/XSLT.pm (-2 / +3 lines)
Lines 352-358 sub buildKohaItemsNamespace { Link Here
352
352
353
        if ( $recalls->count ) {
353
        if ( $recalls->count ) {
354
            # recalls take priority over holds
354
            # recalls take priority over holds
355
            $status = 'Waiting';
355
            $status = 'other';
356
            $substatus = 'Recall waiting';
356
        }
357
        }
357
        elsif ( $item->has_pending_hold ) {
358
        elsif ( $item->has_pending_hold ) {
358
            $status = 'other';
359
            $status = 'other';
Lines 360-366 sub buildKohaItemsNamespace { Link Here
360
        }
361
        }
361
        elsif ( $item->holds->waiting->count ) {
362
        elsif ( $item->holds->waiting->count ) {
362
            $status = 'other';
363
            $status = 'other';
363
            $substatus = 'Waiting';
364
            $substatus = 'Hold waiting';
364
        }
365
        }
365
        elsif ($item->get_transfer) {
366
        elsif ($item->get_transfer) {
366
            $status = 'other';
367
            $status = 'other';
(-)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/Recall.pm (-1 / +1 lines)
Lines 20-26 package Koha::Recall; Link Here
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::DateUtils;
23
use Koha::DateUtils qw( dt_from_string );
24
use Koha::Patron;
24
use Koha::Patron;
25
use Koha::Biblio;
25
use Koha::Biblio;
26
use Koha::Item;
26
use Koha::Item;
(-)a/Koha/Recalls.pm (-1 / +1 lines)
Lines 21-27 use Modern::Perl; Link Here
21
21
22
use Koha::Database;
22
use Koha::Database;
23
use Koha::Recall;
23
use Koha::Recall;
24
use Koha::DateUtils;
24
use Koha::DateUtils qw( dt_from_string );
25
25
26
use C4::Stats qw( UpdateStats );
26
use C4::Stats qw( UpdateStats );
27
27
(-)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/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/circulation.pref (-2 / +2 lines)
Lines 1281-1286 Circulation: Link Here
1281
        -
1281
        -
1282
            - pref: UseRecalls
1282
            - pref: UseRecalls
1283
              choices:
1283
              choices:
1284
                  yes: Use
1284
                  1: Use
1285
                  no: "Don't use"
1285
                  0: "Don't use"
1286
            - recalls. Make sure you configure <a href="/cgi-bin/koha/admin/smart-rules.pl">circulation and fines rules</a> for recalls once enabled.
1286
            - recalls. Make sure you configure <a href="/cgi-bin/koha/admin/smart-rules.pl">circulation and fines rules</a> for recalls once enabled.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/logs.pref (-2 / +2 lines)
Lines 111-118 Logging: Link Here
111
        -
111
        -
112
            - pref: RecallsLog
112
            - pref: RecallsLog
113
              choices:
113
              choices:
114
                  on: Log
114
                  1: Log
115
                  off: "Don't log"
115
                  0: "Don't log"
116
            - any actions on recalls (create, cancel, expire, fulfill).
116
            - any actions on recalls (create, cancel, expire, fulfill).
117
117
118
    Debugging:
118
    Debugging:
(-)a/misc/cronjobs/recalls/expire_recalls.pl (-1 / +1 lines)
Lines 31-37 BEGIN { Link Here
31
# - recalls that have been awaiting pickup for longer than the specified recall_shelf_time circulation rule, or the RecallsMaxPickUpDelay if circ rule is unset
31
# - recalls that have been awaiting pickup for longer than the specified recall_shelf_time circulation rule, or the RecallsMaxPickUpDelay if circ rule is unset
32
32
33
use Koha::Script -cron;
33
use Koha::Script -cron;
34
use Koha::DateUtils;
34
use Koha::DateUtils qw( dt_from_string );
35
use Koha::Recalls;
35
use Koha::Recalls;
36
use C4::Log;
36
use C4::Log;
37
37
(-)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/recalls_waiting.pl (-1 / +1 lines)
Lines 22-28 use C4::Auth qw( get_template_and_user ); Link Here
22
use C4::Output qw( output_html_with_http_headers );
22
use C4::Output qw( output_html_with_http_headers );
23
use Koha::Recalls;
23
use Koha::Recalls;
24
use Koha::BiblioFrameworks;
24
use Koha::BiblioFrameworks;
25
use Koha::DateUtils;
25
use Koha::DateUtils qw( dt_from_string );
26
use Koha::Patrons;
26
use Koha::Patrons;
27
27
28
my $query = CGI->new;
28
my $query = CGI->new;
(-)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