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
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
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)
'bool'
);
+INSERT INTO config.usr_setting_type
+( name, opac_visible, label, description, datatype) VALUES
+( 'circ.collections.exempt',
+ FALSE,
+ oils_i18n_gettext('circ.collections.exempt', 'Collections: Exempt', 'cust', 'description'),
+ oils_i18n_gettext('circ.collections.exempt', 'User is exempt from collections tracking/processing', 'cust', 'description'),
+ 'bool'
+);
--- /dev/null
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('XXX');
+
+INSERT INTO config.usr_setting_type
+( name, opac_visible, label, description, datatype) VALUES
+( 'circ.collections.exempt',
+ FALSE,
+ oils_i18n_gettext('circ.collections.exempt', 'Collections: Exempt', 'cust', 'description'),
+ oils_i18n_gettext('circ.collections.exempt', 'User is exempt from collections tracking/processing', 'cust', 'description'),
+ 'bool'
+);
+
+COMMIT;
+