Further support for "circ.collections.exempt" setting
authorBill Erickson <berick@esilibrary.com>
Tue, 18 Oct 2011 20:22:25 +0000 (16:22 -0400)
committerMike Rylander <mrylander@gmail.com>
Tue, 15 Nov 2011 17:11:43 +0000 (12:11 -0500)
Added support for skipping users that have the
"circ.collections.exempt" setting in the API call:

open-ils.collections.users_of_interest.warning_penalty.retrieve

This call is an alternate entry point for finding users to consider
for collections processing

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Collections.pm

index 03b6b68..e5da73c 100644 (file)
@@ -209,14 +209,30 @@ sub users_of_interest_warning_penalty {
     my $start = time;
     my $query = {
         select => {ausp => ['usr']},
-        from => 'ausp',
+        from => {
+            ausp => {
+                au => {
+                    join => {
+                        aus => {
+                            type => 'left',
+                            filter => {name => 'circ.collections.exempt'}
+                        }
+                    }
+                }
+            }
+        },
         where => {
-            standing_penalty => 4, # PATRON_EXCEEDS_COLLECTIONS_WARNING
-            org_unit => [ map {$_->{id}} @$org_ids ],
-            '-or' => [
-                {stop_date => undef},
-                {stop_date => {'>' => 'now'}}
-            ]
+            '+ausp' => {
+                standing_penalty => 4, # PATRON_EXCEEDS_COLLECTIONS_WARNING
+                org_unit => [ map {$_->{id}} @$org_ids ],
+                '-or' => [
+                    {stop_date => undef},
+                    {stop_date => {'>' => 'now'}}
+                ]
+            },
+            # We are only interested in users that do not have the 
+            # circ.collections.exempt setting applied
+            '+aus' => {value => undef}
         }
     };