Bug 21896: (QA follow-up) Document and Test for FIFO behaviour
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 29 Nov 2018 13:49:27 +0000 (13:49 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 10 Dec 2018 09:55:46 +0000 (09:55 +0000)
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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 99535e0fda491d2e1d704dd80f6613c0a7b8d06b)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Koha/Account.pm
Koha/Account/Line.pm
Koha/Schema/Result/Accountline.pm
t/db_dependent/Koha/Account.t

index 80e8353..5630f41 100644 (file)
@@ -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
 
index 3573e60..238029f 100644 (file)
@@ -241,4 +241,12 @@ sub _type {
     return 'Accountline';
 }
 
+=head3 object_class (internal)
+
+=cut
+
+sub object_class {
+    return 'Koha::Account::Line';
+}
+
 1;
index 378c14a..2545995 100644 (file)
@@ -239,6 +239,11 @@ __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;
index f11a2f2..16654f6 100755 (executable)
@@ -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;