Bugzilla – Attachment 193140 Details for
Bug 40445
Point of Sale reconciliation input during daily summaries
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40445: (follow-up) Set payment_type for CASHUP_SURPLUS and CASHUP_DEFICIT accountlines
edb1441.patch (text/plain), 5.25 KB, created by
Martin Renvoize (ashimema)
on 2026-02-13 17:21:46 UTC
(
hide
)
Description:
Bug 40445: (follow-up) Set payment_type for CASHUP_SURPLUS and CASHUP_DEFICIT accountlines
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-13 17:21:46 UTC
Size:
5.25 KB
patch
obsolete
>From edb1441d88fc7ae6adb6863ffd54bac964d8913a Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Fri, 13 Feb 2026 17:13:02 +0000 >Subject: [PATCH] Bug 40445: (follow-up) Set payment_type for CASHUP_SURPLUS > and CASHUP_DEFICIT accountlines > >When creating CASHUP_SURPLUS and CASHUP_DEFICIT accountlines during >cashup reconciliation, the payment_type was not being set. This >resulted in accountlines with NULL payment_type values, which should >be 'CASH' to properly indicate these are cash-related transactions. > >This patch: >- Sets payment_type to 'CASH' for both CASHUP_SURPLUS and CASHUP_DEFICIT > accountlines created during the reconciliation process >- Adds test coverage to verify payment_type is correctly set >- Adds preference mocking to prevent test failures in subtests that > don't specifically test reconciliation note requirements > >All required fields are now properly set for reconciliation accountlines: >- payment_type (CASH) >- manager_id >- branchcode (from earlier follow-up) >- register_id > >Test plan: >1. Apply patch >2. Run prove t/db_dependent/Koha/Cash/Register.t >3. Verify all tests pass, including new payment_type checks >4. In the staff interface, perform a cashup with a surplus or deficit >5. Verify the created CASHUP_SURPLUS or CASHUP_DEFICIT accountline has > payment_type set to 'CASH' > >Signed-off-by: Jackie Usher <jackie.usher@westsussex.gov.uk> >--- > Koha/Cash/Register.pm | 2 ++ > t/db_dependent/Koha/Cash/Register.t | 16 ++++++++++++---- > 2 files changed, 14 insertions(+), 4 deletions(-) > >diff --git a/Koha/Cash/Register.pm b/Koha/Cash/Register.pm >index 1a02f23aa9b..db37537196a 100644 >--- a/Koha/Cash/Register.pm >+++ b/Koha/Cash/Register.pm >@@ -455,6 +455,7 @@ sub add_cashup { > interface => 'intranet', > branchcode => $self->branch, > register_id => $self->id, >+ payment_type => 'CASH', > note => $reconciliation_note > } > )->store(); >@@ -480,6 +481,7 @@ sub add_cashup { > interface => 'intranet', > branchcode => $self->branch, > register_id => $self->id, >+ payment_type => 'CASH', > note => $reconciliation_note > } > )->store(); >diff --git a/t/db_dependent/Koha/Cash/Register.t b/t/db_dependent/Koha/Cash/Register.t >index 1cb83f7e3f3..43c23a682a2 100755 >--- a/t/db_dependent/Koha/Cash/Register.t >+++ b/t/db_dependent/Koha/Cash/Register.t >@@ -174,6 +174,9 @@ subtest 'cashup' => sub { > > $schema->storage->txn_begin; > >+ # Ensure reconciliation notes are not required for these tests >+ t::lib::Mocks::mock_preference( 'CashupReconciliationNoteRequired', 0 ); >+ > my $register = $builder->build_object( { class => 'Koha::Cash::Registers' } ); > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > >@@ -343,6 +346,9 @@ subtest 'cashup_reconciliation' => sub { > > $schema->storage->txn_begin; > >+ # Ensure reconciliation notes are not required for these tests >+ t::lib::Mocks::mock_preference( 'CashupReconciliationNoteRequired', 0 ); >+ > my $register = $builder->build_object( { class => 'Koha::Cash::Registers' } ); > my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > >@@ -417,7 +423,7 @@ subtest 'cashup_reconciliation' => sub { > }; > > subtest 'surplus_cashup' => sub { >- plan tests => 8; >+ plan tests => 9; > > $schema->storage->txn_begin; > >@@ -466,7 +472,8 @@ subtest 'cashup_reconciliation' => sub { > sprintf( '%.0f', $surplus_line->amount ), sprintf( '%.0f', -$surplus ), > 'Surplus amount is correct (negative for credit)' > ); >- is( $surplus_line->branchcode, $register2->branch, 'Surplus branchcode matches register branch' ); >+ is( $surplus_line->branchcode, $register2->branch, 'Surplus branchcode matches register branch' ); >+ is( $surplus_line->payment_type, 'CASH', 'Surplus payment_type is set to CASH' ); > > # Note should be undef for surplus without user note > is( $surplus_line->note, undef, 'No note for surplus without user reconciliation note' ); >@@ -515,7 +522,7 @@ subtest 'cashup_reconciliation' => sub { > }; > > subtest 'deficit_cashup' => sub { >- plan tests => 8; >+ plan tests => 9; > > $schema->storage->txn_begin; > >@@ -564,7 +571,8 @@ subtest 'cashup_reconciliation' => sub { > sprintf( '%.0f', $deficit_line->amount ), sprintf( '%.0f', $deficit ), > 'Deficit amount is correct (positive for debit)' > ); >- is( $deficit_line->branchcode, $register3->branch, 'Deficit branchcode matches register branch' ); >+ is( $deficit_line->branchcode, $register3->branch, 'Deficit branchcode matches register branch' ); >+ is( $deficit_line->payment_type, 'CASH', 'Deficit payment_type is set to CASH' ); > > # Note should be undef for deficit without user note > is( $deficit_line->note, undef, 'No note for deficit without user reconciliation note' ); >-- >2.53.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 40445
:
185289
|
185290
|
185291
|
185292
|
185809
|
186636
|
186637
|
186638
|
186639
|
186640
|
186641
|
186642
|
186643
|
189333
|
189334
|
189335
|
189336
|
189337
|
189338
|
189339
|
189340
|
189341
|
189353
|
189354
|
189355
|
189356
|
189357
|
189358
|
189359
|
189360
|
189361
|
189362
|
189363
|
189364
|
189410
|
189411
|
189412
|
189413
|
189414
|
189415
|
189420
|
189421
|
189422
|
189423
|
189424
|
189425
|
189426
|
189427
|
189428
|
189429
|
189430
|
189476
|
189477
|
189478
|
189479
|
189480
|
189481
|
189482
|
190361
|
190362
|
190363
|
190364
|
190365
|
190366
|
190367
|
190368
|
190369
|
190370
|
190371
|
190372
|
190373
|
190374
|
190375
|
190376
|
190379
|
190380
|
190388
|
190389
|
190404
|
190405
|
190406
|
190407
|
190408
|
190409
|
190410
|
190411
|
190412
|
190413
|
190414
|
190415
|
191273
|
191274
|
191275
|
191276
|
191277
|
191278
|
191279
|
191280
|
191281
|
191282
|
191283
|
191284
|
191285
|
191286
|
191287
|
191288
|
193123
|
193124
|
193125
|
193126
|
193127
|
193128
|
193129
|
193130
|
193131
|
193132
|
193133
|
193134
|
193135
|
193136
|
193137
|
193138
|
193139
|
193140
|
193141
|
193180
|
193181
|
193182
|
193183