Lines 18-24
Link Here
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
use utf8; |
19 |
use utf8; |
20 |
|
20 |
|
21 |
use Test::More tests => 46; |
21 |
use Test::More tests => 47; |
22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
23 |
|
23 |
|
24 |
use Data::Dumper; |
24 |
use Data::Dumper; |
Lines 40-47
use Koha::DateUtils;
Link Here
|
40 |
use Koha::Database; |
40 |
use Koha::Database; |
41 |
use Koha::IssuingRules; |
41 |
use Koha::IssuingRules; |
42 |
use Koha::Items; |
42 |
use Koha::Items; |
|
|
43 |
use Koha::Item::Transfers; |
43 |
use Koha::Checkouts; |
44 |
use Koha::Checkouts; |
44 |
use Koha::Patrons; |
45 |
use Koha::Patrons; |
|
|
46 |
use Koha::Holds; |
45 |
use Koha::CirculationRules; |
47 |
use Koha::CirculationRules; |
46 |
use Koha::Subscriptions; |
48 |
use Koha::Subscriptions; |
47 |
use Koha::Account::Lines; |
49 |
use Koha::Account::Lines; |
Lines 3424-3429
subtest "Test Backdating of Returns" => sub {
Link Here
|
3424 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3426 |
is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' ); |
3425 |
}; |
3427 |
}; |
3426 |
|
3428 |
|
|
|
3429 |
subtest 'Filling a hold should cancel existing transfer' => sub { |
3430 |
plan tests => 4; |
3431 |
|
3432 |
t::lib::Mocks::mock_preference('AutomaticItemReturn', 1); |
3433 |
|
3434 |
my $libraryA = $builder->build_object( { class => 'Koha::Libraries' } ); |
3435 |
my $libraryB = $builder->build_object( { class => 'Koha::Libraries' } ); |
3436 |
my $patron = $builder->build_object( |
3437 |
{ |
3438 |
class => 'Koha::Patrons', |
3439 |
value => { |
3440 |
categorycode => $patron_category->{categorycode}, |
3441 |
branchcode => $libraryA->branchcode, |
3442 |
} |
3443 |
} |
3444 |
)->store; |
3445 |
|
3446 |
my $item = $builder->build_sample_item({ |
3447 |
homebranch => $libraryB->branchcode, |
3448 |
}); |
3449 |
|
3450 |
my ( undef, $message ) = AddReturn( $item->barcode, $libraryA->branchcode, undef, undef ); |
3451 |
is( Koha::Item::Transfers->search({ itemnumber => $item->itemnumber, datearrived => undef })->count, 1, "We generate a transfer on checkin"); |
3452 |
AddReserve($libraryA->branchcode,$patron->borrowernumber,$item->biblionumber,undef,undef,undef,undef,undef,undef,$item->itemnumber); |
3453 |
my $reserves = Koha::Holds->search({ itemnumber => $item->itemnumber }); |
3454 |
is( $reserves->count, 1, "Reserve is placed"); |
3455 |
( undef, $message ) = AddReturn( $item->barcode, $libraryA->branchcode, undef, undef ); |
3456 |
my $reserve = $reserves->next; |
3457 |
ModReserveAffect( $item->itemnumber, $patron->borrowernumber, 0, $reserve->reserve_id ); |
3458 |
$reserve->discard_changes; |
3459 |
ok( $reserve->found eq 'W', "Reserve is marked waiting" ); |
3460 |
is( Koha::Item::Transfers->search({ itemnumber => $item->itemnumber, datearrived => undef })->count, 0, "No outstanding transfers when hold is waiting"); |
3461 |
}; |
3462 |
|
3427 |
$schema->storage->txn_rollback; |
3463 |
$schema->storage->txn_rollback; |
3428 |
C4::Context->clear_syspref_cache(); |
3464 |
C4::Context->clear_syspref_cache(); |
3429 |
$cache->clear_from_cache('single_holidays'); |
3465 |
$cache->clear_from_cache('single_holidays'); |
3430 |
- |
|
|