rough draft if sql support for allowing staff to excempt patrons from collections
[evergreen-equinox.git] / Open-ILS / src / perlmods / lib / OpenILS / Application / Storage / Publisher / money.pm
index 22ab1f3..050ded1 100644 (file)
@@ -144,6 +144,9 @@ select
                 and x.circ_lib in (XX)
                 and b.billing_ts < current_timestamp - ? * '1 day'::interval
                 and not b.voided
+                and not exists (
+                    select set.id from actor.usr_setting set where set.usr = x.usr and set.name='circ.collections.exempt' and set.value = 'true'
+                )
           group by 1,2
 
                   union all
@@ -161,6 +164,9 @@ select
                 and x.billing_location in (XX)
                 and b.billing_ts < current_timestamp - ? * '1 day'::interval
                 and not b.voided
+                and not exists (
+                    select set.id from actor.usr_setting set where set.usr = x.usr and set.name='circ.collections.exempt' and set.value = 'true'
+                )
           group by 1,2
 
                   union all
@@ -178,6 +184,9 @@ select
                 and x.pickup_lib in (XX)
                 and b.billing_ts < current_timestamp - ? * '1 day'::interval
                 and not b.voided
+                and not exists (
+                    select set.id from actor.usr_setting set where set.usr = x.usr and set.name='circ.collections.exempt' and set.value = 'true'
+                )
           group by 1,2
         ) full_list
         left join money.payment p on (full_list.id = p.xact)