use C4::Circulation;
use Koha::Checkouts;
use Koha::IssuingRules;
+use Koha::Old::Checkouts;
use Try::Tiny;
sub list {
my $c = shift->openapi->valid_input or return;
+ my $checked_in = $c->validation->param('checked_in');
try {
- my $checkouts_set = Koha::Checkouts->new;
+ my $checkouts_set;
+ if ( $checked_in ) {
+ $checkouts_set = Koha::Old::Checkouts->new;
+ } else {
+ my $checkouts_set = Koha::Checkouts->new;
+ }
my $checkouts = $c->objects->search( $checkouts_set, \&_to_model, \&_to_api );
return $c->render( status => 200, openapi => $checkouts );
} catch {
sub get {
my $c = shift->openapi->valid_input or return;
- my $checkout = Koha::Checkouts->find( $c->validation->param('checkout_id') );
+ my $checkout_id = $c->validation->param('checkout_id');
+ my $checkout = Koha::Checkouts->find( $checkout_id );
+ $checkout = Koha::Old::Checkouts->find( $checkout_id )
+ unless ($checkout);
unless ($checkout) {
return $c->render(
last_renewed_date => 'lastreneweddate',
checkout_date => 'issuedate',
note_date => 'notedate',
+ checked_in => undef,
};
1;
# Created by DBIx::Class::Schema::Loader v0.07046 @ 2019-04-10 19:55:44
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:E2N2paWcCHg916100ry+2A
+__PACKAGE__->add_columns(
+ '+auto_renew' => { is_boolean => 1 },
+ '+onsite_checkout' => { is_boolean => 1 }
+);
+
__PACKAGE__->belongs_to(
"borrower",
"Koha::Schema::Result::Borrower",
"$ref": "../parameters.json#/page"
}, {
"$ref": "../parameters.json#/per_page"
+ },{
+ "name": "checked_in",
+ "in": "query",
+ "description": "By default, current checkouts are returned, when this is true then checked in checkouts are returned as result.",
+ "type": "boolean"
}],
"produces": [
"application/json"