Bugzilla – Attachment 188342 Details for
Bug 23415
Notify patron fines when renewing
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23415: Add REST API support for fine override on renewal
Bug-23415-Add-REST-API-support-for-fine-override-o.patch (text/plain), 3.61 KB, created by
Martin Renvoize (ashimema)
on 2025-10-23 11:25:47 UTC
(
hide
)
Description:
Bug 23415: Add REST API support for fine override on renewal
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-10-23 11:25:47 UTC
Size:
3.61 KB
patch
obsolete
>From be48f51df5e1f2450eb6315786976ce28f5aaebc Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Thu, 23 Oct 2025 12:12:10 +0100 >Subject: [PATCH] Bug 23415: Add REST API support for fine override on renewal > >This commit adds support for the AllowFineOverrideRenewing functionality >to the REST API renewal endpoints using the standard x-koha-override pattern. > >Changes: >1. Added x-koha-override header parameter to both renewal endpoints: > - POST /checkouts/{checkout_id}/renewal > - POST /checkouts/{checkout_id}/renewals > >2. Updated Koha::REST::V1::Checkouts::renew() to: > - Check for 'debt_limit' in the overrides stash > - Check AllowFineOverrideRenewing preference when override is requested > - Allow renewal override only when both: > * x-koha-override header contains 'debt_limit' AND > * AllowFineOverrideRenewing preference is enabled > - Follows the established x-koha-override pattern used by other endpoints > >3. Updated OpenAPI specification (swagger) to document the new header > using the standard pattern with enum values > >Usage: > curl -X POST /api/v1/checkouts/123/renewal \ > -H "x-koha-override: debt_limit" > >The override only works for too_much_owing errors and requires >the AllowFineOverrideRenewing system preference to be enabled. > >This implementation follows the same pattern as holds and other >endpoints that support overrides, maintaining consistency across >the REST API. >--- > Koha/REST/V1/Checkouts.pm | 11 +++++++++++ > api/v1/swagger/paths/checkouts.yaml | 20 ++++++++++++++++++++ > 2 files changed, 31 insertions(+) > >diff --git a/Koha/REST/V1/Checkouts.pm b/Koha/REST/V1/Checkouts.pm >index 21b7303a903..ab99808d497 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 24339160720..4279bd080a7 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: >-- >2.51.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 23415
:
92039
|
92541
|
98442
|
98634
|
98996
|
98997
|
105893
|
105894
|
108392
|
109871
|
109872
|
109876
|
109880
|
116919
|
116920
|
116921
|
116922
|
118175
|
118176
|
118177
|
118178
|
118183
|
119300
|
119301
|
119302
|
119303
|
121472
|
139670
|
139671
|
139672
|
139673
|
139674
|
146415
|
148198
|
148199
|
148200
|
148201
|
148202
|
152776
|
152777
|
152778
|
152779
|
152780
|
152781
|
154595
|
154596
|
154597
|
154598
|
154599
|
154600
|
158302
|
158303
|
158304
|
158305
|
158306
|
158307
|
161964
|
161965
|
161966
|
161967
|
161968
|
161969
|
162171
|
162172
|
162173
|
162174
|
162175
|
162176
|
162177
|
162178
|
162179
|
162180
|
171620
|
171621
|
171622
|
171623
|
171983
|
171984
|
171985
|
171986
|
172906
|
172907
|
172908
|
172909
|
172910
|
185270
|
185271
|
185272
|
185273
|
185274
|
185275
|
186014
|
188331
|
188332
|
188333
|
188334
|
188335
|
188336
|
188337
|
188338
|
188339
|
188340
|
188341
| 188342