[Koha-patches] [PATCH] Fix for Bug 2601 - Order fines by date and time

Owen Leonard oleonard at myacpl.org
Thu Oct 13 21:51:34 CEST 2011


When a fine is paid off the modification of the original
account line containing the fine gets its amount zeroed out
and a line is added saying "Payment,thanks." Both these
transactions happen at virtually the same time, so they
cannot be ordered one after the other based on the
timestamp.

This patch adds a one second delay bewteen the two steps,
and outputs the timestamp rather than the date of each
transaction so that it is unambiguous when each one
happened.

NOTE: This fix will only fix the sorting of future
transactions.
---
 C4/Accounts.pm                                     |    1 +
 .../prog/en/modules/members/boraccount.tt          |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/C4/Accounts.pm b/C4/Accounts.pm
index 2352e9e..b8b09a7 100644
--- a/C4/Accounts.pm
+++ b/C4/Accounts.pm
@@ -205,6 +205,7 @@ sub makepayment {
                     INTO accountlines (borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding)
                     VALUES ( ?, ?, now(), ?, 'Payment,thanks', 'Pay', 0)"
             );
+        sleep 1;
         $ins->execute($borrowernumber, $nextaccntno, $payment);
         $ins->finish;
     }
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
index c5941fd..9e46844 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/boraccount.tt
@@ -43,7 +43,7 @@
   [% FOREACH account IN accounts %]
 
    [% IF ( loop.odd ) %]<tr>[% ELSE %]<tr class="highlight">[% END %]
-      <td>[% account.date %]</td>
+      <td>[% account.timestamp %]</td>
       <td>[% account.description %]&nbsp;[% IF ( account.itemnumber ) %]<a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% account.biblionumber %]&amp;itemnumber=[% account.itemnumber %]">View item</a>&nbsp;[% END %][% account.title |html %]</td>
       <td>[% account.note %]</td>
       [% IF ( account.amountcredit ) %]<td class="credit">[% ELSE %]<td class="debit">[% END %][% account.amount %]</td>
-- 
1.7.3



More information about the Koha-patches mailing list