View | Details | Raw Unified | Return to bug 29290
Collapse All | Expand All

(-)a/Koha/REST/V1/Biblios.pm (-1 / +36 lines)
Lines 269-274 sub get_items { Link Here
269
    };
269
    };
270
}
270
}
271
271
272
=head3 get_checkouts
273
274
List Koha::Checkout objects
275
276
=cut
277
278
sub get_checkouts {
279
    my $c = shift->openapi->valid_input or return;
280
281
    my $checked_in = delete $c->validation->output->{checked_in};
282
283
    try {
284
        my $biblio = Koha::Biblios->find( $c->validation->param('biblio_id') );
285
286
        unless ($biblio) {
287
            return $c->render(
288
                status  => 404,
289
                openapi => { error => 'Object not found' }
290
            );
291
        }
292
293
        my $checkouts =
294
          ($checked_in)
295
          ? $c->objects->search( scalar $biblio->old_checkouts )
296
          : $c->objects->search( scalar $biblio->current_checkouts );
297
298
        return $c->render(
299
            status  => 200,
300
            openapi => $checkouts
301
        );
302
    }
303
    catch {
304
        $c->unhandled_exception($_);
305
    };
306
}
307
272
=head3 pickup_locations
308
=head3 pickup_locations
273
309
274
Method that returns the possible pickup_locations for a given biblio
310
Method that returns the possible pickup_locations for a given biblio
275
- 

Return to bug 29290