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 191-208
sub add {
Link Here
|
191 |
my $onsite = $body->{onsite_checkout}; |
192 |
my $onsite = $body->{onsite_checkout}; |
192 |
my $barcode = $body->{external_id}; |
193 |
my $barcode = $body->{external_id}; |
193 |
|
194 |
|
194 |
if ( $c->stash('is_public') |
|
|
195 |
&& !C4::Context->preference('OpacTrustedCheckout') ) |
196 |
{ |
197 |
return $c->render( |
198 |
status => 405, |
199 |
openapi => { |
200 |
error => 'Feature disabled', |
201 |
error_code => 'FEATURE_DISABLED' |
202 |
} |
203 |
); |
204 |
} |
205 |
|
206 |
return try { |
195 |
return try { |
207 |
|
196 |
|
208 |
unless ( $item_id or $barcode ) { |
197 |
unless ( $item_id or $barcode ) { |
Lines 215-220
sub add {
Link Here
|
215 |
); |
204 |
); |
216 |
} |
205 |
} |
217 |
|
206 |
|
|
|
207 |
if ( $c->stash('is_public') ) { |
208 |
$c->auth->public($patron_id); |
209 |
|
210 |
return $c->render( |
211 |
status => 405, |
212 |
openapi => { |
213 |
error => 'Feature disabled', |
214 |
error_code => 'FEATURE_DISABLED' |
215 |
} |
216 |
) if !C4::Context->preference('OpacTrustedCheckout'); |
217 |
} |
218 |
|
218 |
my $item; |
219 |
my $item; |
219 |
if ($item_id) { |
220 |
if ($item_id) { |
220 |
$item = Koha::Items->find($item_id); |
221 |
$item = Koha::Items->find($item_id); |