diff --git a/Koha/REST/V1/Checkouts.pm b/Koha/REST/V1/Checkouts.pm index 21b7303a90..ab99808d49 100644 --- a/Koha/REST/V1/Checkouts.pm +++ b/Koha/REST/V1/Checkouts.pm @@ -375,6 +375,17 @@ sub renew { return try { my ( $can_renew, $error ) = CanBookBeRenewed( $checkout->patron, $checkout ); + # Check if error is due to excessive fines and override is requested + if ( !$can_renew && ( $error eq 'too_much_owing' or $error eq 'auto_too_much_owing' ) ) { + my $overrides = $c->stash('koha.overrides'); + if ( $overrides->{debt_limit} && C4::Context->preference("AllowFineOverrideRenewing") ) { + + # Override is allowed, proceed with renewal + $can_renew = 1; + $error = undef; + } + } + if ( !$can_renew ) { return $c->render( status => 403, diff --git a/api/v1/swagger/paths/checkouts.yaml b/api/v1/swagger/paths/checkouts.yaml index 2433916072..4279bd080a 100644 --- a/api/v1/swagger/paths/checkouts.yaml +++ b/api/v1/swagger/paths/checkouts.yaml @@ -203,6 +203,16 @@ parameters: - $ref: "../swagger.yaml#/parameters/checkout_id_pp" - $ref: "../swagger.yaml#/parameters/seen_pp" + - name: x-koha-override + in: header + required: false + description: Overrides list sent as a request header + type: array + items: + type: string + enum: + - debt_limit + collectionFormat: csv produces: - application/json responses: @@ -246,6 +256,16 @@ parameters: - $ref: "../swagger.yaml#/parameters/checkout_id_pp" - $ref: "../swagger.yaml#/parameters/seen_pp" + - name: x-koha-override + in: header + required: false + description: Overrides list sent as a request header + type: array + items: + type: string + enum: + - debt_limit + collectionFormat: csv produces: - application/json responses: