Lines 25-30
use C4::Context;
Link Here
|
25 |
use C4::Circulation; |
25 |
use C4::Circulation; |
26 |
use Koha::Checkouts; |
26 |
use Koha::Checkouts; |
27 |
use Koha::IssuingRules; |
27 |
use Koha::IssuingRules; |
|
|
28 |
use Koha::Old::Checkouts; |
28 |
|
29 |
|
29 |
use Try::Tiny; |
30 |
use Try::Tiny; |
30 |
|
31 |
|
Lines 44-51
List Koha::Checkout objects
Link Here
|
44 |
|
45 |
|
45 |
sub list { |
46 |
sub list { |
46 |
my $c = shift->openapi->valid_input or return; |
47 |
my $c = shift->openapi->valid_input or return; |
|
|
48 |
my $checked_in = $c->validation->param('checked_in'); |
47 |
try { |
49 |
try { |
48 |
my $checkouts_set = Koha::Checkouts->new; |
50 |
my $checkouts_set; |
|
|
51 |
if ( $checked_in ) { |
52 |
$checkouts_set = Koha::Old::Checkouts->new; |
53 |
} else { |
54 |
$checkouts_set = Koha::Checkouts->new; |
55 |
} |
49 |
my $checkouts = $c->objects->search( $checkouts_set, \&_to_model, \&_to_api ); |
56 |
my $checkouts = $c->objects->search( $checkouts_set, \&_to_model, \&_to_api ); |
50 |
return $c->render( status => 200, openapi => $checkouts ); |
57 |
return $c->render( status => 200, openapi => $checkouts ); |
51 |
} catch { |
58 |
} catch { |
Lines 72-78
get one checkout
Link Here
|
72 |
sub get { |
79 |
sub get { |
73 |
my $c = shift->openapi->valid_input or return; |
80 |
my $c = shift->openapi->valid_input or return; |
74 |
|
81 |
|
75 |
my $checkout = Koha::Checkouts->find( $c->validation->param('checkout_id') ); |
82 |
my $checkout_id = $c->validation->param('checkout_id'); |
|
|
83 |
my $checkout = Koha::Checkouts->find( $checkout_id ); |
84 |
$checkout = Koha::Old::Checkouts->find( $checkout_id ) |
85 |
unless ($checkout); |
76 |
|
86 |
|
77 |
unless ($checkout) { |
87 |
unless ($checkout) { |
78 |
return $c->render( |
88 |
return $c->render( |
Lines 251-256
our $to_model_mapping = {
Link Here
|
251 |
last_renewed_date => 'lastreneweddate', |
261 |
last_renewed_date => 'lastreneweddate', |
252 |
checkout_date => 'issuedate', |
262 |
checkout_date => 'issuedate', |
253 |
note_date => 'notedate', |
263 |
note_date => 'notedate', |
|
|
264 |
checked_in => undef, |
254 |
}; |
265 |
}; |
255 |
|
266 |
|
256 |
1; |
267 |
1; |