From 73ca6d20c38815b2ee5604464df56e8a86e4e803 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 https://bugs.koha-community.org/show_bug.cgi?id=1526 --- C4/Circulation.pm | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 9596a1026e..5ac47093e8 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1158,17 +1158,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.30.2