|
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 => 47; |
21 |
use Test::More tests => 48; |
| 22 |
use Test::MockModule; |
22 |
use Test::MockModule; |
| 23 |
use Test::Deep qw( cmp_deeply ); |
23 |
use Test::Deep qw( cmp_deeply ); |
| 24 |
|
24 |
|
|
Lines 40-47
use C4::Overdues qw(UpdateFine CalcFine);
Link Here
|
| 40 |
use Koha::DateUtils; |
40 |
use Koha::DateUtils; |
| 41 |
use Koha::Database; |
41 |
use Koha::Database; |
| 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 3813-3818
subtest 'Do not return on renewal (LOST charge)' => sub {
Link Here
|
| 3813 |
); |
3815 |
); |
| 3814 |
}; |
3816 |
}; |
| 3815 |
|
3817 |
|
|
|
3818 |
subtest 'Filling a hold should cancel existing transfer' => sub { |
| 3819 |
plan tests => 4; |
| 3820 |
|
| 3821 |
t::lib::Mocks::mock_preference('AutomaticItemReturn', 1); |
| 3822 |
|
| 3823 |
my $libraryA = $builder->build_object( { class => 'Koha::Libraries' } )->store; |
| 3824 |
my $libraryB = $builder->build_object( { class => 'Koha::Libraries' } )->store; |
| 3825 |
my $patron = $builder->build_object( |
| 3826 |
{ |
| 3827 |
class => 'Koha::Patrons', |
| 3828 |
value => { |
| 3829 |
categorycode => $patron_category->{categorycode}, |
| 3830 |
branchcode => $libraryA->branchcode, |
| 3831 |
} |
| 3832 |
} |
| 3833 |
)->store; |
| 3834 |
|
| 3835 |
my $item = $builder->build_sample_item({ |
| 3836 |
homebranch => $libraryB->branchcode, |
| 3837 |
}); |
| 3838 |
|
| 3839 |
my ( undef, $message ) = AddReturn( $item->barcode, $libraryA->branchcode, undef, undef ); |
| 3840 |
is( Koha::Item::Transfers->search({ itemnumber => $item->itemnumber, datearrived => undef })->count, 1, "We generate a transfer on checkin"); |
| 3841 |
AddReserve( |
| 3842 |
$libraryA->branchcode, $patron->borrowernumber, $item->biblionumber, '', |
| 3843 |
1, undef, undef, '', |
| 3844 |
undef, $item->itemnumber, undef, undef |
| 3845 |
); |
| 3846 |
my $reserves = Koha::Holds->search({ itemnumber => $item->itemnumber }); |
| 3847 |
is( $reserves->count, 1, "Reserve is placed"); |
| 3848 |
( undef, $message ) = AddReturn( $item->barcode, $libraryA->branchcode, undef, undef ); |
| 3849 |
my $reserve = $reserves->next; |
| 3850 |
ModReserveAffect( $item->itemnumber, $patron->borrowernumber, 0, $reserve->reserve_id ); |
| 3851 |
$reserve->discard_changes; |
| 3852 |
ok( $reserve->found eq 'W', "Reserve is marked waiting" ); |
| 3853 |
is( Koha::Item::Transfers->search({ itemnumber => $item->itemnumber, datearrived => undef })->count, 0, "No outstanding transfers when hold is waiting"); |
| 3854 |
}; |
| 3855 |
|
| 3816 |
$schema->storage->txn_rollback; |
3856 |
$schema->storage->txn_rollback; |
| 3817 |
C4::Context->clear_syspref_cache(); |
3857 |
C4::Context->clear_syspref_cache(); |
| 3818 |
$cache->clear_from_cache('single_holidays'); |
3858 |
$cache->clear_from_cache('single_holidays'); |
| 3819 |
- |
|
|