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 2096-2139 subtest 'AddIssue | recalls' => sub { Link Here
2096
2096
2097
    # checking out item that they have recalled
2097
    # checking out item that they have recalled
2098
    my $recall1 = Koha::Recall->new(
2098
    my $recall1 = Koha::Recall->new(
2099
        {   borrowernumber    => $patron1->borrowernumber,
2099
        {   patron_id         => $patron1->borrowernumber,
2100
            biblionumber      => $item->biblionumber,
2100
            biblio_id         => $item->biblionumber,
2101
            itemnumber        => $item->itemnumber,
2101
            item_id           => $item->itemnumber,
2102
            item_level_recall => 1,
2102
            item_level        => 1,
2103
            branchcode        => $patron1->branchcode,
2103
            pickup_library_id => $patron1->branchcode,
2104
        }
2104
        }
2105
    )->store;
2105
    )->store;
2106
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall1->recall_id } );
2106
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall1->id } );
2107
    $recall1 = Koha::Recalls->find( $recall1->recall_id );
2107
    $recall1 = Koha::Recalls->find( $recall1->id );
2108
    is( $recall1->fulfilled, 1, 'Recall was fulfilled when patron checked out item' );
2108
    is( $recall1->fulfilled, 1, 'Recall was fulfilled when patron checked out item' );
2109
    AddReturn( $item->barcode, $item->homebranch );
2109
    AddReturn( $item->barcode, $item->homebranch );
2110
2110
2111
    # this item is has a recall request. cancel recall
2111
    # this item is has a recall request. cancel recall
2112
    my $recall2 = Koha::Recall->new(
2112
    my $recall2 = Koha::Recall->new(
2113
        {   borrowernumber    => $patron2->borrowernumber,
2113
        {   patron_id         => $patron2->borrowernumber,
2114
            biblionumber      => $item->biblionumber,
2114
            biblio_id         => $item->biblionumber,
2115
            itemnumber        => $item->itemnumber,
2115
            item_id           => $item->itemnumber,
2116
            item_level_recall => 1,
2116
            item_level        => 1,
2117
            branchcode        => $patron2->branchcode,
2117
            pickup_library_id => $patron2->branchcode,
2118
        }
2118
        }
2119
    )->store;
2119
    )->store;
2120
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall2->recall_id, cancel_recall => 'cancel' } );
2120
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall2->id, cancel_recall => 'cancel' } );
2121
    $recall2 = Koha::Recalls->find( $recall2->recall_id );
2121
    $recall2 = Koha::Recalls->find( $recall2->id );
2122
    is( $recall2->cancelled, 1, 'Recall was cancelled when patron checked out item' );
2122
    is( $recall2->cancelled, 1, 'Recall was cancelled when patron checked out item' );
2123
    AddReturn( $item->barcode, $item->homebranch );
2123
    AddReturn( $item->barcode, $item->homebranch );
2124
2124
2125
    # this item is waiting to fulfill a recall. revert recall
2125
    # this item is waiting to fulfill a recall. revert recall
2126
    my $recall3 = Koha::Recall->new(
2126
    my $recall3 = Koha::Recall->new(
2127
        {   borrowernumber    => $patron2->borrowernumber,
2127
        {   patron_id         => $patron2->borrowernumber,
2128
            biblionumber      => $item->biblionumber,
2128
            biblio_id         => $item->biblionumber,
2129
            itemnumber        => $item->itemnumber,
2129
            item_id           => $item->itemnumber,
2130
            item_level_recall => 1,
2130
            item_level        => 1,
2131
            branchcode        => $patron2->branchcode,
2131
            pickup_library_id => $patron2->branchcode,
2132
        }
2132
        }
2133
    )->store;
2133
    )->store;
2134
    $recall3->set_waiting;
2134
    $recall3->set_waiting;
2135
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall3->recall_id, cancel_recall => 'revert' } );
2135
    AddIssue( $patron1->unblessed, $item->barcode, undef, undef, undef, undef, { recall_id => $recall3->id, cancel_recall => 'revert' } );
2136
    $recall3 = Koha::Recalls->find( $recall3->recall_id );
2136
    $recall3 = Koha::Recalls->find( $recall3->id );
2137
    is( $recall3->requested, 1, 'Recall was reverted from waiting when patron checked out item' );
2137
    is( $recall3->requested, 1, 'Recall was reverted from waiting when patron checked out item' );
2138
    AddReturn( $item->barcode, $item->homebranch );
2138
    AddReturn( $item->barcode, $item->homebranch );
2139
};
2139
};
Lines 4116-4162 subtest 'CanBookBeIssued | recalls' => sub { Link Here
4116
4116
4117
    # item-level recall
4117
    # item-level recall
4118
    my $recall = Koha::Recall->new(
4118
    my $recall = Koha::Recall->new(
4119
        {   borrowernumber    => $patron1->borrowernumber,
4119
        {   patron_id         => $patron1->borrowernumber,
4120
            biblionumber      => $item->biblionumber,
4120
            biblio_id         => $item->biblionumber,
4121
            itemnumber        => $item->itemnumber,
4121
            item_id           => $item->itemnumber,
4122
            item_level_recall => 1,
4122
            item_level        => 1,
4123
            branchcode        => $patron1->branchcode,
4123
            pickup_library_id => $patron1->branchcode,
4124
        }
4124
        }
4125
    )->store;
4125
    )->store;
4126
4126
4127
    my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron2, $item->barcode, undef, undef, undef, undef );
4127
    my ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron2, $item->barcode, undef, undef, undef, undef );
4128
    is( $needsconfirmation->{RECALLED}->recall_id, $recall->recall_id, "Another patron has placed an item-level recall on this item" );
4128
    is( $needsconfirmation->{RECALLED}->id, $recall->id, "Another patron has placed an item-level recall on this item" );
4129
4129
4130
    $recall->set_cancelled;
4130
    $recall->set_cancelled;
4131
4131
4132
    # biblio-level recall
4132
    # biblio-level recall
4133
    $recall = Koha::Recall->new(
4133
    $recall = Koha::Recall->new(
4134
        {   borrowernumber    => $patron1->borrowernumber,
4134
        {   patron_id         => $patron1->borrowernumber,
4135
            biblionumber      => $item->biblionumber,
4135
            biblio_id         => $item->biblionumber,
4136
            itemnumber        => undef,
4136
            item_id           => undef,
4137
            item_level_recall => 0,
4137
            item_level        => 0,
4138
            branchcode        => $patron1->branchcode,
4138
            pickup_library_id => $patron1->branchcode,
4139
        }
4139
        }
4140
    )->store;
4140
    )->store;
4141
4141
4142
    ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron2, $item->barcode, undef, undef, undef, undef );
4142
    ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron2, $item->barcode, undef, undef, undef, undef );
4143
    is( $needsconfirmation->{RECALLED}->recall_id, $recall->recall_id, "Another patron has placed a biblio-level recall and this item is eligible to fill it" );
4143
    is( $needsconfirmation->{RECALLED}->id, $recall->id, "Another patron has placed a biblio-level recall and this item is eligible to fill it" );
4144
4144
4145
    $recall->set_cancelled;
4145
    $recall->set_cancelled;
4146
4146
4147
    # biblio-level recall
4147
    # biblio-level recall
4148
    $recall = Koha::Recall->new(
4148
    $recall = Koha::Recall->new(
4149
        {   borrowernumber    => $patron1->borrowernumber,
4149
        {   patron_id         => $patron1->borrowernumber,
4150
            biblionumber      => $item->biblionumber,
4150
            biblio_id         => $item->biblionumber,
4151
            itemnumber        => undef,
4151
            item_id           => undef,
4152
            item_level_recall => 0,
4152
            item_level        => 0,
4153
            branchcode        => $patron1->branchcode,
4153
            pickup_library_id => $patron1->branchcode,
4154
        }
4154
        }
4155
    )->store;
4155
    )->store;
4156
    $recall->set_waiting( { item => $item, expirationdate => dt_from_string() } );
4156
    $recall->set_waiting( { item => $item, expirationdate => dt_from_string() } );
4157
4157
4158
    my ( undef, undef, undef, $messages ) = CanBookBeIssued( $patron1, $item->barcode, undef, undef, undef, undef );
4158
    my ( undef, undef, undef, $messages ) = CanBookBeIssued( $patron1, $item->barcode, undef, undef, undef, undef );
4159
    is( $messages->{RECALLED}, $recall->recall_id, "This book can be issued by this patron and they have placed a recall" );
4159
    is( $messages->{RECALLED}, $recall->id, "This book can be issued by this patron and they have placed a recall" );
4160
4160
4161
    $recall->set_cancelled;
4161
    $recall->set_cancelled;
4162
};
4162
};
Lines 4196-4220 subtest 'AddReturn | recalls' => sub { Link Here
4196
    # this item can fill a recall with pickup at this branch
4196
    # this item can fill a recall with pickup at this branch
4197
    AddIssue( $patron1->unblessed, $item1->barcode );
4197
    AddIssue( $patron1->unblessed, $item1->barcode );
4198
    my $recall1 = Koha::Recall->new(
4198
    my $recall1 = Koha::Recall->new(
4199
        {   borrowernumber    => $patron2->borrowernumber,
4199
        {   patron_id         => $patron2->borrowernumber,
4200
            biblionumber      => $item1->biblionumber,
4200
            biblio_id         => $item1->biblionumber,
4201
            itemnumber        => $item1->itemnumber,
4201
            item_id           => $item1->itemnumber,
4202
            item_level_recall => 1,
4202
            item_level        => 1,
4203
            branchcode        => $item1->homebranch,
4203
            pickup_library_id => $item1->homebranch,
4204
        }
4204
        }
4205
    )->store;
4205
    )->store;
4206
    my ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $item1->homebranch );
4206
    my ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $item1->homebranch );
4207
    is( $messages->{RecallFound}->recall_id, $recall1->recall_id, "Recall found" );
4207
    is( $messages->{RecallFound}->id, $recall1->id, "Recall found" );
4208
    $recall1->set_cancelled;
4208
    $recall1->set_cancelled;
4209
4209
4210
    # this item can fill a recall but needs transfer
4210
    # this item can fill a recall but needs transfer
4211
    AddIssue( $patron1->unblessed, $item1->barcode );
4211
    AddIssue( $patron1->unblessed, $item1->barcode );
4212
    $recall1 = Koha::Recall->new(
4212
    $recall1 = Koha::Recall->new(
4213
        {   borrowernumber    => $patron2->borrowernumber,
4213
        {   patron_id         => $patron2->borrowernumber,
4214
            biblionumber      => $item1->biblionumber,
4214
            biblio_id         => $item1->biblionumber,
4215
            itemnumber        => $item1->itemnumber,
4215
            item_id           => $item1->itemnumber,
4216
            item_level_recall => 1,
4216
            item_level        => 1,
4217
            branchcode        => $patron2->branchcode,
4217
            pickup_library_id => $patron2->branchcode,
4218
        }
4218
        }
4219
    )->store;
4219
    )->store;
4220
    ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $item1->homebranch );
4220
    ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $item1->homebranch );
Lines 4224-4239 subtest 'AddReturn | recalls' => sub { Link Here
4224
    # this item is already in transit, do not ask to transfer
4224
    # this item is already in transit, do not ask to transfer
4225
    AddIssue( $patron1->unblessed, $item1->barcode );
4225
    AddIssue( $patron1->unblessed, $item1->barcode );
4226
    $recall1 = Koha::Recall->new(
4226
    $recall1 = Koha::Recall->new(
4227
        {   borrowernumber    => $patron2->borrowernumber,
4227
        {   patron_id         => $patron2->borrowernumber,
4228
            biblionumber      => $item1->biblionumber,
4228
            biblio_id         => $item1->biblionumber,
4229
            itemnumber        => $item1->itemnumber,
4229
            item_id           => $item1->itemnumber,
4230
            item_level_recall => 1,
4230
            item_level        => 1,
4231
            branchcode        => $patron2->branchcode,
4231
            pickup_library_id => $patron2->branchcode,
4232
        }
4232
        }
4233
    )->store;
4233
    )->store;
4234
    $recall1->start_transfer;
4234
    $recall1->start_transfer;
4235
    ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $patron2->branchcode );
4235
    ( $doreturn, $messages, $iteminfo, $borrowerinfo ) = AddReturn( $item1->barcode, $patron2->branchcode );
4236
    is( $messages->{TransferredRecall}->recall_id, $recall1->recall_id, "In transit recall found" );
4236
    is( $messages->{TransferredRecall}->id, $recall1->id, "In transit recall found" );
4237
    $recall1->set_cancelled;
4237
    $recall1->set_cancelled;
4238
};
4238
};
4239
4239
(-)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 1094-1139 subtest 'recalls() tests' => sub { Link Here
1094
    my $item2 = $builder->build_object({ class => 'Koha::Items' }, { value => { biblionumber => $biblio2->biblionumber } });
1094
    my $item2 = $builder->build_object({ class => 'Koha::Items' }, { value => { biblionumber => $biblio2->biblionumber } });
1095
1095
1096
    Koha::Recall->new(
1096
    Koha::Recall->new(
1097
        {   biblionumber      => $biblio1->biblionumber,
1097
        {   biblio_id         => $biblio1->biblionumber,
1098
            borrowernumber    => $patron->borrowernumber,
1098
            patron_id         => $patron->borrowernumber,
1099
            itemnumber        => $item1->itemnumber,
1099
            item_id           => $item1->itemnumber,
1100
            branchcode        => $patron->branchcode,
1100
            pickup_library_id => $patron->branchcode,
1101
            recalldate        => \'NOW()',
1101
            created_date      => \'NOW()',
1102
            item_level_recall => 1,
1102
            item_level        => 1,
1103
        }
1103
        }
1104
    )->store;
1104
    )->store;
1105
    Koha::Recall->new(
1105
    Koha::Recall->new(
1106
        {   biblionumber      => $biblio2->biblionumber,
1106
        {   biblio_id         => $biblio2->biblionumber,
1107
            borrowernumber    => $patron->borrowernumber,
1107
            patron_id         => $patron->borrowernumber,
1108
            itemnumber        => $item2->itemnumber,
1108
            item_id           => $item2->itemnumber,
1109
            branchcode        => $patron->branchcode,
1109
            pickup_library_id => $patron->branchcode,
1110
            recalldate        => \'NOW()',
1110
            created_date      => \'NOW()',
1111
            item_level_recall => 1,
1111
            item_level        => 1,
1112
        }
1112
        }
1113
    )->store;
1113
    )->store;
1114
    Koha::Recall->new(
1114
    Koha::Recall->new(
1115
        {   biblionumber      => $biblio1->biblionumber,
1115
        {   biblio_id         => $biblio1->biblionumber,
1116
            borrowernumber    => $patron->borrowernumber,
1116
            patron_id         => $patron->borrowernumber,
1117
            itemnumber        => undef,
1117
            item_id           => undef,
1118
            branchcode        => $patron->branchcode,
1118
            pickup_library_id => $patron->branchcode,
1119
            recalldate        => \'NOW()',
1119
            created_date      => \'NOW()',
1120
            item_level_recall => 0,
1120
            item_level        => 0,
1121
        }
1121
        }
1122
    )->store;
1122
    )->store;
1123
    my $recall = Koha::Recall->new(
1123
    my $recall = Koha::Recall->new(
1124
        {   biblionumber      => $biblio1->biblionumber,
1124
        {   biblio_id         => $biblio1->biblionumber,
1125
            borrowernumber    => $patron->borrowernumber,
1125
            patron_id         => $patron->borrowernumber,
1126
            itemnumber        => undef,
1126
            item_id           => undef,
1127
            branchcode        => $patron->branchcode,
1127
            pickup_library_id => $patron->branchcode,
1128
            recalldate        => \'NOW()',
1128
            created_date      => \'NOW()',
1129
            item_level_recall => 0,
1129
            item_level        => 0,
1130
        }
1130
        }
1131
    )->store;
1131
    )->store;
1132
    $recall->set_cancelled;
1132
    $recall->set_cancelled;
1133
1133
1134
    is( $patron->recalls->count,                                                                          4, "Correctly gets this patron's recalls" );
1134
    is( $patron->recalls->count,                                                                       4, "Correctly gets this patron's recalls" );
1135
    is( $patron->recalls->filter_by_current->count,                                                       3, "Correctly gets this patron's active recalls" );
1135
    is( $patron->recalls->filter_by_current->count,                                                    3, "Correctly gets this patron's active recalls" );
1136
    is( $patron->recalls->filter_by_current->search( { biblionumber => $biblio1->biblionumber } )->count, 2, "Correctly gets this patron's active recalls on a specific biblio" );
1136
    is( $patron->recalls->filter_by_current->search( { biblio_id => $biblio1->biblionumber } )->count, 2, "Correctly gets this patron's active recalls on a specific biblio" );
1137
1137
1138
    $schema->storage->txn_rollback;
1138
    $schema->storage->txn_rollback;
1139
};
1139
};
(-)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