Bugzilla – Attachment 192347 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: Unit test - Circulation.t
Bug-35612-Unit-test---Circulationt.patch (text/plain), 4.39 KB, created by
Laura Escamilla
on 2026-02-02 22:54:00 UTC
(
hide
)
Description:
Bug 35612: Unit test - Circulation.t
Filename:
MIME Type:
Creator:
Laura Escamilla
Created:
2026-02-02 22:54:00 UTC
Size:
4.39 KB
patch
obsolete
>From 16802ac662c1e712f432e20732540c303baf7577 Mon Sep 17 00:00:00 2001 >From: Laura_Escamilla <laura.escamilla@bywatersolutions.com> >Date: Mon, 2 Feb 2026 22:22:55 +0000 >Subject: [PATCH] Bug 35612: Unit test - Circulation.t > >--- > t/db_dependent/Circulation.t | 74 +++++++++++++++++++++++++++++++++++- > 1 file changed, 72 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 1b91ebfddf..98896ef437 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -497,7 +497,7 @@ subtest "GetIssuingCharges tests" => sub { > > my ( $reused_itemnumber_1, $reused_itemnumber_2 ); > subtest "CanBookBeRenewed tests" => sub { >- plan tests => 114; >+ plan tests => 115; > > C4::Context->set_preference( 'ItemsDeniedRenewal', '' ); > >@@ -1715,6 +1715,76 @@ subtest "CanBookBeRenewed tests" => sub { > ); > t::lib::Mocks::mock_preference( 'UnseenRenewals', 0 ); > >+ subtest 'Bug 35612: fee branch context' => sub { >+ plan tests => 8; >+ >+ my $lib_home = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $lib_hold = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $lib_issue = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $lib_patron = $builder->build_object( { class => 'Koha::Libraries' } ); >+ >+ my $patron = >+ $builder->build_object( { class => 'Koha::Patrons', value => { branchcode => $lib_patron->branchcode } } ); >+ >+ my $assert_fee_branchcode = sub { >+ my ( $fee_type, $circ_control, $lost_control, $hoh, $expected, $label ) = @_; >+ >+ t::lib::Mocks::mock_preference( 'CircControl', $circ_control ) if defined $circ_control; >+ t::lib::Mocks::mock_preference( 'HomeOrHoldingBranch', $hoh // 'homebranch' ); >+ >+ my $item = $builder->build_sample_item(); >+ $item->homebranch( $lib_home->branchcode )->holdingbranch( $lib_hold->branchcode )->store; >+ >+ my $checkout = $builder->build_object( >+ { >+ class => 'Koha::Checkouts', >+ value => { >+ itemnumber => $item->itemnumber, >+ borrowernumber => $patron->borrowernumber, >+ branchcode => $lib_issue->branchcode, >+ date_due => dt_from_string()->subtract( days => 1 ), >+ } >+ } >+ ); >+ >+ C4::Overdues::UpdateFine( >+ { >+ issue_id => $checkout->issue_id, >+ itemnumber => $item->itemnumber, >+ borrowernumber => $patron->borrowernumber, >+ amount => 1, >+ due => $checkout->date_due, >+ } >+ ); >+ >+ my $fine = Koha::Account::Lines->search( >+ { issue_id => $checkout->issue_id, debit_type_code => 'OVERDUE' }, >+ { order_by => { -desc => 'accountlines_id' } } >+ )->next; >+ >+ ok( $fine, "$label: fine created" ); >+ is( $fine->branchcode, $expected, "$label: branchcode recorded correctly" ); >+ }; >+ >+ $assert_fee_branchcode->( >+ 'OVERDUE', 'PatronLibrary', undef, undef, $lib_patron->branchcode, >+ 'OVERDUE CircControl=PatronLibrary' >+ ); >+ $assert_fee_branchcode->( >+ 'OVERDUE', 'PickupLibrary', undef, undef, $lib_issue->branchcode, >+ 'OVERDUE CircControl=PickupLibrary' >+ ); >+ $assert_fee_branchcode->( >+ 'OVERDUE', 'ItemHomeLibrary', undef, 'homebranch', $lib_home->branchcode, >+ 'OVERDUE ItemHomeLibrary + homebranch' >+ ); >+ $assert_fee_branchcode->( >+ 'OVERDUE', 'ItemHomeLibrary', undef, 'holdingbranch', $lib_hold->branchcode, >+ 'OVERDUE ItemHomeLibrary + holdingbranch' >+ ); >+ >+ }; >+ > # Test WhenLostForgiveFine and WhenLostChargeReplacementFee > t::lib::Mocks::mock_preference( 'WhenLostForgiveFine', '1' ); > t::lib::Mocks::mock_preference( 'WhenLostChargeReplacementFee', '1' ); >@@ -2339,7 +2409,7 @@ subtest "AllowRenewalIfOtherItemsAvailable tests" => sub { > ); > > $item_2->notforloan(0)->store; >- $item_3->delete(); >+ $item_3->notforloan(1)->store; > > # Two items total, one item available, one issued, two holds on record > >-- >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
|
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