Bugzilla – Attachment 187578 Details for
Bug 36506
Processing Fee should be configurable by branch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36506: Use new rules in C4::Accounts
Bug-36506-Use-new-rules-in-C4Accounts.patch (text/plain), 3.84 KB, created by
Andrew Fuerste-Henry
on 2025-10-08 13:51:34 UTC
(
hide
)
Description:
Bug 36506: Use new rules in C4::Accounts
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2025-10-08 13:51:34 UTC
Size:
3.84 KB
patch
obsolete
>From 3eb990cca2f1d5908f3c43be300221b6bf9d4a65 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 1 Oct 2025 19:52:18 +0000 >Subject: [PATCH] Bug 36506: Use new rules in C4::Accounts > >This seems to be the only place processing fee is used, in chargelostitem > >This patch uses get_effective_rule_value, falling back to 0 if no rule. > >We also respect the new system preference, LostChargesControl, introduced in bug 39802 > >To test: > 1 - Apply patch, updatedatabase, restart all > 2 - Set a default/all branches processing rule for Books itemtype to 5 > 3 - Set a rule for branch 1 to 1 > 4 - Set a rule for branch 2 to 2 > 5 - Set a rule for branch 3 to 3 > 6 - Set a rule for branch 4 to 4 > 7 - Set LostChargesControl to 'library the patron is from' > 8 - Check out a Books item from a different branch to a patron from branch 1 > 9 - Mark item lost, confirm processing fee is charged as 1 >10 - Check out out a Books item from a different branch to a patron from branch 5 >11 - Mark item lost, confirm processing fee is 5 >12 - Set LostChargesControl to 'library you are logged in at' >13 - Check out a Books item from a different branch to a patron from branch 1 >14 - Ensure you are logged in at branch 2 >15 - Mark item lost, confirm processing fee is 2 >16 - Set LostChargesControl to 'the library the item is from' >17 - Set HomeOrHoldingBranch to 'homebranch' >18 - Still at branch 2, check out a books item from branch 3 to a patron of branch 1, this ensure holdingbranch is not 3 >19 - Mark item lost, confirm processing fee is 3 >20 - Set HomeOrHoldingBranch to 'holdingbranch' >21 - Ensure you are logged in at branch 4 >22 - Checkout an item from branch 1 to a patron from a different branch >23 - Mark item lost, confirm processing fee is 4 >24 - Test other combos as you see fit >25 - Sign off! > >Sponsored-by: The Main Library Alliance <https://www.mainlib.org/> > >Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org> >--- > C4/Accounts.pm | 30 ++++++++++++++++++++++++++---- > 1 file changed, 26 insertions(+), 4 deletions(-) > >diff --git a/C4/Accounts.pm b/C4/Accounts.pm >index 6d5db418b15..43f1b568b7e 100644 >--- a/C4/Accounts.pm >+++ b/C4/Accounts.pm >@@ -68,11 +68,33 @@ FIXME : if no replacement price, borrower just doesn't get charged? > sub chargelostitem { > my $dbh = C4::Context->dbh(); > my ( $borrowernumber, $itemnumber, $replacementprice, $description ) = @_; >- my $item = Koha::Items->find($itemnumber); >- my $itype = $item->itemtype; >+ my $patron = Koha::Patrons->find($borrowernumber); >+ my $item = Koha::Items->find($itemnumber); >+ my $itype = $item->itemtype; > $replacementprice //= 0; >- my $defaultreplacecost = $itype->defaultreplacecost; >- my $processfee = $itype->processfee; >+ my $defaultreplacecost = $itype->defaultreplacecost; >+ >+ my $lost_control_pref = C4::Context->preference('LostChargesControl'); >+ my $lost_control_branch; >+ if ( $lost_control_pref eq 'PatronLibrary' ) { >+ $lost_control_branch = $patron->branchcode; >+ } elsif ( $lost_control_pref eq 'PickupLibrary' ) { >+ $lost_control_branch = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef; >+ } else { # $lost_control_pref eq 'ItemHomeLibrary' >+ $lost_control_branch = >+ ( C4::Context->preference('HomeOrHoldingBranch') eq 'homebranch' ) >+ ? $item->homebranch >+ : $item->holdingbranch; >+ } >+ >+ my $processfee = Koha::CirculationRules->get_effective_rule_value( >+ { >+ rule_name => "lost_item_processing_fee", >+ categorycode => undef, >+ itemtype => $itype->itemtype, >+ branchcode => $lost_control_branch >+ } >+ ) // 0; > my $usedefaultreplacementcost = C4::Context->preference("useDefaultReplacementCost"); > my $processingfeenote = C4::Context->preference("ProcessingFeeNote"); > >-- >2.39.5
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 36506
:
187411
|
187412
|
187413
|
187414
|
187415
|
187416
|
187417
|
187418
|
187573
|
187574
|
187575
|
187576
|
187577
| 187578 |
187579
|
187580