From 8afb13c12667ddc2b04e262b56429e6ec6f030d8 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Wed, 12 Feb 2020 10:19:18 +0100 Subject: [PATCH] Bug 15261: Prevent checkout only if for a different borrower --- C4/Circulation.pm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 71a80bf..97145b1 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1156,17 +1156,17 @@ sub CanBookBeIssued { ReservesOnSamePeriod($item_object->biblionumber, $item_object->itemnumber, $now->ymd, $duedate->ymd); if ($preventCheckoutOnSameReservePeriod && $reserves_on_same_period) { my $reserve = $reserves_on_same_period->[0]; - my $patron = Koha::Patrons->find( $reserve->{borrowernumber} ); - my $branchname = Koha::Libraries->find($reserve->{branchcode})->branchname; - - $needsconfirmation{RESERVED} = 1; - $needsconfirmation{resfirstname} = $patron->firstname; - $needsconfirmation{ressurname} = $patron->surname; - $needsconfirmation{rescardnumber} = $patron->cardnumber; - $needsconfirmation{resborrowernumber} = $patron->borrowernumber; - $needsconfirmation{resbranchcode} = $patron->branchcode; - $needsconfirmation{resreservedate} = $reserve->{reservedate}; - $needsconfirmation{reserve_id} = $reserve->{reserve_id}; + if ($reserve->{borrowernumber} ne $patron->borrowernumber) { + my $patron = Koha::Patrons->find( $reserve->{borrowernumber} ); + $needsconfirmation{RESERVED} = 1; + $needsconfirmation{resfirstname} = $patron->firstname; + $needsconfirmation{ressurname} = $patron->surname; + $needsconfirmation{rescardnumber} = $patron->cardnumber; + $needsconfirmation{resborrowernumber} = $patron->borrowernumber; + $needsconfirmation{resbranchcode} = $patron->branchcode; + $needsconfirmation{resreservedate} = $reserve->{reservedate}; + $needsconfirmation{reserve_id} = $reserve->{reserve_id}; + } } } -- 2.7.4