Bug 33791: (QA follow-up) Stick to 'item_id' for the parameter name

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomás Cohen Arazi 2023-05-22 11:47:41 -03:00
parent bd5c5eaa38
commit d0195cef6c
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
3 changed files with 8 additions and 7 deletions

View file

@ -2022,7 +2022,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";
@ -2038,7 +2038,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

View file

@ -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<item_id> 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} ) : (),
}
);

View file

@ -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;