Bugzilla – Attachment 192522 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) Add test for undefined LostChargesControl preference
f40f745.patch (text/plain), 2.70 KB, created by
Martin Renvoize (ashimema)
on 2026-02-05 08:54:08 UTC
(
hide
)
Description:
Bug 35612: (QA follow-up) Add test for undefined LostChargesControl preference
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-05 08:54:08 UTC
Size:
2.70 KB
patch
obsolete
>From f40f74568d8fbce6d94ba5196a8f962e2cc473ed Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Thu, 5 Feb 2026 08:16:22 +0000 >Subject: [PATCH] Bug 35612: (QA follow-up) Add test for undefined > LostChargesControl preference > >Adds test coverage for the case where LostChargesControl system >preference is not set (returns undef). This ensures the code >handles this gracefully and defaults to ItemHomeLibrary behavior. > >The test verifies that: >- No warnings are generated when the preference is undefined >- The default behavior (ItemHomeLibrary) is applied correctly >- The correct branch (item homebranch) is recorded in accountlines > >This improves test coverage and prevents regression of the fix >for uninitialized value warnings. >--- > t/db_dependent/Accounts.t | 26 +++++++++++++++++++++++++- > 1 file changed, 25 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index 1f98dfafcff..d81191ac6f8 100755 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -679,7 +679,7 @@ subtest "C4::Accounts::chargelostitem tests" => sub { > my $procfee; > > subtest "Bug 35612: chargelostitem records branch context in accountlines.branchcode" => sub { >- plan tests => 7; >+ plan tests => 8; > > t::lib::Mocks::mock_preference( 'LostChargesControl', 'ItemHomeLibrary' ); > t::lib::Mocks::mock_preference( 'HomeOrHoldingBranch', 'homebranch' ); >@@ -809,6 +809,30 @@ subtest "C4::Accounts::chargelostitem tests" => sub { > 1, > "Dedupes LOST charges for same itemnumber + issue_id (no item_id regression)" > ); >+ >+ # Test undefined LostChargesControl (should default to ItemHomeLibrary behavior) >+ Koha::Account::Lines->search( >+ { borrowernumber => $patron->borrowernumber, itemnumber => $item->itemnumber, debit_type_code => 'LOST' } ) >+ ->delete; >+ >+ t::lib::Mocks::mock_preference( 'LostChargesControl', undef ); >+ t::lib::Mocks::mock_preference( 'HomeOrHoldingBranch', 'homebranch' ); >+ >+ C4::Accounts::chargelostitem( >+ $patron->borrowernumber, $item->itemnumber, 6.12, "Lost test undefined pref", >+ { issue_id => $issue_id } >+ ); >+ >+ $lost = Koha::Account::Lines->find( >+ { >+ borrowernumber => $patron->borrowernumber, itemnumber => $item->itemnumber, debit_type_code => 'LOST', >+ issue_id => $issue_id >+ } >+ ); >+ is( >+ $lost->branchcode, $lib_home, >+ "LOST uses item homebranch when LostChargesControl is undefined (defaults to ItemHomeLibrary)" >+ ); > }; > > subtest "fee application tests" => sub { >-- >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