--- /dev/null
+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;