@@ -, +, @@ --- Koha/REST/V1/Checkouts.pm | 12 ++++++++++++ api/v1/swagger/paths/public_patrons.yaml | 4 ++++ 2 files changed, 16 insertions(+) --- a/Koha/REST/V1/Checkouts.pm +++ a/Koha/REST/V1/Checkouts.pm @@ -189,6 +189,18 @@ sub add { my $patron_id = $body->{patron_id}; my $onsite = $body->{onsite_checkout}; + if ( $c->stash('is_public') + && !C4::Context->preference('OpacTrustedCheckout') ) + { + return $c->render( + status => 405, + openapi => { + error => 'Feature disabled', + error_code => 'FEATURE_DISABLED' + } + ); + } + return try { my $item = Koha::Items->find($item_id); unless ($item) { --- a/api/v1/swagger/paths/public_patrons.yaml +++ a/api/v1/swagger/paths/public_patrons.yaml @@ -102,6 +102,10 @@ description: Cannot create checkout schema: $ref: "../swagger.yaml#/definitions/error" + "405": + description: Method not allowed + schema: + $ref: "../swagger.yaml#/definitions/error" "409": description: Conflict in creating checkout schema: --