Lines 27-32
use Koha::Checkouts;
Link Here
|
27 |
use Koha::Old::Checkouts; |
27 |
use Koha::Old::Checkouts; |
28 |
use Koha::Token; |
28 |
use Koha::Token; |
29 |
|
29 |
|
|
|
30 |
use Scalar::Util qw( blessed ); |
30 |
use Try::Tiny qw( catch try ); |
31 |
use Try::Tiny qw( catch try ); |
31 |
|
32 |
|
32 |
=head1 NAME |
33 |
=head1 NAME |
Lines 190-208
sub add {
Link Here
|
190 |
my $patron_id = $body->{patron_id}; |
191 |
my $patron_id = $body->{patron_id}; |
191 |
my $onsite = $body->{onsite_checkout}; |
192 |
my $onsite = $body->{onsite_checkout}; |
192 |
|
193 |
|
193 |
if ( $c->stash('is_public') |
|
|
194 |
&& !C4::Context->preference('OpacTrustedCheckout') ) |
195 |
{ |
196 |
return $c->render( |
197 |
status => 405, |
198 |
openapi => { |
199 |
error => 'Feature disabled', |
200 |
error_code => 'FEATURE_DISABLED' |
201 |
} |
202 |
); |
203 |
} |
204 |
|
205 |
return try { |
194 |
return try { |
|
|
195 |
if ( $c->stash('is_public') ) { |
196 |
$c->auth->public($patron_id); |
197 |
|
198 |
return $c->render( |
199 |
status => 405, |
200 |
openapi => { |
201 |
error => 'Feature disabled', |
202 |
error_code => 'FEATURE_DISABLED' |
203 |
} |
204 |
) if !C4::Context->preference('OpacTrustedCheckout'); |
205 |
} |
206 |
|
206 |
my $item = Koha::Items->find($item_id); |
207 |
my $item = Koha::Items->find($item_id); |
207 |
unless ($item) { |
208 |
unless ($item) { |
208 |
return $c->render( |
209 |
return $c->render( |