From dcaba0ac4eb969abddcdb7d79c0c2c6f6e0f8dff Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 10 Mar 2020 07:12:07 -0400 Subject: [PATCH] Bug 24620: Fix test, remove replaced code, use dt_from_string Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize --- C4/Reserves.pm | 5 +---- t/db_dependent/Circulation.t | 15 ++++++++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 9a170b58d4..9c040bdc12 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1142,9 +1142,6 @@ sub ModReserveAffect { $hold->itemnumber($itemnumber); $hold->set_waiting($transferToDo); - _koha_notify_reserve( $hold->reserve_id ) - if ( !$transferToDo && !$already_on_shelf ); - if( !$transferToDo ){ _koha_notify_reserve( $hold->reserve_id ) unless $already_on_shelf; my $transfers = Koha::Item::Transfers->search({ @@ -1152,7 +1149,7 @@ sub ModReserveAffect { datearrived => undef }); while( my $transfer = $transfers->next ){ - $transfer->datearrived( DateTime->now( time_zone => C4::Context->tz() ) )->store; + $transfer->datearrived( dt_from_string() )->store; }; } diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 1ca01ea6f8..7ae3b9f694 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -3820,8 +3820,8 @@ subtest 'Filling a hold should cancel existing transfer' => sub { t::lib::Mocks::mock_preference('AutomaticItemReturn', 1); - my $libraryA = $builder->build_object( { class => 'Koha::Libraries' } )->store; - my $libraryB = $builder->build_object( { class => 'Koha::Libraries' } )->store; + my $libraryA = $builder->build_object( { class => 'Koha::Libraries' } ); + my $libraryB = $builder->build_object( { class => 'Koha::Libraries' } ); my $patron = $builder->build_object( { class => 'Koha::Patrons', @@ -3838,11 +3838,12 @@ subtest 'Filling a hold should cancel existing transfer' => sub { my ( undef, $message ) = AddReturn( $item->barcode, $libraryA->branchcode, undef, undef ); is( Koha::Item::Transfers->search({ itemnumber => $item->itemnumber, datearrived => undef })->count, 1, "We generate a transfer on checkin"); - AddReserve( - $libraryA->branchcode, $patron->borrowernumber, $item->biblionumber, '', - 1, undef, undef, '', - undef, $item->itemnumber, undef, undef - ); + AddReserve({ + branchcode => $libraryA->branchcode, + borrowernumber => $patron->borrowernumber, + biblionumber => $item->biblionumber, + itemnumber => $item->itemnumber + }); my $reserves = Koha::Holds->search({ itemnumber => $item->itemnumber }); is( $reserves->count, 1, "Reserve is placed"); ( undef, $message ) = AddReturn( $item->barcode, $libraryA->branchcode, undef, undef ); -- 2.39.5