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

(-)a/C4/Reserves.pm (-2 / +11 lines)
Lines 1105-1112 sub ModReserveAffect { Link Here
1105
    $hold->itemnumber($itemnumber);
1105
    $hold->itemnumber($itemnumber);
1106
    $hold->set_waiting($transferToDo);
1106
    $hold->set_waiting($transferToDo);
1107
1107
1108
    _koha_notify_reserve( $hold->reserve_id )
1108
    if( !$transferToDo ){
1109
      if ( !$transferToDo && !$already_on_shelf );
1109
        _koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf;
1110
        my $transfers = Koha::Item::Transfers->search({
1111
            itemnumber => $itemnumber,
1112
            datearrived => undef
1113
        });
1114
        while( my $transfer = $transfers->next ){
1115
            $transfer->datearrived( dt_from_string() )->store;
1116
        };
1117
    }
1118
1110
1119
1111
    _FixPriority( { biblionumber => $biblionumber } );
1120
    _FixPriority( { biblionumber => $biblionumber } );
1112
    my $item = Koha::Items->find($itemnumber);
1121
    my $item = Koha::Items->find($itemnumber);
(-)a/t/db_dependent/Circulation.t (-2 / +37 lines)
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
- 

Return to bug 24620