JBAS-406 repair BC patron items out API call
authorBill Erickson <berickxx@gmail.com>
Thu, 8 Jan 2015 21:06:41 +0000 (13:06 -0800)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
The API now includes circulations which have a stop_fines values of
MAXFINES or LONGOVERDUE, consistent with other items-out API queries.

API also updated to use open-ils.cstore instead of storage for
efficiency.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Conflicts:
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm

Open-ILS/src/perlmods/lib/OpenILS/Application/Circ.pm

index 6f415eb..6c46178 100644 (file)
@@ -203,25 +203,27 @@ __PACKAGE__->register_method(
 sub checkouts_by_user_opac {
     my( $self, $client, $auth, $user_id ) = @_;
 
-    my $e = new_editor( authtoken => $auth );
+    my $e = new_editor(authtoken => $auth);
     return $e->event unless $e->checkauth;
     $user_id ||= $e->requestor->id;
     return $e->event unless 
         my $patron = $e->retrieve_actor_user($user_id);
 
-    my $data;
-    my $search = {usr => $user_id, stop_fines => undef};
-
-    if( $user_id ne $e->requestor->id ) {
-        $data = $e->search_action_circulation(
-            $search, {checkperm=>1, permorg=>$patron->home_ou})
-            or return $e->event;
-
-    } else {
-        $data = $e->search_action_circulation($search);
+    if ($user_id ne $e->requestor->id) {
+        return $e->event unless 
+            $e->allowed('VIEW_CIRCULATIONS', $patron->home_ou);
     }
 
-    return $data;
+    my $search = {
+        usr => $user_id, 
+        checkin_time => undef,
+        '-or' => [
+            {stop_fines => undef},
+            {stop_fines => ['MAXFINES','LONGOVERDUE']}
+        ]
+    };
+
+    return $e->search_action_circulation($search);
 }