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

(-)a/t/db_dependent/Circulation/transferbook.t (-17 / +12 lines)
Lines 148-154 subtest 'transfer already at destination' => sub { Link Here
148
        barcode => $item->barcode,
148
        barcode => $item->barcode,
149
        trigger => "Manual"
149
        trigger => "Manual"
150
    });
150
    });
151
    is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' );
151
    is( $dotransfer, 0, 'Transfer of reserved item doesn\'t succeed without ignore_reserves' );
152
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
152
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
153
    is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info");
153
    is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info");
154
};
154
};
Lines 205-219 subtest 'transfer an issued item' => sub { Link Here
205
        barcode => $item->barcode,
205
        barcode => $item->barcode,
206
        trigger => "Manual"
206
        trigger => "Manual"
207
    });
207
    });
208
    is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' );
208
    is( $dotransfer, 0, 'Transfer of reserved item doesn\'t succeed without ignore_reserves' );
209
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
209
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
210
    is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info");
210
    is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info");
211
    is( $messages->{WasReturned}, $patron->borrowernumber, "We got the return info");
211
    is( $messages->{WasReturned}, $patron->borrowernumber, "We got the return info");
212
};
212
};
213
213
214
subtest 'ignore_reserves flag' => sub {
214
subtest 'ignore_reserves flag' => sub {
215
    plan tests => 10;
215
    plan tests => 9;
216
    my $library = $builder->build_object( { class => 'Koha::Libraries' } )->store;
216
    my $library = $builder->build_object( { class => 'Koha::Libraries' } )->store;
217
    my $library2 = $builder->build_object( { class => 'Koha::Libraries' } )->store;
217
    t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } );
218
    t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } );
218
219
219
    my $patron = $builder->build_object(
220
    my $patron = $builder->build_object(
Lines 241-282 subtest 'ignore_reserves flag' => sub { Link Here
241
    #   found will override all other measures that may prevent transfer and force a transfer.
242
    #   found will override all other measures that may prevent transfer and force a transfer.
242
    my ($dotransfer, $messages ) = transferbook({
243
    my ($dotransfer, $messages ) = transferbook({
243
        from_branch => $item->homebranch,
244
        from_branch => $item->homebranch,
244
        to_branch => $library->branchcode,
245
        to_branch => $library2->branchcode,
245
        barcode => $item->barcode,
246
        barcode => $item->barcode,
246
        trigger => "Manual"
247
        trigger => "Manual"
247
    });
248
    });
248
    is( $dotransfer, 1, 'Transfer of reserved item succeeded without ignore reserves' );
249
    is( $dotransfer, 0, 'Transfer of reserved item doesn\'t succeed without ignore_reserves' );
249
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
250
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
250
    is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info");
251
    is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info");
251
252
252
    my $ignore_reserves = 0;
253
    my $ignore_reserves = 0;
253
    ($dotransfer, $messages ) = transferbook({
254
    ($dotransfer, $messages ) = transferbook({
254
        from_branch => $item->homebranch,
255
        from_branch => $item->homebranch,
255
        to_branch => $library->branchcode,
256
        to_branch => $library2->branchcode,
256
        barcode => $item->barcode,
257
        barcode => $item->barcode,
257
        ignore_reserves => $ignore_reserves,
258
        ignore_reserves => $ignore_reserves,
258
        trigger => "Manual"
259
        trigger => "Manual"
259
    });
260
    });
260
    is( $dotransfer, 1, 'Transfer of reserved item succeeded with ignore reserves: false' );
261
    is( $dotransfer, 0, 'Transfer of reserved item doesn\'t succeed without ignore_reserves' );
261
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
262
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
262
    is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info");
263
    is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info");
263
264
264
    $ignore_reserves = 1;
265
    $ignore_reserves = 1;
265
    ($dotransfer, $messages ) = transferbook({
266
    ($dotransfer, $messages ) = transferbook({
266
        from_branch => $item->homebranch,
267
        from_branch => $item->homebranch,
267
        to_branch => $library->branchcode,
268
        to_branch => $library2->branchcode,
268
        barcode => $item->barcode,
269
        barcode => $item->barcode,
269
        ignore_reserves => $ignore_reserves,
270
        ignore_reserves => $ignore_reserves,
270
        trigger => "Manual"
271
        trigger => "Manual"
271
    });
272
    });
272
    is( $dotransfer, 0, 'Transfer of reserved item failed with ignore reserves: true' );
273
    is( $dotransfer, 1, 'Transfer of reserved item succeed with ignore reserves: true' );
273
    is_deeply(
274
    is( $messages->{ResFound}->{ResFound}, 'Reserved', "We found the reserve");
274
        $messages,
275
    is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info");
275
        { 'DestinationEqualsHolding' => 1 },
276
        "We got the expected failure message: DestinationEqualsHolding"
277
    );
278
    isnt( $messages->{ResFound}->{ResFound}, 'Reserved', "We did not return that we found a reserve");
279
    isnt( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We did not return the reserve info");
280
};
276
};
281
277
282
subtest 'transferbook test from branch' => sub {
278
subtest 'transferbook test from branch' => sub {
283
- 

Return to bug 27064