From: erickson Date: Wed, 28 Jun 2006 21:19:11 +0000 (+0000) Subject: adding round 1 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=6890859a4ea372ff98217e84fd75fe6b1cdf93fd;p=Evergreen.git adding round 1 git-svn-id: svn://svn.open-ils.org/ILS/trunk@4821 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Collections.pm b/Open-ILS/src/perlmods/OpenILS/Application/Collections.pm new file mode 100644 index 0000000000..3921fd90b0 --- /dev/null +++ b/Open-ILS/src/perlmods/OpenILS/Application/Collections.pm @@ -0,0 +1,82 @@ +package OpenILS::Application::Collections; +use strict; use warnings; +use OpenSRF::EX qw(:try); +use OpenILS::Application::AppUtils; +use OpenSRF::Utils::Logger qw(:logger); +use OpenSRF::Application; +use base 'OpenSRF::Application'; +my $U = "OpenILS::Application::AppUtils"; +use OpenILS::Utils::CStoreEditor qw/:funcs/; +use OpenILS::Event; + + +# -------------------------------------------------------------- +# Loads the config info +# -------------------------------------------------------------- +sub initialize { return 1; } + + +__PACKAGE__->register_method( + method => 'users_of_interest', + api_name => 'open-ils.collections.users_of_interest.retrieve', + signature => q/ + @param age This is the age before which the fine_level was exceeded. + @param fine_level The minimum fine to exceed. + @param location The location at which the fines were created + / +); + +sub users_of_interest { + my( $self, $conn, $auth, $age, $fine_level, $location ) = @_; + + return OpenILS::Event->new('BAD_PARAMS') + unless ($auth and $age and $fine_level and $location); + + my $e = new_editor(authtoken => $auth); + return $e->event unless $e->checkauth; + + my $org = $e->search_actor_org_unit({shortname => $location}) + or return $e->event; $org = $org->[0]; + return $e->event unless $e->allowed('VIEW_USER', $org->id); + + return $U->storagereq( + 'open-ils.storage.money.collections.users_of_interest.atomic', + $age, $fine_level, $location); +} + + +__PACKAGE__->register_method( + method => 'users_with_activity', + api_name => 'open-ils.collections.users_with_activity.retrieve', + signature => q/ + Returns the users that are currently in collections and + had activity during the provided interval. Dates are inclusive. + @param start_date The beginning of the activity interval + @param end_date The end of the activity interval + @param location The location at which the fines were created + / +); + +sub users_with_activity { + my( $self, $conn, $auth, $start_date, $end_date, $location ) = @_; + return OpenILS::Event->new('BAD_PARAMS') + unless ($auth and $start_date and $end_date and $location); + + my $e = new_editor(authtoken => $auth); + return $e->event unless $e->checkauth; + + my $org = $e->search_actor_org_unit({shortname => $location}) + or return $e->event; $org = $org->[0]; + return $e->event unless $e->allowed('VIEW_USER', $org->id); + + return $U->storagereq( + 'open-ils.storage.money.collections.users_with_activity.atomic', + $start_date, $end_date, $location); + +} + + + + + +1;