be a little more strict on grace period; add support for restricting to short fine_in...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 3 Jun 2009 02:18:29 +0000 (02:18 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 3 Jun 2009 02:18:29 +0000 (02:18 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13296 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/action.pm

index 939a0bd..f2c1ecf 100644 (file)
@@ -93,10 +93,11 @@ __PACKAGE__->register_method(
 
 sub overdue_circs {
        my $grace = shift;
+    my $upper_interval = shift || '1 millennium';
 
        my $c_t = action::circulation->table;
 
-       if ($grace) {
+       if ($grace && $grace =~ /^\d+$/o) {
        $grace = " - ($grace * (fine_interval))";
     } else {
         $grace = '';
@@ -107,10 +108,11 @@ sub overdue_circs {
                  FROM  $c_t
                  WHERE stop_fines IS NULL
                        AND due_date < ( CURRENT_TIMESTAMP $grace)
+            AND fine_interval < ?::INTERVAL
        SQL
 
        my $sth = action::circulation->db_Main->prepare_cached($sql);
-       $sth->execute;
+       $sth->execute($upper_interval);
 
        return ( map { action::circulation->construct($_) } $sth->fetchall_hash );