#!/usr/bin/perl
# Copyright 2014 ByWater Solutions
+# Copyright 2016 Aleisha Amohia <aleisha@catalyst.net.nz>
#
# This file is part of Koha.
#
use JSON qw(to_json);
use C4::Circulation;
-use C4::Items qw(GetBarcodeFromItemnumber GetItem);
+use C4::Items qw(GetBarcodeFromItemnumber GetItem ModItem);
use C4::Context;
use C4::Auth qw(check_cookie_auth);
+use Koha::Checkouts;
my $input = new CGI;
my $branchcode = $input->param('branchcode')
|| C4::Context->userenv->{'branch'};
+# Expect these inputs to come in as JSON boolean values
+$override_limit = $override_limit ? $override_limit eq 'true' : undef;
+$exempt_fine = $exempt_fine ? $exempt_fine eq 'true' : undef;
+
my $barcode = GetBarcodeFromItemnumber($itemnumber);
my $data;
ModItem( $item, $item->{'biblionumber'}, $item->{'itemnumber'} );
}
+my $checkout = Koha::Checkouts->find({ itemnumber => $itemnumber });
+$data->{patronnote} = $checkout ? $checkout->note : q||;
+
( $data->{returned} ) = AddReturn( $barcode, $branchcode, $exempt_fine );
print to_json($data);