From 09931447558e6b6dd3fe676dbb7fb1ebb2be2201 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Mon, 22 May 2023 11:47:41 -0300 Subject: [PATCH] Bug 33791: (QA follow-up) Stick to 'item_id' for the parameter name Signed-off-by: Tomas Cohen Arazi (cherry picked from commit d0195cef6cfdc6d3d2acf7ba06cdd0a5cfaddbb9) Signed-off-by: Matt Blenkinsop --- C4/Reserves.pm | 4 ++-- Koha/Hold.pm | 7 ++++--- t/db_dependent/Koha/Hold.t | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index bf92cde2ec..7c76486b37 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -2058,7 +2058,7 @@ sub MoveReserve { if ($res->{borrowernumber} == $borrowernumber) { my $hold = Koha::Holds->find( $res->{reserve_id} ); - $hold->fill({ itemnumber => $itemnumber }); + $hold->fill({ item_id => $itemnumber }); } else { # warn "Reserved"; @@ -2074,7 +2074,7 @@ sub MoveReserve { if ( $borr_res ) { # The item is reserved by the current patron - $borr_res->fill({ itemnumber => $itemnumber }); + $borr_res->fill({ item_id => $itemnumber }); } if ( $cancelreserve eq 'revert' ) { ## Revert waiting reserve to priority 1 diff --git a/Koha/Hold.pm b/Koha/Hold.pm index 57b7494089..3b82f8cd0d 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -776,10 +776,11 @@ sub cancel { =head3 fill - $hold->fill; - $hold->fill({ itemnumber => $i }); # optional itemnumber: see MoveReserves + $hold->fill({ [ item_id => $item->id ] }); This method marks the hold as filled. It effectively moves it to old_reserves. +The optional I parameter is used to set the information about the +item that filled the hold. =cut @@ -793,7 +794,7 @@ sub fill { { found => 'F', priority => 0, - $params->{itemnumber} ? ( itemnumber => $params->{itemnumber} ) : (), + $params->{item_id} ? ( itemnumber => $params->{item_id} ) : (), } ); diff --git a/t/db_dependent/Koha/Hold.t b/t/db_dependent/Koha/Hold.t index 58f3fc45eb..5fc1646d35 100755 --- a/t/db_dependent/Koha/Hold.t +++ b/t/db_dependent/Koha/Hold.t @@ -124,12 +124,12 @@ subtest 'fill() tests' => sub { is( $old_hold->priority, 0, 'priority set to 0' ); is( $old_hold->found, 'F', 'found set to F' ); - subtest 'itemnumber parameter' => sub { + subtest 'item_id parameter' => sub { plan tests => 1; $category->reservefee(0)->store; # do not disturb later accounts $hold = $builder->build_object({ class => 'Koha::Holds', value => { biblionumber => $biblio->id, borrowernumber => $patron->id, itemnumber => undef, priority => 1 } }); # Simulating checkout without confirming hold - $hold->fill({ itemnumber => $item->id }); + $hold->fill({ item_id => $item->id }); $old_hold = Koha::Old::Holds->find($hold->id); is( $old_hold->itemnumber, $item->itemnumber, 'The itemnumber has been saved in old_reserves by fill' ); $old_hold->delete; -- 2.39.5