Bug 22321: Fix store() crash when modifying borrowernumber of a new ILL request

To test:
1. prove t/db_dependent/Illrequests.t

Signed-off-by: Magnus Enger <magnus@libriotech.no>
Tried to change the borrowernumber connected to an ILL request
and checked that the associated hold was updated to the new
patron as well.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Lari Taskula 2022-02-22 14:13:58 +00:00 committed by Tomas Cohen Arazi
parent c99c42d5d4
commit 8ac3a5beec
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 2 additions and 2 deletions

View File

@ -1761,7 +1761,7 @@ sub store {
my %updated_columns = $self->_result->get_dirty_columns;
my @holds;
if( defined $updated_columns{'borrowernumber'} and
if( $self->in_storage and defined $updated_columns{'borrowernumber'} and
Koha::Patrons->find( $updated_columns{'borrowernumber'} ) )
{
# borrowernumber has changed
@ -1769,7 +1769,7 @@ sub store {
@holds = Koha::Holds->search( {
borrowernumber => $old_illreq->borrowernumber,
biblionumber => $self->biblio_id,
} )->as_list;
} )->as_list if $old_illreq;
}
my $ret = $self->SUPER::store;