use C4::Items qw(GetBarcodeFromItemnumber GetItem ModItem);
use C4::Context;
use C4::Auth qw(check_cookie_auth);
+use Koha::Checkouts;
my $input = new CGI;
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 );