name => 'max_age',
desc => q/Optional. Maximum age of the penalty application/,
type => q/interval, e.g "90 days"/,
- }
+ }, {
+ name => 'limit',
+ desc => q/Optional. Return a maximum of this many users/,
+ type => q/integer/,
+ }, {
+ name => 'sort',
+ desc => q/Optional. Sort by penalty set_time, asc or desc, defaults to desc/,
+ type => q/string, "asc" or "desc"/,
+ }
],
'return' => {
sub users_of_interest_warning_penalty {
- my( $self, $conn, $auth, $location, $min_age, $max_age ) = @_;
+ my( $self, $conn, $auth, $location, $min_age, $max_age, $limit, $sort ) = @_;
return OpenILS::Event->new('BAD_PARAMS') unless ($auth and $location);
push(@{$query->{where}->{'-and'}}, {set_date => {'>' => $max_set_date}}) if $max_set_date;
push(@{$query->{where}->{'-and'}}, {set_date => {'<' => $min_set_date}}) if $min_set_date;
+ if ($limit) {
+ $query->{limit} = $limit;
+ my $sort_order = $sort || "DESC";
+ $query->{order_by} = [
+ {class => 'ausp', field => 'set_date', direction => $sort_order}
+ ];
+ }
+
my $req = $ses->request('open-ils.cstore.json_query', $query);
# let the client know we're still here