Bugzilla – Attachment 187922 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: Updates to Circulation.pm
Bug-35612-Updates-to-Circulationpm.patch (text/plain), 5.77 KB, created by
Laura Escamilla
on 2025-10-15 16:10:59 UTC
(
hide
)
Description:
Bug 35612: Updates to Circulation.pm
Filename:
MIME Type:
Creator:
Laura Escamilla
Created:
2025-10-15 16:10:59 UTC
Size:
5.77 KB
patch
obsolete
>From 42eae2cd3a36a36fb95c01a8f956d51fc951ae20 Mon Sep 17 00:00:00 2001 >From: Laura_Escamilla <laura.escamilla@bywatersolutions.com> >Date: Wed, 15 Oct 2025 15:18:38 +0000 >Subject: [PATCH] Bug 35612: Updates to Circulation.pm >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >To test: > >There are dependencies for this patch so youâll need to apply bugs 36506 and 39802 > >1. Create three test libraries â I used the following existing branches in K-T-D: > 1. FPL (use as itemâs home library) > 2. CPL (use as checkout/holding library) > 3. PVL (use as patron home library) >2. Create a patron with home library PVL â Olga Rivera is an example patron. >3. Create an item with: > 1. homebranch = FPL > 2. holdingbranch = CPL >4. System preferences: > 1. FinesMode: set to Calculate and charge. > 2. Within Circulation rules ensure a rule exists that charges overdue fines for the item type/branch youâre using. >5. Check out the item you created or selected to your patron and set the due date to a past date so that it is overdue. >6. Run fines: perl /usr/share/koha/bin/cronjobs/fines.pl >7. Confirm an OVERDUE fine appears on the patronâs account. >8. SQL check (expect branchcode is NULL for the OVERDUE line): >SELECT accountlines_id, branchcode, debit_type_code >FROM accountlines >ORDER BY accountlines_id DESC >LIMIT 10; >9. Apply the patch, run updatedatabase, then restart_all. >10. Enable the system preference CircControl: select an option of PatronLibrary, PickupLibrary, or ItemHomeLibrary >11. Enable the HomeOrHoldingBranch system preference: homebranch or holdingbranch (only matters when CircControl = ItemHomeLibrary) >12. Repeat steps 3-6 for the following scenarios. > 1. CircControl = PatronLibrary â expect PVL (patronâs home). > 2. CircControl = PickupLibrary â expect CPL (checkout/issuing branch). > 3. CircControl = ItemHomeLibrary + HomeOrHoldingBranch = homebranch â expect FPL (itemâs home). > 4. CircControl = ItemHomeLibrary + HomeOrHoldingBranch = holdingbranch â expect CPL (itemâs holding). >13. Next weâre going to test this with âLost Itemsâ >14. Make sure WhenLostChargeReplacementFee syspref is set to Charge >15. Set the LostChargesControl syspref to one of the following PatronLibrary, PickupLibrary, or ItemHomeLibrary >16. Replacement price on the item must be > 0, otherwise no LOST debit is created. >17. First test this manually by setting the item to lost. >18. Start by confirming that an item is currently checked out to the test patron (checked out at CPL). >19. Set preferences for the scenario. >20. Mark the checked out item as lost. >21. SQL check (find the most recent LOST row): >SELECT accountlines_id, branchcode, debit_type_code >FROM accountlines >ORDER BY accountlines_id DESC >LIMIT 10; >22. Next test this by using the longoverdue cron >23. Re-checkout the item (as above), adjust longoverdue rules so cron will mark it lost. >24. Run perl /usr/share/koha/bin/cronjobs/longoverdue.pl --lost 30=1 --charge 1 --confirm --verbose >25. SQL check again for the new LOST row. >26. Test for the following scenarios: > 1. LostChargesControl = PatronLibrary â expect PVL (patronâs home). > 2. LostChargesControl = PickupLibrary â expect CPL (checkout/issuing branch). > 3. LostChargesControl = ItemHomeLibrary + HomeOrHoldingBranch = homebranch â expect FPL (itemâs home). > 4. LostChargesControl = ItemHomeLibrary + HomeOrHoldingBranch = holdingbranch â expect CPL (itemâs holding). >27. Make sure that if the replacement price is 0 â no LOST debit should be created. >28. And ensure that if WhenLostChargeReplacementFee = Donât charge â no LOST debit should be created. >29. Turn FinesMode OFF (i.e., not âCalculate and chargeâ), run fines again â no new OVERDUE debits should be added. >--- > C4/Circulation.pm | 29 ++++++++++++++++------------- > 1 file changed, 16 insertions(+), 13 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index f3e55ae152..b655e9edeb 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -4468,7 +4468,7 @@ sub LostItem { > borrowernumber => $borrowernumber, > } > )->next; >- $library_id = branch_for_fee_context( >+ $library_id = C4::Overdues::branch_for_fee_context( > fee_type => 'LOST', > patron => $patron, > item => $item_obj, >@@ -4476,19 +4476,22 @@ sub LostItem { > ); > } > >- Koha::Account->new( { patron_id => $borrowernumber } )->add_debit( >- { >- amount => $issues->{'replacementprice'} + 0, >- type => 'LOST', >- description => $desc, >- interface => $interface, >- library_id => $library_id, >- item_id => $itemnumber, >- ( $issues->{issue_id} ? ( issue_id => $issues->{issue_id} ) : () ), >- } >- ); >- } >+ my $amount = 0 + ( $issues->{replacementprice} // 0 ); > >+ if ( $amount > 0 ) { >+ Koha::Account->new( { patron_id => $borrowernumber } )->add_debit( >+ { >+ amount => $amount, >+ type => 'LOST', >+ description => $desc, >+ interface => $interface, >+ library_id => $library_id, >+ item_id => $itemnumber, >+ ( $issues->{issue_id} ? ( issue_id => $issues->{issue_id} ) : () ), >+ } >+ ); >+ } >+ } > MarkIssueReturned( $borrowernumber, $itemnumber, undef, $patron->privacy, $params ) if $mark_returned; > } > >-- >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 35612
:
186567
|
186568
|
186569
|
186570
|
186571
|
187919
|
187920
|
187921
|
187922
|
189137