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

(-)a/t/db_dependent/Circulation.t (-76 / +76 lines)
Lines 1450-1460 subtest "CanBookBeRenewed tests" => sub { Link Here
1450
1450
1451
    # item-level and this item: renewal not allowed
1451
    # item-level and this item: renewal not allowed
1452
    my $recall = Koha::Recall->new({
1452
    my $recall = Koha::Recall->new({
1453
        biblionumber => $recall_item1->biblionumber,
1453
        biblio_id => $recall_item1->biblionumber,
1454
        itemnumber => $recall_item1->itemnumber,
1454
        item_id => $recall_item1->itemnumber,
1455
        borrowernumber => $recall_borrower->borrowernumber,
1455
        patron_id => $recall_borrower->borrowernumber,
1456
        branchcode => $recall_borrower->branchcode,
1456
        pickup_library_id => $recall_borrower->branchcode,
1457
        item_level_recall => 1,
1457
        item_level => 1,
1458
    })->store;
1458
    })->store;
1459
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $recall_item1->itemnumber );
1459
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $recall_item1->itemnumber );
1460
    is( $error, 'recalled', 'Cannot renew item that has been recalled' );
1460
    is( $error, 'recalled', 'Cannot renew item that has been recalled' );
Lines 1462-1472 subtest "CanBookBeRenewed tests" => sub { Link Here
1462
1462
1463
    # biblio-level requested recall: renewal not allowed
1463
    # biblio-level requested recall: renewal not allowed
1464
    $recall = Koha::Recall->new({
1464
    $recall = Koha::Recall->new({
1465
        biblionumber => $recall_item1->biblionumber,
1465
        biblio_id => $recall_item1->biblionumber,
1466
        itemnumber => undef,
1466
        item_id => undef,
1467
        borrowernumber => $recall_borrower->borrowernumber,
1467
        patron_id => $recall_borrower->borrowernumber,
1468
        branchcode => $recall_borrower->branchcode,
1468
        pickup_library_id => $recall_borrower->branchcode,
1469
        item_level_recall => 0,
1469
        item_level => 0,
1470
    })->store;
1470
    })->store;
1471
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $recall_item1->itemnumber );
1471
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $recall_item1->itemnumber );
1472
    is( $error, 'recalled', 'Cannot renew item if biblio is recalled and has no item allocated' );
1472
    is( $error, 'recalled', 'Cannot renew item if biblio is recalled and has no item allocated' );
Lines 1474-1484 subtest "CanBookBeRenewed tests" => sub { Link Here
1474
1474
1475
    # item-level and not this item: renewal allowed
1475
    # item-level and not this item: renewal allowed
1476
    $recall = Koha::Recall->new({
1476
    $recall = Koha::Recall->new({
1477
        biblionumber => $recall_item2->biblionumber,
1477
        biblio_id => $recall_item2->biblionumber,
1478
        itemnumber => $recall_item2->itemnumber,
1478
        item_id => $recall_item2->itemnumber,
1479
        borrowernumber => $recall_borrower->borrowernumber,
1479
        patron_id => $recall_borrower->borrowernumber,
1480
        branchcode => $recall_borrower->branchcode,
1480
        pickup_library_id => $recall_borrower->branchcode,
1481
        item_level_recall => 1,
1481
        item_level => 1,
1482
    })->store;
1482
    })->store;
1483
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $recall_item1->itemnumber );
1483
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $recall_item1->itemnumber );
1484
    is( $renewokay, 1, 'Can renew item if item-level recall on biblio is not on this item' );
1484
    is( $renewokay, 1, 'Can renew item if item-level recall on biblio is not on this item' );
Lines 1486-1496 subtest "CanBookBeRenewed tests" => sub { Link Here
1486
1486
1487
    # biblio-level waiting recall: renewal allowed
1487
    # biblio-level waiting recall: renewal allowed
1488
    $recall = Koha::Recall->new({
1488
    $recall = Koha::Recall->new({
1489
        biblionumber => $recall_item1->biblionumber,
1489
        biblio_id => $recall_item1->biblionumber,
1490
        itemnumber => undef,
1490
        item_id => undef,
1491
        borrowernumber => $recall_borrower->borrowernumber,
1491
        patron_id => $recall_borrower->borrowernumber,
1492
        branchcode => $recall_borrower->branchcode,
1492
        pickup_library_id => $recall_borrower->branchcode,
1493
        item_level_recall => 0,
1493
        item_level => 0,
1494
    })->store;
1494
    })->store;
1495
    $recall->set_waiting({ item => $recall_item1 });
1495
    $recall->set_waiting({ item => $recall_item1 });
1496
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $recall_item1->itemnumber );
1496
    ( $renewokay, $error ) = CanBookBeRenewed( $renewing_borrowernumber, $recall_item1->itemnumber );
Lines 1995-2038 subtest 'AddIssue | recalls' => sub { Link Here
1995
1995
1996
    # checking out item that they have recalled
1996
    # checking out item that they have recalled
1997
    my $recall1 = Koha::Recall->new(
1997
    my $recall1 = Koha::Recall->new(
1998
        {   borrowernumber    => $patron1->borrowernumber,
1998
        {   patron_id         => $patron1->borrowernumber,
1999
            biblionumber      => $item->biblionumber,
1999
            biblio_id         => $item->biblionumber,
2000
            itemnumber        => $item->itemnumber,
2000
            item_id           => $item->itemnumber,
2001
            item_level_recall => 1,
2001
            item_level        => 1,
2002
            branchcode        => $patron1->branchcode,
2002
            pickup_library_id => $patron1->branchcode,
2003
        }
2003
        }
2004
    )->store;
2004
    )->store;
2005
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall1->recall_id } );
2005
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall1->id } );
2006
    $recall1 = Koha::Recalls->find( $recall1->recall_id );
2006
    $recall1 = Koha::Recalls->find( $recall1->id );
2007
    is( $recall1->fulfilled, 1, 'Recall was fulfilled when patron checked out item' );
2007
    is( $recall1->fulfilled, 1, 'Recall was fulfilled when patron checked out item' );
2008
    AddReturn( $item->barcode, $item->homebranch );
2008
    AddReturn( $item->barcode, $item->homebranch );
2009
2009
2010
    # this item is has a recall request. cancel recall
2010
    # this item is has a recall request. cancel recall
2011
    my $recall2 = Koha::Recall->new(
2011
    my $recall2 = Koha::Recall->new(
2012
        {   borrowernumber    => $patron2->borrowernumber,
2012
        {   patron_id         => $patron2->borrowernumber,
2013
            biblionumber      => $item->biblionumber,
2013
            biblio_id         => $item->biblionumber,
2014
            itemnumber        => $item->itemnumber,
2014
            item_id           => $item->itemnumber,
2015
            item_level_recall => 1,
2015
            item_level        => 1,
2016
            branchcode        => $patron2->branchcode,
2016
            pickup_library_id => $patron2->branchcode,
2017
        }
2017
        }
2018
    )->store;
2018
    )->store;
2019
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall2->recall_id, cancel_recall => 'cancel' } );
2019
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall2->id, cancel_recall => 'cancel' } );
2020
    $recall2 = Koha::Recalls->find( $recall2->recall_id );
2020
    $recall2 = Koha::Recalls->find( $recall2->id );
2021
    is( $recall2->cancelled, 1, 'Recall was cancelled when patron checked out item' );
2021
    is( $recall2->cancelled, 1, 'Recall was cancelled when patron checked out item' );
2022
    AddReturn( $item->barcode, $item->homebranch );
2022
    AddReturn( $item->barcode, $item->homebranch );
2023
2023
2024
    # this item is waiting to fulfill a recall. revert recall
2024
    # this item is waiting to fulfill a recall. revert recall
2025
    my $recall3 = Koha::Recall->new(
2025
    my $recall3 = Koha::Recall->new(
2026
        {   borrowernumber    => $patron2->borrowernumber,
2026
        {   patron_id         => $patron2->borrowernumber,
2027
            biblionumber      => $item->biblionumber,
2027
            biblio_id         => $item->biblionumber,
2028
            itemnumber        => $item->itemnumber,
2028
            item_id           => $item->itemnumber,
2029
            item_level_recall => 1,
2029
            item_level        => 1,
2030
            branchcode        => $patron2->branchcode,
2030
            pickup_library_id => $patron2->branchcode,
2031
        }
2031
        }
2032
    )->store;
2032
    )->store;
2033
    $recall3->set_waiting;
2033
    $recall3->set_waiting;
2034
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall3->recall_id, cancel_recall => 'revert' } );
2034
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall3->id, cancel_recall => 'revert' } );
2035
    $recall3 = Koha::Recalls->find( $recall3->recall_id );
2035
    $recall3 = Koha::Recalls->find( $recall3->id );
2036
    is( $recall3->requested, 1, 'Recall was reverted from waiting when patron checked out item' );
2036
    is( $recall3->requested, 1, 'Recall was reverted from waiting when patron checked out item' );
2037
    AddReturn( $item->barcode, $item->homebranch );
2037
    AddReturn( $item->barcode, $item->homebranch );
2038
};
2038
};
Lines 3975-4021 subtest 'CanBookBeIssued | recalls' => sub { Link Here
3975
3975
3976
    # item-level recall
3976
    # item-level recall
3977
    my $recall = Koha::Recall->new(
3977
    my $recall = Koha::Recall->new(
3978
        {   borrowernumber    => $patron1->borrowernumber,
3978
        {   patron_id         => $patron1->borrowernumber,
3979
            biblionumber      => $item->biblionumber,
3979
            biblio_id         => $item->biblionumber,
3980
            itemnumber        => $item->itemnumber,
3980
            item_id           => $item->itemnumber,
3981
            item_level_recall => 1,
3981
            item_level        => 1,
3982
            branchcode        => $patron1->branchcode,
3982
            pickup_library_id => $patron1->branchcode,
3983
        }
3983
        }
3984
    )->store;
3984
    )->store;
3985
3985
3986
    my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron2, $item->barcode, undef, undef, undef, undef );
3986
    my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron2, $item->barcode, undef, undef, undef, undef );
3987
    is( $needsconfirmation->{RECALLED}->recall_id, $recall->recall_id, "Another patron has placed an item-level recall on this item" );
3987
    is( $needsconfirmation->{RECALLED}->id, $recall->id, "Another patron has placed an item-level recall on this item" );
3988
3988
3989
    $recall->set_cancelled;
3989
    $recall->set_cancelled;
3990
3990
3991
    # biblio-level recall
3991
    # biblio-level recall
3992
    $recall = Koha::Recall->new(
3992
    $recall = Koha::Recall->new(
3993
        {   borrowernumber    => $patron1->borrowernumber,
3993
        {   patron_id         => $patron1->borrowernumber,
3994
            biblionumber      => $item->biblionumber,
3994
            biblio_id         => $item->biblionumber,
3995
            itemnumber        => undef,
3995
            item_id           => undef,
3996
            item_level_recall => 0,
3996
            item_level        => 0,
3997
            branchcode        => $patron1->branchcode,
3997
            pickup_library_id => $patron1->branchcode,
3998
        }
3998
        }
3999
    )->store;
3999
    )->store;
4000
4000
4001
    ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron2, $item->barcode, undef, undef, undef, undef );
4001
    ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron2, $item->barcode, undef, undef, undef, undef );
4002
    is( $needsconfirmation->{RECALLED}->recall_id, $recall->recall_id, "Another patron has placed a biblio-level recall and this item is eligible to fill it" );
4002
    is( $needsconfirmation->{RECALLED}->id, $recall->id, "Another patron has placed a biblio-level recall and this item is eligible to fill it" );
4003
4003
4004
    $recall->set_cancelled;
4004
    $recall->set_cancelled;
4005
4005
4006
    # biblio-level recall
4006
    # biblio-level recall
4007
    $recall = Koha::Recall->new(
4007
    $recall = Koha::Recall->new(
4008
        {   borrowernumber    => $patron1->borrowernumber,
4008
        {   patron_id         => $patron1->borrowernumber,
4009
            biblionumber      => $item->biblionumber,
4009
            biblio_id         => $item->biblionumber,
4010
            itemnumber        => undef,
4010
            item_id           => undef,
4011
            item_level_recall => 0,
4011
            item_level        => 0,
4012
            branchcode        => $patron1->branchcode,
4012
            pickup_library_id => $patron1->branchcode,
4013
        }
4013
        }
4014
    )->store;
4014
    )->store;
4015
    $recall->set_waiting( { item => $item, expirationdate => dt_from_string() } );
4015
    $recall->set_waiting( { item => $item, expirationdate => dt_from_string() } );
4016
4016
4017
    my ( undef, undef, undef, $messages ) = CanBookBeIssued( $patron1, $item->barcode, undef, undef, undef, undef );
4017
    my ( undef, undef, undef, $messages ) = CanBookBeIssued( $patron1, $item->barcode, undef, undef, undef, undef );
4018
    is( $messages->{RECALLED}, $recall->recall_id, "This book can be issued by this patron and they have placed a recall" );
4018
    is( $messages->{RECALLED}, $recall->id, "This book can be issued by this patron and they have placed a recall" );
4019
4019
4020
    $recall->set_cancelled;
4020
    $recall->set_cancelled;
4021
};
4021
};
Lines 4055-4079 subtest 'AddReturn | recalls' => sub { Link Here
4055
    # this item can fill a recall with pickup at this branch
4055
    # this item can fill a recall with pickup at this branch
4056
    AddIssue( $patron1->unblessed, $item1->barcode );
4056
    AddIssue( $patron1->unblessed, $item1->barcode );
4057
    my $recall1 = Koha::Recall->new(
4057
    my $recall1 = Koha::Recall->new(
4058
        {   borrowernumber    => $patron2->borrowernumber,
4058
        {   patron_id         => $patron2->borrowernumber,
4059
            biblionumber      => $item1->biblionumber,
4059
            biblio_id         => $item1->biblionumber,
4060
            itemnumber        => $item1->itemnumber,
4060
            item_id           => $item1->itemnumber,
4061
            item_level_recall => 1,
4061
            item_level        => 1,
4062
            branchcode        => $item1->homebranch,
4062
            pickup_library_id => $item1->homebranch,
4063
        }
4063
        }
4064
    )->store;
4064
    )->store;
4065
    my ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $item1->homebranch );
4065
    my ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $item1->homebranch );
4066
    is( $messages->{RecallFound}->recall_id, $recall1->recall_id, "Recall found" );
4066
    is( $messages->{RecallFound}->id, $recall1->id, "Recall found" );
4067
    $recall1->set_cancelled;
4067
    $recall1->set_cancelled;
4068
4068
4069
    # this item can fill a recall but needs transfer
4069
    # this item can fill a recall but needs transfer
4070
    AddIssue( $patron1->unblessed, $item1->barcode );
4070
    AddIssue( $patron1->unblessed, $item1->barcode );
4071
    $recall1 = Koha::Recall->new(
4071
    $recall1 = Koha::Recall->new(
4072
        {   borrowernumber    => $patron2->borrowernumber,
4072
        {   patron_id         => $patron2->borrowernumber,
4073
            biblionumber      => $item1->biblionumber,
4073
            biblio_id         => $item1->biblionumber,
4074
            itemnumber        => $item1->itemnumber,
4074
            item_id           => $item1->itemnumber,
4075
            item_level_recall => 1,
4075
            item_level        => 1,
4076
            branchcode        => $patron2->branchcode,
4076
            pickup_library_id => $patron2->branchcode,
4077
        }
4077
        }
4078
    )->store;
4078
    )->store;
4079
    ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $item1->homebranch );
4079
    ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $item1->homebranch );
Lines 4083-4098 subtest 'AddReturn | recalls' => sub { Link Here
4083
    # this item is already in transit, do not ask to transfer
4083
    # this item is already in transit, do not ask to transfer
4084
    AddIssue( $patron1->unblessed, $item1->barcode );
4084
    AddIssue( $patron1->unblessed, $item1->barcode );
4085
    $recall1 = Koha::Recall->new(
4085
    $recall1 = Koha::Recall->new(
4086
        {   borrowernumber    => $patron2->borrowernumber,
4086
        {   patron_id         => $patron2->borrowernumber,
4087
            biblionumber      => $item1->biblionumber,
4087
            biblio_id         => $item1->biblionumber,
4088
            itemnumber        => $item1->itemnumber,
4088
            item_id           => $item1->itemnumber,
4089
            item_level_recall => 1,
4089
            item_level        => 1,
4090
            branchcode        => $patron2->branchcode,
4090
            pickup_library_id => $patron2->branchcode,
4091
        }
4091
        }
4092
    )->store;
4092
    )->store;
4093
    $recall1->start_transfer;
4093
    $recall1->start_transfer;
4094
    ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $patron2->branchcode );
4094
    ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $patron2->branchcode );
4095
    is( $messages->{TransferredRecall}->recall_id, $recall1->recall_id, "In transit recall found" );
4095
    is( $messages->{TransferredRecall}->id, $recall1->id, "In transit recall found" );
4096
    $recall1->set_cancelled;
4096
    $recall1->set_cancelled;
4097
};
4097
};
4098
4098
(-)a/t/db_dependent/Circulation/CalcFine.t (-7 / +7 lines)
Lines 228-240 subtest 'Recall overdue fines' => sub { Link Here
228
    );
228
    );
229
229
230
    my $recall = Koha::Recall->new({
230
    my $recall = Koha::Recall->new({
231
        borrowernumber => $patron->{borrowernumber},
231
        patron_id => $patron->{borrowernumber},
232
        recalldate => dt_from_string,
232
        created_date => dt_from_string,
233
        biblionumber => $item->biblionumber,
233
        biblio_id => $item->biblionumber,
234
        branchcode => $branch->{branchcode},
234
        pickup_library_id => $branch->{branchcode},
235
        itemnumber => $item->itemnumber,
235
        item_id => $item->itemnumber,
236
        expirationdate => undef,
236
        expiration_date => undef,
237
        item_level_recall => 1
237
        item_level => 1
238
    })->store;
238
    })->store;
239
    $recall->set_overdue;
239
    $recall->set_overdue;
240
240
(-)a/t/db_dependent/Circulation/transferbook.t (-11 / +11 lines)
Lines 158-168 subtest 'transfer already at destination' => sub { Link Here
158
    # recalls
158
    # recalls
159
    t::lib::Mocks::mock_preference('UseRecalls', 1);
159
    t::lib::Mocks::mock_preference('UseRecalls', 1);
160
    my $recall = Koha::Recall->new(
160
    my $recall = Koha::Recall->new(
161
        {   biblionumber      => $item->biblionumber,
161
        {   biblio_id         => $item->biblionumber,
162
            itemnumber        => $item->itemnumber,
162
            item_id           => $item->itemnumber,
163
            item_level_recall => 1,
163
            item_level        => 1,
164
            borrowernumber    => $patron->borrowernumber,
164
            patron_id         => $patron->borrowernumber,
165
            branchcode        => $library->branchcode,
165
            pickup_library_id => $library->branchcode,
166
        }
166
        }
167
    )->store;
167
    )->store;
168
    ( $recall, $dotransfer, $messages ) = $recall->start_transfer;
168
    ( $recall, $dotransfer, $messages ) = $recall->start_transfer;
Lines 171-186 subtest 'transfer already at destination' => sub { Link Here
171
171
172
    my $item2 = $builder->build_object({ class => 'Koha::Items' }); # this item will have a different holding branch to the pickup branch
172
    my $item2 = $builder->build_object({ class => 'Koha::Items' }); # this item will have a different holding branch to the pickup branch
173
    $recall = Koha::Recall->new(
173
    $recall = Koha::Recall->new(
174
        {   biblionumber      => $item2->biblionumber,
174
        {   biblio_id         => $item2->biblionumber,
175
            itemnumber        => $item2->itemnumber,
175
            item_id           => $item2->itemnumber,
176
            item_level_recall => 1,
176
            item_level        => 1,
177
            borrowernumber    => $patron->borrowernumber,
177
            patron_id         => $patron->borrowernumber,
178
            branchcode        => $library->branchcode,
178
            pickup_library_id => $library->branchcode,
179
        }
179
        }
180
    )->store;
180
    )->store;
181
    ( $recall, $dotransfer, $messages ) = $recall->start_transfer;
181
    ( $recall, $dotransfer, $messages ) = $recall->start_transfer;
182
    is( $dotransfer, 1, 'Transfer of recalled item succeeded' );
182
    is( $dotransfer, 1, 'Transfer of recalled item succeeded' );
183
    is( $messages->{RecallFound}->recall_id, $recall->recall_id, "We found the recall");
183
    is( $messages->{RecallFound}->id, $recall->id, "We found the recall");
184
};
184
};
185
185
186
subtest 'transfer an issued item' => sub {
186
subtest 'transfer an issued item' => sub {
(-)a/t/db_dependent/Holds.t (-6 / +6 lines)
Lines 1567-1578 subtest 'CanItemBeReserved / recall' => sub { Link Here
1567
        }
1567
        }
1568
    );
1568
    );
1569
    Koha::Recall->new({
1569
    Koha::Recall->new({
1570
        borrowernumber => $patron1->borrowernumber,
1570
        patron_id => $patron1->borrowernumber,
1571
        biblionumber => $biblio1->biblionumber,
1571
        biblio_id => $biblio1->biblionumber,
1572
        branchcode => $library1->branchcode,
1572
        pickup_library_id => $library1->branchcode,
1573
        itemnumber => $item1->itemnumber,
1573
        item_id => $item1->itemnumber,
1574
        recalldate => '2020-05-04 10:10:10',
1574
        created_date => '2020-05-04 10:10:10',
1575
        item_level_recall => 1,
1575
        item_level => 1,
1576
    })->store;
1576
    })->store;
1577
    is( CanItemBeReserved( $patron1, $item1, $library1->branchcode )->{status}, 'recall', "Can't reserve an item that they have already recalled" );
1577
    is( CanItemBeReserved( $patron1, $item1, $library1->branchcode )->{status}, 'recall', "Can't reserve an item that they have already recalled" );
1578
1578
(-)a/t/db_dependent/Koha/Biblio.t (-21 / +21 lines)
Lines 899-931 subtest 'Recalls tests' => sub { Link Here
899
    t::lib::Mocks::mock_userenv({ patron => $patron1 });
899
    t::lib::Mocks::mock_userenv({ patron => $patron1 });
900
900
901
    my $recall1 = Koha::Recall->new(
901
    my $recall1 = Koha::Recall->new(
902
        {   borrowernumber    => $patron1->borrowernumber,
902
        {   patron_id         => $patron1->borrowernumber,
903
            recalldate        => \'NOW()',
903
            created_date      => \'NOW()',
904
            biblionumber      => $biblio->biblionumber,
904
            biblio_id         => $biblio->biblionumber,
905
            branchcode        => $branchcode,
905
            pickup_library_id => $branchcode,
906
            itemnumber        => $item1->itemnumber,
906
            item_id           => $item1->itemnumber,
907
            expirationdate    => undef,
907
            expiration_date   => undef,
908
            item_level_recall => 1
908
            item_level        => 1
909
        }
909
        }
910
    )->store;
910
    )->store;
911
    my $recall2 = Koha::Recall->new(
911
    my $recall2 = Koha::Recall->new(
912
        {   borrowernumber    => $patron2->borrowernumber,
912
        {   patron_id         => $patron2->borrowernumber,
913
            recalldate        => \'NOW()',
913
            created_date      => \'NOW()',
914
            biblionumber      => $biblio->biblionumber,
914
            biblio_id         => $biblio->biblionumber,
915
            branchcode        => $branchcode,
915
            pickup_library_id => $branchcode,
916
            itemnumber        => undef,
916
            item_id           => undef,
917
            expirationdate    => undef,
917
            expiration_date   => undef,
918
            item_level_recall => 0
918
            item_level        => 0
919
        }
919
        }
920
    )->store;
920
    )->store;
921
    my $recall3 = Koha::Recall->new(
921
    my $recall3 = Koha::Recall->new(
922
        {   borrowernumber    => $patron3->borrowernumber,
922
        {   patron_id         => $patron3->borrowernumber,
923
            recalldate        => \'NOW()',
923
            created_date      => \'NOW()',
924
            biblionumber      => $biblio->biblionumber,
924
            biblio_id         => $biblio->biblionumber,
925
            branchcode        => $branchcode,
925
            pickup_library_id => $branchcode,
926
            itemnumber        => $item1->itemnumber,
926
            item_id           => $item1->itemnumber,
927
            expirationdate    => undef,
927
            expiration_date   => undef,
928
            item_level_recall => 1
928
            item_level        => 1
929
        }
929
        }
930
    )->store;
930
    )->store;
931
931
(-)a/t/db_dependent/Koha/Item.t (-39 / +39 lines)
Lines 1247-1273 subtest 'Recalls tests' => sub { Link Here
1247
    t::lib::Mocks::mock_preference('UseRecalls', 1);
1247
    t::lib::Mocks::mock_preference('UseRecalls', 1);
1248
1248
1249
    my $recall1 = Koha::Recall->new(
1249
    my $recall1 = Koha::Recall->new(
1250
        {   borrowernumber    => $patron1->borrowernumber,
1250
        {   patron_id         => $patron1->borrowernumber,
1251
            recalldate        => \'NOW()',
1251
            created_date      => \'NOW()',
1252
            biblionumber      => $biblio->biblionumber,
1252
            biblio_id         => $biblio->biblionumber,
1253
            branchcode        => $branchcode,
1253
            pickup_library_id => $branchcode,
1254
            itemnumber        => $item1->itemnumber,
1254
            item_id           => $item1->itemnumber,
1255
            expirationdate    => undef,
1255
            expiration_date   => undef,
1256
            item_level_recall => 1
1256
            item_level        => 1
1257
        }
1257
        }
1258
    )->store;
1258
    )->store;
1259
    my $recall2 = Koha::Recall->new(
1259
    my $recall2 = Koha::Recall->new(
1260
        {   borrowernumber    => $patron2->borrowernumber,
1260
        {   patron_id         => $patron2->borrowernumber,
1261
            recalldate        => \'NOW()',
1261
            created_date      => \'NOW()',
1262
            biblionumber      => $biblio->biblionumber,
1262
            biblio_id         => $biblio->biblionumber,
1263
            branchcode        => $branchcode,
1263
            pickup_library_id => $branchcode,
1264
            itemnumber        => $item1->itemnumber,
1264
            item_id           => $item1->itemnumber,
1265
            expirationdate    => undef,
1265
            expiration_date   => undef,
1266
            item_level_recall => 1
1266
            item_level        => 1
1267
        }
1267
        }
1268
    )->store;
1268
    )->store;
1269
1269
1270
    is( $item1->recall->borrowernumber, $patron1->borrowernumber, 'Correctly returns most relevant recall' );
1270
    is( $item1->recall->patron_id, $patron1->borrowernumber, 'Correctly returns most relevant recall' );
1271
1271
1272
    $recall2->set_cancelled;
1272
    $recall2->set_cancelled;
1273
1273
Lines 1339-1351 subtest 'Recalls tests' => sub { Link Here
1339
    is( $item1->can_be_recalled({ patron => $patron1 }), 1, "Can recall item" );
1339
    is( $item1->can_be_recalled({ patron => $patron1 }), 1, "Can recall item" );
1340
1340
1341
    $recall1 = Koha::Recall->new(
1341
    $recall1 = Koha::Recall->new(
1342
        {   borrowernumber    => $patron1->borrowernumber,
1342
        {   patron_id         => $patron1->borrowernumber,
1343
            recalldate        => \'NOW()',
1343
            created_date      => \'NOW()',
1344
            biblionumber      => $biblio->biblionumber,
1344
            biblio_id         => $biblio->biblionumber,
1345
            branchcode        => $branchcode,
1345
            pickup_library_id => $branchcode,
1346
            itemnumber        => undef,
1346
            item_id           => undef,
1347
            expirationdate    => undef,
1347
            expiration_date   => undef,
1348
            item_level_recall => 0
1348
            item_level        => 0
1349
        }
1349
        }
1350
    )->store;
1350
    )->store;
1351
1351
Lines 1378-1419 subtest 'Recalls tests' => sub { Link Here
1378
    # check_recalls tests
1378
    # check_recalls tests
1379
1379
1380
    $recall1 = Koha::Recall->new(
1380
    $recall1 = Koha::Recall->new(
1381
        {   borrowernumber    => $patron2->borrowernumber,
1381
        {   patron_id         => $patron2->borrowernumber,
1382
            recalldate        => \'NOW()',
1382
            created_date      => \'NOW()',
1383
            biblionumber      => $biblio->biblionumber,
1383
            biblio_id         => $biblio->biblionumber,
1384
            branchcode        => $branchcode,
1384
            pickup_library_id => $branchcode,
1385
            itemnumber        => $item1->itemnumber,
1385
            item_id           => $item1->itemnumber,
1386
            expirationdate    => undef,
1386
            expiration_date   => undef,
1387
            item_level_recall => 1
1387
            item_level        => 1
1388
        }
1388
        }
1389
    )->store;
1389
    )->store;
1390
    $recall2 = Koha::Recall->new(
1390
    $recall2 = Koha::Recall->new(
1391
        {   borrowernumber    => $patron1->borrowernumber,
1391
        {   patron_id         => $patron1->borrowernumber,
1392
            recalldate        => \'NOW()',
1392
            created_date      => \'NOW()',
1393
            biblionumber      => $biblio->biblionumber,
1393
            biblio_id         => $biblio->biblionumber,
1394
            branchcode        => $branchcode,
1394
            pickup_library_id => $branchcode,
1395
            itemnumber        => undef,
1395
            item_id           => undef,
1396
            expirationdate    => undef,
1396
            expiration_date   => undef,
1397
            item_level_recall => 0
1397
            item_level        => 0
1398
        }
1398
        }
1399
    )->store;
1399
    )->store;
1400
    $recall2->set_waiting( { item => $item1 } );
1400
    $recall2->set_waiting( { item => $item1 } );
1401
1401
1402
    # return a waiting recall
1402
    # return a waiting recall
1403
    my $check_recall = $item1->check_recalls;
1403
    my $check_recall = $item1->check_recalls;
1404
    is( $check_recall->borrowernumber, $patron1->borrowernumber, "Waiting recall is highest priority and returned" );
1404
    is( $check_recall->patron_id, $patron1->borrowernumber, "Waiting recall is highest priority and returned" );
1405
1405
1406
    $recall2->revert_waiting;
1406
    $recall2->revert_waiting;
1407
1407
1408
    # return recall based on recalldate
1408
    # return recall based on recalldate
1409
    $check_recall = $item1->check_recalls;
1409
    $check_recall = $item1->check_recalls;
1410
    is( $check_recall->borrowernumber, $patron1->borrowernumber, "No waiting recall, so oldest recall is returned" );
1410
    is( $check_recall->patron_id, $patron1->borrowernumber, "No waiting recall, so oldest recall is returned" );
1411
1411
1412
    $recall1->set_cancelled;
1412
    $recall1->set_cancelled;
1413
1413
1414
    # return a biblio-level recall
1414
    # return a biblio-level recall
1415
    $check_recall = $item1->check_recalls;
1415
    $check_recall = $item1->check_recalls;
1416
    is( $check_recall->borrowernumber, $patron1->borrowernumber, "Only remaining recall is returned" );
1416
    is( $check_recall->patron_id, $patron1->borrowernumber, "Only remaining recall is returned" );
1417
1417
1418
    $recall2->set_cancelled;
1418
    $recall2->set_cancelled;
1419
1419
(-)a/t/db_dependent/Koha/Patron.t (-27 / +27 lines)
Lines 1064-1109 subtest 'recalls() tests' => sub { Link Here
1064
    my $item2 = $builder->build_object({ class => 'Koha::Items' }, { value => { biblionumber => $biblio2->biblionumber } });
1064
    my $item2 = $builder->build_object({ class => 'Koha::Items' }, { value => { biblionumber => $biblio2->biblionumber } });
1065
1065
1066
    Koha::Recall->new(
1066
    Koha::Recall->new(
1067
        {   biblionumber      => $biblio1->biblionumber,
1067
        {   biblio_id         => $biblio1->biblionumber,
1068
            borrowernumber    => $patron->borrowernumber,
1068
            patron_id         => $patron->borrowernumber,
1069
            itemnumber        => $item1->itemnumber,
1069
            item_id           => $item1->itemnumber,
1070
            branchcode        => $patron->branchcode,
1070
            pickup_library_id => $patron->branchcode,
1071
            recalldate        => \'NOW()',
1071
            created_date      => \'NOW()',
1072
            item_level_recall => 1,
1072
            item_level        => 1,
1073
        }
1073
        }
1074
    )->store;
1074
    )->store;
1075
    Koha::Recall->new(
1075
    Koha::Recall->new(
1076
        {   biblionumber      => $biblio2->biblionumber,
1076
        {   biblio_id         => $biblio2->biblionumber,
1077
            borrowernumber    => $patron->borrowernumber,
1077
            patron_id         => $patron->borrowernumber,
1078
            itemnumber        => $item2->itemnumber,
1078
            item_id           => $item2->itemnumber,
1079
            branchcode        => $patron->branchcode,
1079
            pickup_library_id => $patron->branchcode,
1080
            recalldate        => \'NOW()',
1080
            created_date      => \'NOW()',
1081
            item_level_recall => 1,
1081
            item_level        => 1,
1082
        }
1082
        }
1083
    )->store;
1083
    )->store;
1084
    Koha::Recall->new(
1084
    Koha::Recall->new(
1085
        {   biblionumber      => $biblio1->biblionumber,
1085
        {   biblio_id         => $biblio1->biblionumber,
1086
            borrowernumber    => $patron->borrowernumber,
1086
            patron_id         => $patron->borrowernumber,
1087
            itemnumber        => undef,
1087
            item_id           => undef,
1088
            branchcode        => $patron->branchcode,
1088
            pickup_library_id => $patron->branchcode,
1089
            recalldate        => \'NOW()',
1089
            created_date      => \'NOW()',
1090
            item_level_recall => 0,
1090
            item_level        => 0,
1091
        }
1091
        }
1092
    )->store;
1092
    )->store;
1093
    my $recall = Koha::Recall->new(
1093
    my $recall = Koha::Recall->new(
1094
        {   biblionumber      => $biblio1->biblionumber,
1094
        {   biblio_id         => $biblio1->biblionumber,
1095
            borrowernumber    => $patron->borrowernumber,
1095
            patron_id         => $patron->borrowernumber,
1096
            itemnumber        => undef,
1096
            item_id           => undef,
1097
            branchcode        => $patron->branchcode,
1097
            pickup_library_id => $patron->branchcode,
1098
            recalldate        => \'NOW()',
1098
            created_date      => \'NOW()',
1099
            item_level_recall => 0,
1099
            item_level        => 0,
1100
        }
1100
        }
1101
    )->store;
1101
    )->store;
1102
    $recall->set_cancelled;
1102
    $recall->set_cancelled;
1103
1103
1104
    is( $patron->recalls->count,                                                                          4, "Correctly gets this patron's recalls" );
1104
    is( $patron->recalls->count,                                                                       4, "Correctly gets this patron's recalls" );
1105
    is( $patron->recalls->filter_by_current->count,                                                       3, "Correctly gets this patron's active recalls" );
1105
    is( $patron->recalls->filter_by_current->count,                                                    3, "Correctly gets this patron's active recalls" );
1106
    is( $patron->recalls->filter_by_current->search( { biblionumber => $biblio1->biblionumber } )->count, 2, "Correctly gets this patron's active recalls on a specific biblio" );
1106
    is( $patron->recalls->filter_by_current->search( { biblio_id => $biblio1->biblionumber } )->count, 2, "Correctly gets this patron's active recalls on a specific biblio" );
1107
1107
1108
    $schema->storage->txn_rollback;
1108
    $schema->storage->txn_rollback;
1109
};
1109
};
(-)a/t/db_dependent/Koha/Recall.t (-35 / +35 lines)
Lines 54-60 my $category1 = $builder->build({ source => 'Category' })->{ categorycode }; Link Here
54
my $patron1 = $builder->build_object({ class => 'Koha::Patrons', value => { categorycode => $category1, branchcode => $branch1 } });
54
my $patron1 = $builder->build_object({ class => 'Koha::Patrons', value => { categorycode => $category1, branchcode => $branch1 } });
55
my $patron2 = $builder->build_object({ class => 'Koha::Patrons', value => { categorycode => $category1, branchcode => $branch1 } });
55
my $patron2 = $builder->build_object({ class => 'Koha::Patrons', value => { categorycode => $category1, branchcode => $branch1 } });
56
t::lib::Mocks::mock_userenv({ patron => $patron1 });
56
t::lib::Mocks::mock_userenv({ patron => $patron1 });
57
my $old_recalls_count = Koha::Recalls->search({ old => 1 })->count;
57
my $old_recalls_count = Koha::Recalls->search({ completed => 1 })->count;
58
58
59
Koha::CirculationRules->set_rule({
59
Koha::CirculationRules->set_rule({
60
    branchcode => undef,
60
    branchcode => undef,
Lines 68-81 my $overdue_date = dt_from_string->subtract( days => 4 ); Link Here
68
C4::Circulation::AddIssue( $patron2->unblessed, $item1->barcode, $overdue_date );
68
C4::Circulation::AddIssue( $patron2->unblessed, $item1->barcode, $overdue_date );
69
69
70
my $recall1 = Koha::Recall->new({
70
my $recall1 = Koha::Recall->new({
71
    borrowernumber => $patron1->borrowernumber,
71
    patron_id => $patron1->borrowernumber,
72
    recalldate => dt_from_string,
72
    created_date => dt_from_string,
73
    biblionumber => $biblio1->biblionumber,
73
    biblio_id => $biblio1->biblionumber,
74
    branchcode => $branch1,
74
    pickup_library_id => $branch1,
75
    status => 'requested',
75
    status => 'requested',
76
    itemnumber => $item1->itemnumber,
76
    item_id => $item1->itemnumber,
77
    expirationdate => undef,
77
    expiration_date => undef,
78
    item_level_recall => 1
78
    item_level => 1
79
})->store;
79
})->store;
80
80
81
is( $recall1->biblio->title, $biblio1->title, "Recall biblio relationship correctly linked" );
81
is( $recall1->biblio->title, $biblio1->title, "Recall biblio relationship correctly linked" );
Lines 93-105 $recall1->set_cancelled; Link Here
93
ok( $recall1->cancelled, "Recall is cancelled" );
93
ok( $recall1->cancelled, "Recall is cancelled" );
94
94
95
my $recall2 = Koha::Recall->new({
95
my $recall2 = Koha::Recall->new({
96
    borrowernumber => $patron1->borrowernumber,
96
    patron_id => $patron1->borrowernumber,
97
    recalldate => dt_from_string,
97
    created_date => dt_from_string,
98
    biblionumber => $biblio1->biblionumber,
98
    biblio_id => $biblio1->biblionumber,
99
    branchcode => $branch1,
99
    pickup_library_id => $branch1,
100
    itemnumber => $item1->itemnumber,
100
    item_id => $item1->itemnumber,
101
    expirationdate => undef,
101
    expiration_date => undef,
102
    item_level_recall => 1
102
    item_level => 1
103
})->store;
103
})->store;
104
104
105
Koha::CirculationRules->set_rule({
105
Koha::CirculationRules->set_rule({
Lines 135-151 ok( defined $notice, "Patron was notified to pick up waiting recall" ); Link Here
135
$recall2->set_expired({ interface => 'COMMANDLINE' });
135
$recall2->set_expired({ interface => 'COMMANDLINE' });
136
is( $recall2->expired, 1, "Recall has expired" );
136
is( $recall2->expired, 1, "Recall has expired" );
137
137
138
my $old_recalls_count_now = Koha::Recalls->search({ old => 1 })->count;
138
my $old_recalls_count_now = Koha::Recalls->search({ completed => 1 })->count;
139
is( $old_recalls_count_now, $old_recalls_count + 2, "Recalls have been flagged as old when cancelled or expired" );
139
is( $old_recalls_count_now, $old_recalls_count + 2, "Recalls have been flagged as old when cancelled or expired" );
140
140
141
my $recall3 = Koha::Recall->new({
141
my $recall3 = Koha::Recall->new({
142
    borrowernumber => $patron1->borrowernumber,
142
    patron_id => $patron1->borrowernumber,
143
    recalldate => dt_from_string,
143
    created_date => dt_from_string,
144
    biblionumber => $biblio1->biblionumber,
144
    biblio_id => $biblio1->biblionumber,
145
    branchcode => $branch1,
145
    pickup_library_id => $branch1,
146
    itemnumber => $item1->itemnumber,
146
    item_id => $item1->itemnumber,
147
    expirationdate => undef,
147
    expiration_date => undef,
148
    item_level_recall => 1
148
    item_level => 1
149
})->store;
149
})->store;
150
150
151
# test that recall gets T status
151
# test that recall gets T status
Lines 154-160 ok( $recall3->in_transit, "Recall is in transit" ); Link Here
154
154
155
$recall3->revert_transfer;
155
$recall3->revert_transfer;
156
ok( $recall3->requested, "Recall transfer has been cancelled and the status reverted" );
156
ok( $recall3->requested, "Recall transfer has been cancelled and the status reverted" );
157
is( $recall3->itemnumber, $item1->itemnumber, "Item persists for item-level recall" );
157
is( $recall3->item_id, $item1->itemnumber, "Item persists for item-level recall" );
158
158
159
# for testing purposes, pretend the item gets checked out
159
# for testing purposes, pretend the item gets checked out
160
$recall3->set_fulfilled;
160
$recall3->set_fulfilled;
Lines 162-188 ok( $recall3->fulfilled, "Recall has been fulfilled" ); Link Here
162
162
163
C4::Circulation::AddIssue( $patron2->unblessed, $item1->barcode );
163
C4::Circulation::AddIssue( $patron2->unblessed, $item1->barcode );
164
my $recall4 = Koha::Recall->new({
164
my $recall4 = Koha::Recall->new({
165
    borrowernumber => $patron1->borrowernumber,
165
    patron_id => $patron1->borrowernumber,
166
    recalldate => dt_from_string,
166
    created_date => dt_from_string,
167
    biblionumber => $biblio1->biblionumber,
167
    biblio_id => $biblio1->biblionumber,
168
    branchcode => $branch1,
168
    pickup_library_id => $branch1,
169
    itemnumber => undef,
169
    item_id => undef,
170
    expirationdate => undef,
170
    expiration_date => undef,
171
    item_level_recall => 0,
171
    item_level => 0
172
})->store;
172
})->store;
173
173
174
ok( !defined $recall4->item, "No relevant item returned for a biblio-level recall" );
174
ok( !defined $recall4->item, "No relevant item returned for a biblio-level recall" );
175
is( $recall4->checkout->itemnumber, $item1->itemnumber, "Return most relevant checkout for a biblio-level recall");
175
is( $recall4->checkout->itemnumber, $item1->itemnumber, "Return most relevant checkout for a biblio-level recall");
176
176
177
$recall4->set_waiting({ item => $item1, expirationdate => $expirationdate });
177
$recall4->set_waiting({ item => $item1, expirationdate => $expirationdate });
178
is( $recall4->itemnumber, $item1->itemnumber, "Item has been allocated to biblio-level recall" );
178
is( $recall4->item_id, $item1->itemnumber, "Item has been allocated to biblio-level recall" );
179
179
180
$recall4->revert_waiting;
180
$recall4->revert_waiting;
181
ok( !defined $recall4->itemnumber, "Itemnumber has been removed from biblio-level recall when reverting waiting status" );
181
ok( !defined $recall4->item_id, "Itemnumber has been removed from biblio-level recall when reverting waiting status" );
182
182
183
$recall4->start_transfer({ item => $item1 });
183
$recall4->start_transfer({ item => $item1 });
184
is( $recall4->itemnumber, $item1->itemnumber, "Itemnumber saved to recall when item is transferred" );
184
is( $recall4->item_id, $item1->itemnumber, "Itemnumber saved to recall when item is transferred" );
185
$recall4->revert_transfer;
185
$recall4->revert_transfer;
186
ok( !defined $recall4->itemnumber, "Itemnumber has been removed from biblio-level recall when reverting transfer status" );
186
ok( !defined $recall4->item_id, "Itemnumber has been removed from biblio-level recall when reverting transfer status" );
187
187
188
$schema->storage->txn_rollback();
188
$schema->storage->txn_rollback();
(-)a/t/db_dependent/Koha/Recalls.t (-12 / +12 lines)
Lines 106-112 ok( !defined $recall, "Can't add a recall without specifying a biblio" ); Link Here
106
    expirationdate => undef,
106
    expirationdate => undef,
107
    interface => 'COMMANDLINE',
107
    interface => 'COMMANDLINE',
108
});
108
});
109
is( $recall->branchcode, $branch2, "No pickup branch specified so patron branch used" );
109
is( $recall->pickup_library_id, $branch2, "No pickup branch specified so patron branch used" );
110
is( $due_interval, 5, "Recall due date interval defaults to 5 if not specified" );
110
is( $due_interval, 5, "Recall due date interval defaults to 5 if not specified" );
111
111
112
Koha::CirculationRules->set_rule({
112
Koha::CirculationRules->set_rule({
Lines 134-140 is( $due_interval, 3, "Recall due date interval is based on circulation rules" ) Link Here
134
    expirationdate => undef,
134
    expirationdate => undef,
135
    interface => 'COMMANDLINE',
135
    interface => 'COMMANDLINE',
136
});
136
});
137
is( $recall->item_level_recall, 0, "No item provided so recall not flagged as item-level" );
137
is( $recall->item_level, 0, "No item provided so recall not flagged as item-level" );
138
138
139
my $expected_due_date = dt_from_string->add( days => 3 );
139
my $expected_due_date = dt_from_string->add( days => 3 );
140
is( t::lib::Dates::compare( $recall->checkout->date_due, $expected_due_date ), 0, "Checkout due date has correctly been extended by recall_due_date_interval days" );
140
is( t::lib::Dates::compare( $recall->checkout->date_due, $expected_due_date ), 0, "Checkout due date has correctly been extended by recall_due_date_interval days" );
Lines 146-164 is( $messages_count, 3, "RETURN_RECALLED_ITEM notice successfully sent to checko Link Here
146
my $message = Koha::Recalls->move_recall;
146
my $message = Koha::Recalls->move_recall;
147
is( $message, 'no recall_id provided', "Can't move a recall without specifying which recall" );
147
is( $message, 'no recall_id provided', "Can't move a recall without specifying which recall" );
148
148
149
$message = Koha::Recalls->move_recall({ recall_id => $recall->recall_id });
149
$message = Koha::Recalls->move_recall({ recall_id => $recall->id });
150
is( $message, 'no action provided', "No clear action to perform on recall" );
150
is( $message, 'no action provided', "No clear action to perform on recall" );
151
$message = Koha::Recalls->move_recall({ recall_id => $recall->recall_id, action => 'whatever' });
151
$message = Koha::Recalls->move_recall({ recall_id => $recall->id, action => 'whatever' });
152
is( $message, 'no action provided', "Legal action not provided to perform on recall" );
152
is( $message, 'no action provided', "Legal action not provided to perform on recall" );
153
153
154
$recall->set_waiting({ item => $item1 });
154
$recall->set_waiting({ item => $item1 });
155
ok( $recall->waiting, "Recall is waiting" );
155
ok( $recall->waiting, "Recall is waiting" );
156
Koha::Recalls->move_recall({ recall_id => $recall->recall_id, action => 'revert' });
156
Koha::Recalls->move_recall({ recall_id => $recall->id, action => 'revert' });
157
$recall = Koha::Recalls->find( $recall->recall_id );
157
$recall = Koha::Recalls->find( $recall->id );
158
ok( $recall->requested, "Recall reverted to requested with move_recall" );
158
ok( $recall->requested, "Recall reverted to requested with move_recall" );
159
159
160
Koha::Recalls->move_recall({ recall_id => $recall->recall_id, action => 'cancel' });
160
Koha::Recalls->move_recall({ recall_id => $recall->id, action => 'cancel' });
161
$recall = Koha::Recalls->find( $recall->recall_id );
161
$recall = Koha::Recalls->find( $recall->id );
162
ok( $recall->cancelled, "Recall cancelled with move_recall" );
162
ok( $recall->cancelled, "Recall cancelled with move_recall" );
163
163
164
( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({
164
( $recall, $due_interval, $due_date ) = Koha::Recalls->add_recall({
Lines 169-176 ok( $recall->cancelled, "Recall cancelled with move_recall" ); Link Here
169
    expirationdate => undef,
169
    expirationdate => undef,
170
    interface => 'COMMANDLINE',
170
    interface => 'COMMANDLINE',
171
});
171
});
172
$message = Koha::Recalls->move_recall({ recall_id => $recall->recall_id, item => $item2, borrowernumber => $patron1->borrowernumber });
172
$message = Koha::Recalls->move_recall({ recall_id => $recall->id, item => $item2, borrowernumber => $patron1->borrowernumber });
173
$recall = Koha::Recalls->find( $recall->recall_id );
173
$recall = Koha::Recalls->find( $recall->id );
174
ok( $recall->fulfilled, "Recall fulfilled with move_recall" );
174
ok( $recall->fulfilled, "Recall fulfilled with move_recall" );
175
175
176
$schema->storage->txn_rollback();
176
$schema->storage->txn_rollback();
Lines 191-197 subtest 'filter_by_current() and filter_by_finished() tests' => sub { Link Here
191
191
192
    my $recalls = Koha::Recalls->search(
192
    my $recalls = Koha::Recalls->search(
193
        {
193
        {
194
            recall_id => [
194
            id => [
195
                $in_transit->id,
195
                $in_transit->id,
196
                $overdue->id,
196
                $overdue->id,
197
                $requested->id,
197
                $requested->id,
Lines 201-207 subtest 'filter_by_current() and filter_by_finished() tests' => sub { Link Here
201
                $fulfilled->id,
201
                $fulfilled->id,
202
            ]
202
            ]
203
        },
203
        },
204
        { order_by => [ 'recall_id' ] }
204
        { order_by => [ 'id' ] }
205
    );
205
    );
206
206
207
    is( $recalls->count, 7, 'Resultset count is correct' );
207
    is( $recalls->count, 7, 'Resultset count is correct' );
(-)a/t/db_dependent/XSLT.t (-4 / +3 lines)
Lines 145-153 subtest 'buildKohaItemsNamespace status tests' => sub { Link Here
145
145
146
    t::lib::Mocks::mock_preference('UseRecalls', 1);
146
    t::lib::Mocks::mock_preference('UseRecalls', 1);
147
    my $recall = $builder->build_object({ class => 'Koha::Recalls', value => {
147
    my $recall = $builder->build_object({ class => 'Koha::Recalls', value => {
148
        biblionumber    => $item->biblionumber,
148
        biblio_id         => $item->biblionumber,
149
        itemnumber      => $item->itemnumber,
149
        item_id           => $item->itemnumber,
150
        branchcode      => $item->holdingbranch,
150
        pickup_library_id => $item->holdingbranch,
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
- 

Return to bug 30291