Bugzilla – Attachment 168206 Details for
Bug 28664
One should not be able to issue a refund against a VOID accountline
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28664: (follow-up) Throw exception if debt if VOID
Bug-28664-follow-up-Throw-exception-if-debt-if-VOI.patch (text/plain), 2.46 KB, created by
Martin Renvoize (ashimema)
on 2024-06-27 16:23:06 UTC
(
hide
)
Description:
Bug 28664: (follow-up) Throw exception if debt if VOID
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-27 16:23:06 UTC
Size:
2.46 KB
patch
obsolete
>From ac54cf0395e144f79a65ab2b417555f6994fd273 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 27 Jun 2024 16:55:55 +0100 >Subject: [PATCH] Bug 28664: (follow-up) Throw exception if debt if VOID > >This patch adds an exception when an attempt is made to refund against a >VOID debit. > >Test plan >1) Run the included unit test > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Account/Line.pm | 4 ++++ > t/db_dependent/Koha/Account/Line.t | 25 ++++++++++++++++++++++++- > 2 files changed, 28 insertions(+), 1 deletion(-) > >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index 572b16444e5..04b920cd5fe 100644 >--- a/Koha/Account/Line.pm >+++ b/Koha/Account/Line.pm >@@ -497,6 +497,10 @@ sub reduce { > Koha::Exceptions::Account::IsNotDebit->throw( > error => 'Account line ' . $self->id . 'is a payout' ); > } >+ if ( $self->debit_type_code eq 'VOID' ) { >+ Koha::Exceptions::Account::IsNotDebit->throw( >+ error => 'Account line ' . $self->id . 'is void' ); >+ } > > # Check for mandatory parameters > my @mandatory = ( 'interface', 'reduction_type', 'amount' ); >diff --git a/t/db_dependent/Koha/Account/Line.t b/t/db_dependent/Koha/Account/Line.t >index 53e596bc090..426cb021dcc 100755 >--- a/t/db_dependent/Koha/Account/Line.t >+++ b/t/db_dependent/Koha/Account/Line.t >@@ -1071,7 +1071,7 @@ subtest "payout() tests" => sub { > > subtest "reduce() tests" => sub { > >- plan tests => 34; >+ plan tests => 35; > > $schema->storage->txn_begin; > >@@ -1254,6 +1254,29 @@ subtest "reduce() tests" => sub { > 'Koha::Exceptions::Account::IsNotDebit', > '->reduce() cannot be used on a payout debit'; > >+ # Throw exception if attempting to reduce a voided debt >+ my $payment = Koha::Account::Line->new( >+ { >+ borrowernumber => $borrower->borrowernumber, >+ amount => -20, >+ amountoutstanding => -20, >+ interface => 'commandline', >+ credit_type_code => 'CREDIT' >+ } >+ )->store(); >+ my $void = $payment->void( >+ { >+ interface => 'intranet', >+ staff_id => $staff->borrowernumber, >+ branch => $branchcode, >+ } >+ ); >+ throws_ok { >+ $void->reduce($reduce_params); >+ } >+ 'Koha::Exceptions::Account::IsNotDebit', >+ '->reduce() cannot be used on a void debit'; >+ > $schema->storage->txn_rollback; > }; > >-- >2.45.2
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 28664
:
122587
|
127537
|
127548
|
168205
|
168206
|
168228
|
168229