4 ALTER TABLE actor.usr ADD COLUMN guardian TEXT;
6 CREATE INDEX actor_usr_guardian_idx
7 ON actor.usr (evergreen.lowercase(guardian));
8 CREATE INDEX actor_usr_guardian_unaccent_idx
9 ON actor.usr (evergreen.unaccent_and_squash(guardian));
11 -- Modify auditor tables accordingly.
12 SELECT auditor.update_auditors();
14 -- clear the guardian field on delete
15 CREATE OR REPLACE FUNCTION actor.usr_delete(
20 old_profile actor.usr.profile%type;
21 old_home_ou actor.usr.home_ou%type;
22 new_profile actor.usr.profile%type;
23 new_home_ou actor.usr.home_ou%type;
25 new_dob actor.usr.dob%type;
28 id || '-PURGED-' || now(),
42 -- Quit if no such user
44 IF old_profile IS NULL THEN
48 perform actor.usr_purge_data( src_usr, dest_usr );
50 -- Find the root grp_tree and the root org_unit. This would be simpler if we
51 -- could assume that there is only one root. Theoretically, someday, maybe,
52 -- there could be multiple roots, so we take extra trouble to get the right ones.
59 permission.grp_ancestors( old_profile )
68 actor.org_unit_ancestors( old_home_ou )
72 -- Truncate date of birth
74 IF new_dob IS NOT NULL THEN
75 new_dob := date_trunc( 'year', new_dob );
82 profile = new_profile,
85 passwd = random()::text,
90 FROM config.identification_type
95 net_access_level = DEFAULT,
98 first_given_name = new_name,
100 family_name = new_name,
105 evening_phone = NULL,
107 mailing_address = NULL,
108 billing_address = NULL,
109 home_ou = new_home_ou,
112 master_account = DEFAULT,
113 super_user = DEFAULT,
118 claims_returned_count = DEFAULT,
119 credit_forward_balance = DEFAULT,
120 last_xact_id = DEFAULT,
121 alert_message = NULL,
129 INSERT into config.org_unit_setting_type (name, label, description, datatype)
131 'ui.patron.edit.au.guardian.show',
133 'ui.patron.edit.au.guardian.show',
134 'GUI: Show guardian field on patron registration',
138 'ui.patron.edit.au.guardian.show',
139 'The guardian field will be shown on the patron registration screen. Showing a field makes it appear with required fields even when not required. If the field is required this setting is ignored.',
140 'coust', 'description'
144 'ui.patron.edit.au.guardian.suggest',
146 'ui.patron.edit.au.guardian.suggest',
147 'GUI: Suggest guardian field on patron registration',
151 'ui.patron.edit.au.guardian.suggest',
152 'The guardian field will be suggested on the patron registration screen. Suggesting a field makes it appear when suggested fields are shown. If the field is shown or required this setting is ignored.',
153 'coust', 'description'),
156 'ui.patron.edit.guardian_required_for_juv',
158 'ui.patron.edit.guardian_required_for_juv',
159 'GUI: Juvenile account requires parent/guardian',
163 'ui.patron.edit.guardian_required_for_juv',
164 'Require a value for the parent/guardian field in the patron editor for patrons marked as juvenile',
165 'coust', 'description'),