Bugzilla – Attachment 192521 Details for
Bug 35612
Record branch context in accountlines.branchcode for OVERDUE, LOST, and PROCESSING fees
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35612: (QA follow-up) Document undef handling in branch_for_fee_context
1a73827.patch (text/plain), 3.15 KB, created by
Martin Renvoize (ashimema)
on 2026-02-05 08:54:06 UTC
(
hide
)
Description:
Bug 35612: (QA follow-up) Document undef handling in branch_for_fee_context
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-05 08:54:06 UTC
Size:
3.15 KB
patch
obsolete
>From 1a738278da31787c517a07503f5b470b02f32b5c Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Thu, 5 Feb 2026 08:14:51 +0000 >Subject: [PATCH] Bug 35612: (QA follow-up) Document undef handling in > branch_for_fee_context > >Improves POD documentation for branch_for_fee_context to: >- Document all parameters (patron, item, issue objects) >- Explain the resolution logic for each control preference >- Clarify that returning undef is acceptable behavior >- Note how undef is handled by calling code > >Adds inline comment explaining that undef return value is >gracefully handled by Koha::Account->add_debit. > >This addresses concerns about unclear undef handling and >improves maintainability. >--- > Koha/Checkout.pm | 32 +++++++++++++++++++++++++++++--- > 1 file changed, 29 insertions(+), 3 deletions(-) > >diff --git a/Koha/Checkout.pm b/Koha/Checkout.pm >index 63d657a67e6..7c95a5d2a5f 100644 >--- a/Koha/Checkout.pm >+++ b/Koha/Checkout.pm >@@ -344,10 +344,33 @@ sub claim_returned { > =head2 branch_for_fee_context > > my $branchcode = Koha::Checkout->branch_for_fee_context( >- fee_type => 'OVERDUE' | 'LOST' | 'PROCESSING', >- ); >+ fee_type => 'OVERDUE' | 'LOST' | 'PROCESSING', >+ patron => $patron_obj, # Koha::Patron object or hashref >+ item => $item_obj, # Koha::Item object or hashref >+ issue => $issue_obj, # Koha::Checkout object or hashref (optional) >+); >+ >+Determines which branch's rules should apply to a fee based on system preferences >+and available context. >+ >+For LOST/PROCESSING fees, honors LostChargesControl preference: >+- PatronLibrary: Uses patron's home branch >+- PickupLibrary: Uses checkout branch (falls back to patron, then item) >+- ItemHomeLibrary: Uses item's home or holding branch (per HomeOrHoldingBranch pref) >+ >+For OVERDUE fees, honors CircControl preference (same values as above). > >-Determines which branchâs rules should apply to a fee based on system preferences and available context. For LOST/PROCESSING it honors LostChargesControl; for OVERDUE it honors CircControl. It also respects HomeOrHoldingBranch when choosing the itemâs branch. Returns a branchcode (string) or undef if it cannot be determined. >+B<Parameters:> >+- fee_type: 'OVERDUE', 'LOST', or 'PROCESSING' (defaults to 'OVERDUE') >+- patron: Koha::Patron object or hashref with branchcode >+- item: Koha::Item object or hashref with homebranch/holdingbranch >+- issue: Koha::Checkout object or hashref with branchcode (optional) >+ >+B<Returns:> A branchcode (string) or C<undef> if no branch can be determined. >+ >+B<Note:> Returning C<undef> is acceptable - calling code should handle this gracefully. >+When passed to Koha::Account->add_debit as library_id, undef indicates no specific >+branch context is available for the fee. > > =cut > >@@ -384,6 +407,9 @@ sub branch_for_fee_context { > : ( defined $control_pref && $control_pref eq 'PickupLibrary' ) > ? ( $issuing_branch // $patron_branch // $item_branch ) > : $item_branch; # ItemLibrary (default) >+ >+ # May return undef if no branch context is available - this is acceptable >+ # and handled gracefully by Koha::Account->add_debit > return $resolved; > } > >-- >2.52.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 35612
:
186567
|
186568
|
186569
|
186570
|
186571
|
187919
|
187920
|
187921
|
187922
|
189137
|
192345
|
192346
|
192347
|
192348
|
192349
|
192385
|
192386
|
192387
|
192388
|
192389
|
192390
|
192497
|
192498
|
192499
|
192500
|
192501
|
192502
|
192513
|
192514
|
192515
|
192516
|
192517
|
192518
|
192519
|
192520
| 192521 |
192522