Bugzilla – Attachment 80874 Details for
Bug 21607
Koha::Account::Line->apply should store credit offsets as negative amounts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21607: Make Koha::Account::Line->apply store credits as negative amounts
Bug-21607-Make-KohaAccountLine-apply-store-credits.patch (text/plain), 2.74 KB, created by
Michal Denar
on 2018-10-18 18:42:27 UTC
(
hide
)
Description:
Bug 21607: Make Koha::Account::Line->apply store credits as negative amounts
Filename:
MIME Type:
Creator:
Michal Denar
Created:
2018-10-18 18:42:27 UTC
Size:
2.74 KB
patch
obsolete
>From f83580e67c5af76baeffc25e2b432bba49cb858c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 18 Oct 2018 11:39:37 -0300 >Subject: [PATCH] Bug 21607: Make Koha::Account::Line->apply store credits as > negative amounts > >This is a trivial patch, that makes offsets have 'amount' stored as >negative values for applied credits. > >The behaviour is changed on the tests and adjusted in the code. To test: >- Run > $ kshell > k$ prove t/db_dependent/Koha/Account/Lines.t >=> SUCCESS: Tests pass! >- Sign off :-D > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Michal Denar <black23@gmail.com> >--- > Koha/Account/Line.pm | 2 +- > t/db_dependent/Koha/Account/Lines.t | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index 9cf8867bce..3573e604e6 100644 >--- a/Koha/Account/Line.pm >+++ b/Koha/Account/Line.pm >@@ -190,7 +190,7 @@ sub apply { > Koha::Account::Offset->new( > { credit_id => $self->id, > debit_id => $debit->id, >- amount => $amount_to_cancel, >+ amount => $amount_to_cancel * -1, > type => $offset_type, > } > )->store(); >diff --git a/t/db_dependent/Koha/Account/Lines.t b/t/db_dependent/Koha/Account/Lines.t >index 20033e70b6..eb8dfdd1c0 100755 >--- a/t/db_dependent/Koha/Account/Lines.t >+++ b/t/db_dependent/Koha/Account/Lines.t >@@ -202,7 +202,7 @@ subtest 'apply() tests' => sub { > my $offsets = Koha::Account::Offsets->search( { credit_id => $credit->id, debit_id => $debit_1->id } ); > is( $offsets->count, 1, 'Only one offset is generated' ); > my $THE_offset = $offsets->next; >- is( $THE_offset->amount * 1, 10, 'Amount was calculated correctly (less than the available credit)' ); >+ is( $THE_offset->amount * 1, -10, 'Amount was calculated correctly (less than the available credit)' ); > is( $THE_offset->type, 'Manual Credit', 'Passed type stored correctly' ); > > $debits = Koha::Account::Lines->search({ accountlines_id => $debit_2->id }); >@@ -216,7 +216,7 @@ subtest 'apply() tests' => sub { > $offsets = Koha::Account::Offsets->search( { credit_id => $credit->id, debit_id => $debit_2->id } ); > is( $offsets->count, 1, 'Only one offset is generated' ); > $THE_offset = $offsets->next; >- is( $THE_offset->amount * 1, 90, 'Amount was calculated correctly (less than the available credit)' ); >+ is( $THE_offset->amount * 1, -90, 'Amount was calculated correctly (less than the available credit)' ); > is( $THE_offset->type, 'Credit Applied', 'Defaults to \'Credit Applied\' offset type' ); > > $debits = Koha::Account::Lines->search({ accountlines_id => $debit_1->id }); >-- >2.11.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 21607
:
80858
|
80874
|
80938
|
80948