[open-ils-commits] [GIT] Evergreen ILS branch rel_2_0 updated. 5254cca76d8341491d2d8cfe91659f85a6f4fba9

Evergreen Git git at git.evergreen-ils.org
Sat Sep 3 12:51:11 EDT 2011


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, rel_2_0 has been updated
       via  5254cca76d8341491d2d8cfe91659f85a6f4fba9 (commit)
      from  11f4d6a2b4c49124bbf159a3094732623564ae7f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5254cca76d8341491d2d8cfe91659f85a6f4fba9
Author: Dan Wells <dbw2 at calvin.edu>
Date:   Thu Sep 1 09:13:47 2011 -0400

    Hourly fine periods do not charge enough
    
    Hourly fine periods are not charging for the first period of
    overdue-ness. If an item is due at 2:00pm and has a fine of
    $.50 per hour, the first fine should be eligible for generation
    at 2:01pm. As it stands, the first fine does not generate until
    an entire fine period has elapsed, so in this case, 3:00pm.
    
    The previous version of the code had a special case for day-
    granular fine periods, so a majority of fines were not affected.
    This commit expands the same idea (charging for the fine period
    you are currently "in") to all fine periods.
    
    Signed-off-by: Dan Wells <dbw2 at calvin.edu>
    Signed-off-by: Mike Rylander <mrylander at gmail.com>

diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
index 102a6f3..bb01e61 100644
--- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
+++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm
@@ -9,6 +9,7 @@ use OpenILS::Utils::PermitHold;
 use DateTime;
 use DateTime::Format::ISO8601;
 use OpenILS::Utils::Penalty;
+use POSIX qw(ceil);
 
 sub isTrue {
 	my $v = shift;
@@ -915,10 +916,8 @@ sub generate_fines {
 			}
 
             next if ($last_fine > $now);
-            my $pending_fine_count = int( ($now - $last_fine) / $fine_interval ); 
-
-            # Generate fines for the interval we are currently inside, when the fine interval is some multiple of 1d
-            $pending_fine_count++ if ($fine_interval && ($fine_interval % 86400 == 0));
+            # Generate fines for each past interval, including the one we are inside
+            my $pending_fine_count = ceil( ($now - $last_fine) / $fine_interval );
 
             if ( $last_fine == $due                         # we have no fines yet
                  && $grace                                  # and we have a grace period

-----------------------------------------------------------------------

Summary of changes:
 .../Application/Storage/Publisher/action.pm        |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list