From 865ee1803860e1d626700f2220d7e06f19a6510b Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sun, 22 May 2016 10:01:56 +0100 Subject: [PATCH] Bug 16534: Block AddIssue from issuing if the return is not possible MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit To make sure the return can be done, AddIssue must not trust callers (they should have done their job, but we are not sure) and check that the issue can be returned before issuing to the patron. There is no test plan here, this should not be possible from the Koha interface. However, looking at the code, it may be possible using SIP. Signed-off-by: Marc Véron Signed-off-by: Kyle M Hall (cherry picked from commit 1a9674fd3a8d8c898d8dc208d6e3d0296daeca40) Signed-off-by: Frédéric Demians (cherry picked from commit 2cc01d139a9e24b320a12af485143670ed006e23) Signed-off-by: Julian Maurice --- C4/Circulation.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 8c2861c0f0..dcc94f0017 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -1294,6 +1294,8 @@ sub AddIssue { if ( $actualissue->{borrowernumber}) { # This book is currently on loan, but not to the person # who wants to borrow it now. mark it returned before issuing to the new borrower + my ( $allowed, $message ) = CanBookBeReturned( $item, C4::Context->userenv->{branch} ); + return unless $allowed; AddReturn( $item->{'barcode'}, C4::Context->userenv->{'branch'} -- 2.39.5