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

(-)a/C4/XSLT.pm (-2 / +3 lines)
Lines 357-363 sub buildKohaItemsNamespace { Link Here
357
357
358
        if ( $recalls->count ) {
358
        if ( $recalls->count ) {
359
            # recalls take priority over holds
359
            # recalls take priority over holds
360
            $status = 'Waiting';
360
            $status = 'other';
361
            $substatus = 'Recall waiting';
361
        }
362
        }
362
        elsif ( $item->has_pending_hold ) {
363
        elsif ( $item->has_pending_hold ) {
363
            $status = 'other';
364
            $status = 'other';
Lines 365-371 sub buildKohaItemsNamespace { Link Here
365
        }
366
        }
366
        elsif ( $item->holds->waiting->count ) {
367
        elsif ( $item->holds->waiting->count ) {
367
            $status = 'other';
368
            $status = 'other';
368
            $substatus = 'Waiting';
369
            $substatus = 'Hold waiting';
369
        }
370
        }
370
        elsif ($item->get_transfer) {
371
        elsif ($item->get_transfer) {
371
            $status = 'other';
372
            $status = 'other';
(-)a/Koha/Biblio.pm (-2 / +8 lines)
Lines 1171-1177 Return all active recalls attached to this biblio, sorted by oldest first Link Here
1171
=cut
1171
=cut
1172
1172
1173
sub recalls {
1173
sub recalls {
1174
    my ( $self ) = @_;
1174
    my ( $self, $params ) = @_;
1175
    if ( $params->{borrowernumber} ) {
1176
        my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef, borrowernumber => $params->{borrowernumber} }, { order_by => { -asc => 'recalldate' } });
1177
        return @recalls_rs;
1178
    }
1175
    my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef }, { order_by => { -asc => 'recalldate' } });
1179
    my @recalls_rs = Koha::Recalls->search({ biblionumber => $self->biblionumber, old => undef }, { order_by => { -asc => 'recalldate' } });
1176
    return @recalls_rs;
1180
    return @recalls_rs;
1177
}
1181
}
Lines 1204-1210 sub can_be_recalled { Link Here
1204
    my @itemtypes;
1208
    my @itemtypes;
1205
    my @itemnumbers;
1209
    my @itemnumbers;
1206
    my @items;
1210
    my @items;
1211
    my @all_itemnumbers;
1207
    foreach my $item ( @all_items ) {
1212
    foreach my $item ( @all_items ) {
1213
        push( @all_itemnumbers, $item->itemnumber );
1208
        if ( $item->can_be_recalled({ patron => $patron }) ) {
1214
        if ( $item->can_be_recalled({ patron => $patron }) ) {
1209
            push( @itemtypes, $item->effective_itemtype );
1215
            push( @itemtypes, $item->effective_itemtype );
1210
            push( @itemnumbers, $item->itemnumber );
1216
            push( @itemnumbers, $item->itemnumber );
Lines 1251-1257 sub can_be_recalled { Link Here
1251
        return 0 if ( $patron->recalls({ biblionumber => $self->biblionumber })->count >= $recalls_per_record );
1257
        return 0 if ( $patron->recalls({ biblionumber => $self->biblionumber })->count >= $recalls_per_record );
1252
1258
1253
        # check if any of the items under this biblio are already checked out by this borrower
1259
        # check if any of the items under this biblio are already checked out by this borrower
1254
        return 0 if ( Koha::Checkouts->search({ itemnumber => [ @itemnumbers ], borrowernumber => $patron->borrowernumber })->count > 0 );
1260
        return 0 if ( Koha::Checkouts->search({ itemnumber => [ @all_itemnumbers ], borrowernumber => $patron->borrowernumber })->count > 0 );
1255
    }
1261
    }
1256
1262
1257
    # check item availability
1263
    # 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