4 SELECT evergreen.upgrade_deps_block_check('0823', :eg_version);
6 -- Track the requesting user
7 ALTER TABLE staging.user_stage
8 ADD COLUMN requesting_usr INTEGER
9 REFERENCES actor.usr(id) ON DELETE SET NULL;
11 -- add county column to staged address tables and
12 -- drop state requirement to match actor.usr_address
13 ALTER TABLE staging.mailing_address_stage
14 ADD COLUMN county TEXT,
15 ALTER COLUMN state DROP DEFAULT,
16 ALTER COLUMN state DROP NOT NULL;
18 ALTER TABLE staging.billing_address_stage
19 ADD COLUMN county TEXT,
20 ALTER COLUMN state DROP DEFAULT,
21 ALTER COLUMN state DROP NOT NULL;
23 -- stored procedure for deleting expired pending patrons
24 CREATE OR REPLACE FUNCTION staging.purge_pending_users() RETURNS VOID AS $$
29 FOR org_id IN SELECT DISTINCT(home_ou) FROM staging.user_stage LOOP
31 SELECT INTO intvl value FROM
32 actor.org_unit_ancestor_setting(
33 'opac.pending_user_expire_interval', org_id);
35 CONTINUE WHEN intvl IS NULL OR intvl ILIKE 'null';
37 -- de-JSON-ify the string
38 SELECT INTO intvl TRIM(BOTH '"' FROM intvl);
40 DELETE FROM staging.user_stage
41 WHERE home_ou = org_id AND row_date + intvl::INTERVAL < NOW();
48 INSERT INTO config.org_unit_setting_type
49 (name, grp, datatype, label, description)
51 'opac.allow_pending_user',
55 'opac.allow_pending_user',
56 'Allow Patron Self-Registration',
61 'opac.allow_pending_user',
62 'Allow patrons to self-register, creating pending user accounts',
67 'opac.pending_user_expire_interval',
71 'opac.pending_user_expire_interval',
72 'Patron Self-Reg. Expire Interval',
77 'opac.pending_user_expire_interval',
78 'If set, this is the amount of time a pending user account will ' ||
79 'be allowed to sit in the database. After this time, the pending ' ||
80 'user information will be purged',
85 'ui.patron.edit.aua.county.show',
89 'ui.patron.edit.aua.county.require',
90 'Show county field on patron registration',
95 'ui.patron.edit.aua.county.require',
96 'The county field will be shown on the patron registration screen',