fixing billing calls
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 Sep 2006 18:44:33 +0000 (18:44 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Mon, 11 Sep 2006 18:44:33 +0000 (18:44 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@6066 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm

index bcfe8fa..428ba12 100644 (file)
@@ -1679,28 +1679,36 @@ sub _checked_out {
                        my $due_dt = $parser->parse_datetime( clense_ISO8601( $c->due_date ) );
                        my $due = $due_dt->epoch;
                        if ($due < DateTime->today->epoch) {
                        my $due_dt = $parser->parse_datetime( clense_ISO8601( $c->due_date ) );
                        my $due = $due_dt->epoch;
                        if ($due < DateTime->today->epoch) {
-                               push @overdue, $c->id;
+                               push @overdue, $c;
                        } else {
                        } else {
-                               push @out, $c->id;
+                               push @out, $c;
                        }
                } else {
                        }
                } else {
-                       push @out, $c->id;
+                       push @out, $c;
                }
        }
 
                }
        }
 
-       my( @lost, @cr, @lo );
-       for my $c (@$open) {
+       my( @open, @od, @lost, @cr, @lo );
+
+       while (my $c = shift(@out)) {
+               push( @open, $c->id ) if (!$c->stop_fines || $c->stop_fines eq 'MAXFINES' || $c->stop_fines eq 'RENEW');
                push( @lost, $c->id ) if $c->stop_fines eq 'LOST';
                push( @cr, $c->id ) if $c->stop_fines eq 'CLAIMSRETURNED';
                push( @lo, $c->id ) if $c->stop_fines eq 'LONGOVERDUE';
        }
 
                push( @lost, $c->id ) if $c->stop_fines eq 'LOST';
                push( @cr, $c->id ) if $c->stop_fines eq 'CLAIMSRETURNED';
                push( @lo, $c->id ) if $c->stop_fines eq 'LONGOVERDUE';
        }
 
+       while (my $c = shift(@overdue)) {
+               push( @od, $c->id ) if (!$c->stop_fines || $c->stop_fines eq 'MAXFINES' || $c->stop_fines eq 'RENEW');
+               push( @lost, $c->id ) if $c->stop_fines eq 'LOST';
+               push( @cr, $c->id ) if $c->stop_fines eq 'CLAIMSRETURNED';
+               push( @lo, $c->id ) if $c->stop_fines eq 'LONGOVERDUE';
+       }
 
        if( $iscount ) {
                return {
 
        if( $iscount ) {
                return {
-                       total           => @$circs + @lost + @cr + @lo,
-                       out             => scalar(@out),
-                       overdue => scalar(@overdue),
+                       total           => @open + @od + @lost + @cr + @lo,
+                       out             => scalar(@open),
+                       overdue => scalar(@od),
                        lost            => scalar(@lost),
                        claims_returned => scalar(@cr),
                        long_overdue            => scalar(@lo)
                        lost            => scalar(@lost),
                        claims_returned => scalar(@cr),
                        long_overdue            => scalar(@lo)
@@ -1708,8 +1716,8 @@ sub _checked_out {
        }
 
        return {
        }
 
        return {
-               out             => \@out,
-               overdue => \@overdue,
+               out             => \@open,
+               overdue => \@od,
                lost            => \@lost,
                claims_returned => \@cr,
                long_overdue            => \@lo
                lost            => \@lost,
                claims_returned => \@cr,
                long_overdue            => \@lo