From: Bill Erickson Date: Wed, 2 Nov 2011 19:45:06 +0000 (-0400) Subject: TPac; sort items out list by due date, oldest first X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=920145f106003170406543e94ee4e42c32bd70f5;p=contrib%2FConifer.git TPac; sort items out list by due date, oldest first Sort items most in need of return (i.e. oldest due date) to top. This is done by replacing the call to "open-ils.actor.user.checked_out", which does a lot more than we need, in a way that does not support sorting/paging, with a simple json_query. Signed-off-by: Bill Erickson Signed-off-by: Lebbeous Fogle-Weekley --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index c84bed415d..f14a200b7f 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -767,18 +767,27 @@ sub fetch_user_circs { } else { - my $circ_data = $U->simplereq( - 'open-ils.actor', - 'open-ils.actor.user.checked_out', - $e->authtoken, - $e->requestor->id - ); + my $query = { + select => {circ => ['id']}, + from => 'circ', + where => { + '+circ' => { + usr => $e->requestor->id, + checkin_time => undef, + '-or' => [ + {stop_fines => undef}, + {stop_fines => {'not in' => ['LOST','CLAIMSRETURNED','LONGOVERDUE']}} + ], + } + }, + order_by => {circ => ['due_date']} + }; - @circ_ids = ( @{$circ_data->{overdue}}, @{$circ_data->{out}} ); + $query->{limit} = $limit if $limit; + $query->{offset} = $offset if $offset; - if($limit or $offset) { - @circ_ids = grep { defined $_ } @circ_ids[0..($offset + $limit - 1)]; - } + my $ids = $e->json_query($query); + @circ_ids = map {$_->{id}} @$ids; } return [] unless @circ_ids;