From: erickson Date: Mon, 31 Jul 2006 22:00:10 +0000 (+0000) Subject: broke the checked-out method out into checked-out and checked-in-with-fines X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=44a44bcdeca2e372b8fbb3a39eac306542b0cf4a;p=evergreen%2Fpines.git broke the checked-out method out into checked-out and checked-in-with-fines git-svn-id: svn://svn.open-ils.org/ILS/trunk@5203 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm index 666649870a..794816504d 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Actor.pm @@ -1763,8 +1763,21 @@ sub _checked_out { } # grab all of the lost, claims-returned, and longoverdue circs + #my $open = $e->search_action_circulation( + # {usr => $userid, stop_fines => { '!=' => undef }, xact_finish => undef }); + + + # these items have stop_fines, but no xact_finish, so money + # is owed on them and they have not been checked in my $open = $e->search_action_circulation( - {usr => $userid, stop_fines => { '!=' => undef }, xact_finish => undef }); + { + usr => $userid, + stop_fines => { '!=' => undef }, + xact_finish => undef, + checkin_time => undef, + } + ); + my( @lost, @cr, @lo ); for my $c (@$open) { @@ -1796,6 +1809,52 @@ sub _checked_out { +__PACKAGE__->register_method( + method => "checked_in_with_fines", + api_name => "open-ils.actor.user.checked_in_with_fines", + argc => 2, + signature => q/@see open-ils.actor.user.checked_out/ +); +sub checked_in_with_fines { + my( $self, $conn, $auth, $userid ) = @_; + + my $e = new_editor(authtoken=>$auth); + return $e->event unless $e->checkauth; + + if( $userid ne $e->requestor->id ) { + return $e->event unless $e->allowed('VIEW_CIRCULATIONS'); + } + + # money is owed on these items and they are checked in + my $open = $e->search_action_circulation( + { + usr => $userid, + xact_finish => undef, + checkin_time => { "!=" => undef }, + } + ); + + + 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'; + } + + return { + lost => \@lost, + claims_returned => \@cr, + long_overdue => \@lo + }; +} + + + + + + + __PACKAGE__->register_method(