From 4e1e64b186c542ff7f49234992ef4dd2a55c36df Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 2 Feb 2017 11:10:28 +0100 Subject: [PATCH] Bug 14224: Remove SQL query in svc script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jonathan Druart Signed-off-by: Josef Moravec Signed-off-by: Marc VĂ©ron --- svc/checkin | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/svc/checkin b/svc/checkin index 4bc256f..78db9d9 100755 --- a/svc/checkin +++ b/svc/checkin @@ -27,6 +27,7 @@ use C4::Circulation; use C4::Items qw(GetBarcodeFromItemnumber GetItem ModItem); use C4::Context; use C4::Auth qw(check_cookie_auth); +use Koha::Checkouts; my $input = new CGI; @@ -73,13 +74,8 @@ if ( C4::Context->preference("ReturnToShelvingCart") ) { ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} ); } -my $dbh = C4::Context->dbh; -my $query = "SELECT note FROM issues WHERE itemnumber = ?"; -my $sth = $dbh->prepare($query); -$sth->execute($itemnumber); -my $issue = $sth->fetchrow_hashref; -my $patronnote = $issue->{note}; -$data->{patronnote} = $patronnote; +my $checkout = Koha::Checkouts->find({ itemnumber => $itemnumber }); +$data->{patronnote} = $checkout ? $checkout->note : q||; ( $data->{returned} ) = AddReturn( $barcode, $branchcode, $exempt_fine ); -- 2.1.4