Bugzilla – Attachment 82738 Details for
Bug 21896
Add Koha::Account::reconcile_balance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21896: (QA follow-up) Document and Test for FIFO behaviour
Bug-21896-QA-follow-up-Document-and-Test-for-FIFO-.patch (text/plain), 3.88 KB, created by
Martin Renvoize (ashimema)
on 2018-11-29 13:51:33 UTC
(
hide
)
Description:
Bug 21896: (QA follow-up) Document and Test for FIFO behaviour
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2018-11-29 13:51:33 UTC
Size:
3.88 KB
patch
obsolete
>From 850313c145ee0f8e3509f77d3a3a914bfd8ec29c Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 29 Nov 2018 13:49:27 +0000 >Subject: [PATCH] Bug 21896: (QA follow-up) Document and Test for FIFO > behaviour > >A short dicussion lead to the decision to make it explictly clear that >this method will implicitly apply credits against debits in a 'First In >First Out' manor, meaning oldest outstanding debits will be paid off >first. > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > Koha/Account.pm | 4 +++- > Koha/Account/Line.pm | 8 ++++++++ > Koha/Schema/Result/Accountline.pm | 8 +++++++- > t/db_dependent/Koha/Account.t | 8 +++++--- > 4 files changed, 23 insertions(+), 5 deletions(-) > >diff --git a/Koha/Account.pm b/Koha/Account.pm >index 80e8353368..5630f4130e 100644 >--- a/Koha/Account.pm >+++ b/Koha/Account.pm >@@ -519,7 +519,9 @@ sub lines { > > $account->reconcile_balance(); > >-Find outstanding credits and use them to pay outstanding debits >+Find outstanding credits and use them to pay outstanding debits. >+Currently, this implicitly uses the 'First In First Out' rule for >+applying credits against debits. > > =cut > >diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm >index 3573e604e6..238029fe8f 100644 >--- a/Koha/Account/Line.pm >+++ b/Koha/Account/Line.pm >@@ -241,4 +241,12 @@ sub _type { > return 'Accountline'; > } > >+=head3 object_class (internal) >+ >+=cut >+ >+sub object_class { >+ return 'Koha::Account::Line'; >+} >+ > 1; >diff --git a/Koha/Schema/Result/Accountline.pm b/Koha/Schema/Result/Accountline.pm >index 378c14a08e..fd2e03dfee 100644 >--- a/Koha/Schema/Result/Accountline.pm >+++ b/Koha/Schema/Result/Accountline.pm >@@ -238,7 +238,13 @@ __PACKAGE__->belongs_to( > > # Created by DBIx::Class::Schema::Loader v0.07042 @ 2018-05-16 17:00:24 > # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:pygYYKxFDRLX97PyeUeLvg >+# > >+sub koha_objects_class { >+ 'Koha::Account::Lines'; >+} >+sub koha_object_class { >+ 'Koha::Account::Line'; >+} > >-# You can replace this text with custom content, and it will be preserved on regeneration > 1; >diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t >index 39c0664f27..af81946293 100755 >--- a/t/db_dependent/Koha/Account.t >+++ b/t/db_dependent/Koha/Account.t >@@ -269,7 +269,7 @@ subtest 'reconcile_balance' => sub { > $schema->storage->txn_rollback; > }; > >- subtest 'same debit than credit' => sub { >+ subtest 'same debit as credit' => sub { > > plan tests => 6; > >@@ -309,7 +309,7 @@ subtest 'reconcile_balance' => sub { > > subtest 'more debit than credit' => sub { > >- plan tests => 6; >+ plan tests => 7; > > $schema->storage->txn_begin; > >@@ -327,7 +327,7 @@ subtest 'reconcile_balance' => sub { > Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 2, amountoutstanding => 2 })->store; > Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 3, amountoutstanding => 3 })->store; > Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 4, amountoutstanding => 4 })->store; >- Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 5, amountoutstanding => 5 })->store; >+ my $line5 = Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 5, amountoutstanding => 5 })->store; > > # Paid Off > Koha::Account::Line->new({ borrowernumber => $patron->id, amount => 1, amountoutstanding => 0 })->store; >@@ -343,6 +343,8 @@ subtest 'reconcile_balance' => sub { > is( $account->outstanding_debits->total_outstanding, 5, 'Outstanding debits sum 5' ); > is( $account->outstanding_credits->total_outstanding, 0, 'Outstanding credits sum 0' ); > >+ is( $line5->get_from_storage->amountoutstanding, '5.000000', 'First In First Out method of payment selection used'); >+ > $schema->storage->txn_rollback; > }; > }; >-- >2.19.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 21896
:
82684
|
82685
|
82688
|
82689
|
82690
|
82691
|
82692
|
82701
|
82702
|
82703
|
82720
|
82721
|
82722
|
82735
|
82736
|
82737
|
82738
|
82739
|
82740
|
82742
|
82811
|
82812
|
82813
|
82814
|
82815
|
82820