From 09097b3b8973c35953eb513aed847c9a6b92ee5a 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 Signed-off-by: Jonathan Druart Signed-off-by: Josef Moravec --- 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