Bug 33791: Pass itemnumber to $hold->fill

Test plan:

Without this patch:
Place next available level on some book for patron A.
Checkout this book directly to patron A.
Check old_reserves table for this reserve; does not have itemnumber.

With this patch:
Do the same.
In old_reserves the itemnumber should be saved.
Run again t/db_dependent/Koha/Hold.t. Should pass.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit bd5c5eaa38)
Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com>
This commit is contained in:
Marcel de Rooy 2023-05-22 11:14:25 +00:00 committed by Matt Blenkinsop
parent fba7d4e5f7
commit e1b927bee7
2 changed files with 5 additions and 3 deletions

View File

@ -2058,7 +2058,7 @@ sub MoveReserve {
if ($res->{borrowernumber} == $borrowernumber) {
my $hold = Koha::Holds->find( $res->{reserve_id} );
$hold->fill;
$hold->fill({ itemnumber => $itemnumber });
}
else {
# warn "Reserved";
@ -2074,7 +2074,7 @@ sub MoveReserve {
if ( $borr_res ) {
# The item is reserved by the current patron
$borr_res->fill;
$borr_res->fill({ itemnumber => $itemnumber });
}
if ( $cancelreserve eq 'revert' ) { ## Revert waiting reserve to priority 1

View File

@ -777,13 +777,14 @@ sub cancel {
=head3 fill
$hold->fill;
$hold->fill({ itemnumber => $i }); # optional itemnumber: see MoveReserves
This method marks the hold as filled. It effectively moves it to old_reserves.
=cut
sub fill {
my ( $self ) = @_;
my ( $self, $params ) = @_;
$self->_result->result_source->schema->txn_do(
sub {
my $patron = $self->patron;
@ -792,6 +793,7 @@ sub fill {
{
found => 'F',
priority => 0,
$params->{itemnumber} ? ( itemnumber => $params->{itemnumber} ) : (),
}
);