From 6508309077c697b28d6a0aaf55eceaac0e667ef8 Mon Sep 17 00:00:00 2001 From: miker Date: Mon, 11 Sep 2006 18:18:03 +0000 Subject: [PATCH] new checked_out git-svn-id: svn://svn.open-ils.org/ILS/trunk@6065 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/perlmods/OpenILS/Application/Actor.pm | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index 637eea425b..bcfe8fa949 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -1667,6 +1667,59 @@ sub checked_out { sub _checked_out { my( $iscount, $e, $userid ) = @_; + my $circs = $e->search_action_circulation( + { usr => $userid, checkin_time => undef }); + + my $parser = DateTime::Format::ISO8601->new; + + # split the circs up into overdue and not-overdue circs + my (@out,@overdue); + for my $c (@$circs) { + if( $c->due_date ) { + 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; + } else { + push @out, $c->id; + } + } else { + push @out, $c->id; + } + } + + my( @lost, @cr, @lo ); + for my $c (@$open) { + 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 { + total => @$circs + @lost + @cr + @lo, + out => scalar(@out), + overdue => scalar(@overdue), + lost => scalar(@lost), + claims_returned => scalar(@cr), + long_overdue => scalar(@lo) + }; + } + + return { + out => \@out, + overdue => \@overdue, + lost => \@lost, + claims_returned => \@cr, + long_overdue => \@lo + }; +} + + +sub _checked_out_WHAT { + my( $iscount, $e, $userid ) = @_; + my $circs = $e->search_action_circulation( { usr => $userid, stop_fines => undef }); -- 2.43.2