removing spine label printing feature
authorChris Sharp <csharp@georgialibraries.org>
Tue, 15 Jan 2019 16:58:04 +0000 (11:58 -0500)
committerChris Sharp <csharp@georgialibraries.org>
Tue, 15 Jan 2019 16:58:04 +0000 (11:58 -0500)
Open-ILS/src/sql/Pg/version-upgrade/pines-post-3.2-upgrade.sql

index b0dcb59..af528bb 100644 (file)
@@ -1,5 +1,7 @@
 BEGIN;
 
+-- parent/guardian field
+
 ALTER TABLE actor.usr ADD COLUMN guardian TEXT;
 
 CREATE INDEX actor_usr_guardian_idx 
@@ -144,8 +146,6 @@ VALUES (
     oils_i18n_gettext(
         'ui.patron.edit.au.guardian.suggest', 
         'GUI: Suggest guardian field on patron registration', 
-        'coust', 'label'
-    ),
     oils_i18n_gettext(
         'ui.patron.edit.au.guardian.suggest', 
         '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.', 
@@ -165,102 +165,6 @@ VALUES (
     'bool'
 );
 
-
-
---SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
-
-UPDATE config.org_unit_setting_type
-SET label = oils_i18n_gettext(
-         'webstaff.cat.label.left_label.left_margin'
-        ,'Item Print Label - Left Margin for Spine Label'
-        ,'coust'
-        ,'label'
-    ),
-     description = oils_i18n_gettext(
-         'webstaff.cat.label.left_label.left_margin'
-        ,'Set the default left margin for the item print Spine Label. Please include a unit of measurement that is valid CSS. For example, "1in" or "2.5cm"'
-        ,'coust'
-        ,'description'
-    )
-WHERE NAME = 'webstaff.cat.label.left_label.left_margin';
-
-UPDATE config.org_unit_setting_type
-SET label = oils_i18n_gettext(
-         'webstaff.cat.label.right_label.left_margin'
-        ,'Item Print Label - Left Margin for Pocket Label'
-        ,'coust'
-        ,'label'
-    ),
-     description = oils_i18n_gettext(
-         'webstaff.cat.label.right_label.left_margin'
-        ,'Set the default left margin for the item print Pocket Label (or in other words, the desired space between the two labels). Please include a unit of measurement that is valid CSS. For example, "1in" or "2.5cm"'
-        ,'coust'
-        ,'description'
-    )
-WHERE NAME = 'webstaff.cat.label.right_label.left_margin';
-
-
-UPDATE config.org_unit_setting_type
-SET label = oils_i18n_gettext(
-         'webstaff.cat.label.left_label.height'
-        ,'Item Print Label - Height for Spine Label'
-        ,'coust'
-        ,'label'
-    ),
-     description = oils_i18n_gettext(
-         'webstaff.cat.label.left_label.height'
-        ,'Set the default height for the item print Spine Label. Please include a unit of measurement that is valid CSS. For example, "1in" or "2.5cm"'
-        ,'coust'
-        ,'description'
-    )
-WHERE NAME = 'webstaff.cat.label.left_label.height';
-
-UPDATE config.org_unit_setting_type
-SET label = oils_i18n_gettext(
-         'webstaff.cat.label.left_label.width'
-        ,'Item Print Label - Width for Spine Label'
-        ,'coust'
-        ,'label'
-    ),
-     description = oils_i18n_gettext(
-         'webstaff.cat.label.left_label.width'
-        ,'Set the default width for the item print Spine Label. Please include a unit of measurement that is valid CSS. For example, "1in" or "2.5cm"'
-        ,'coust'
-        ,'description'
-    )
-WHERE NAME = 'webstaff.cat.label.left_label.width';
-
-UPDATE config.org_unit_setting_type
-SET label = oils_i18n_gettext(
-         'webstaff.cat.label.right_label.height'
-        ,'Item Print Label - Height for Pocket Label'
-        ,'coust'
-        ,'label'
-    ),
-     description = oils_i18n_gettext(
-         'webstaff.cat.label.right_label.height'
-        ,'Set the default height for the item print Pocket Label. Please include a unit of measurement that is valid CSS. For example, "1in" or "2.5cm"'
-        ,'coust'
-        ,'description'
-    )
-WHERE NAME = 'webstaff.cat.label.right_label.height';
-
-UPDATE config.org_unit_setting_type
-SET label = oils_i18n_gettext(
-         'webstaff.cat.label.right_label.width'
-        ,'Item Print Label - Width for Pocket Label'
-        ,'coust'
-        ,'label'
-    ),
-     description = oils_i18n_gettext(
-         'webstaff.cat.label.right_label.width'
-        ,'Set the default width for the item print Pocket Label. Please include a unit of measurement that is valid CSS. For example, "1in" or "2.5cm"'
-        ,'coust'
-        ,'description'
-    )
-WHERE NAME = 'webstaff.cat.label.right_label.width';
-
-
 -- Refresh rmsr so normalization is gone
 SELECT reporter.refresh_materialized_simple_record();
 
@@ -474,3 +378,162 @@ UPDATE actor.usr SET guardian = ident_value2, ident_value2 = NULL WHERE NOT dele
 
 
 COMMIT;
+BEGIN;
+
+ALTER TABLE actor.usr ADD COLUMN guardian TEXT;
+
+CREATE INDEX actor_usr_guardian_idx 
+    ON actor.usr (evergreen.lowercase(guardian));
+CREATE INDEX actor_usr_guardian_unaccent_idx 
+    ON actor.usr (evergreen.unaccent_and_squash(guardian));
+
+-- Modify auditor tables accordingly.
+SELECT auditor.update_auditors();
+
+-- clear the guardian field on delete
+CREATE OR REPLACE FUNCTION actor.usr_delete(
+       src_usr  IN INTEGER,
+       dest_usr IN INTEGER
+) RETURNS VOID AS $$
+DECLARE
+       old_profile actor.usr.profile%type;
+       old_home_ou actor.usr.home_ou%type;
+       new_profile actor.usr.profile%type;
+       new_home_ou actor.usr.home_ou%type;
+       new_name    text;
+       new_dob     actor.usr.dob%type;
+BEGIN
+       SELECT
+               id || '-PURGED-' || now(),
+               profile,
+               home_ou,
+               dob
+       INTO
+               new_name,
+               old_profile,
+               old_home_ou,
+               new_dob
+       FROM
+               actor.usr
+       WHERE
+               id = src_usr;
+       --
+       -- Quit if no such user
+       --
+       IF old_profile IS NULL THEN
+               RETURN;
+       END IF;
+       --
+       perform actor.usr_purge_data( src_usr, dest_usr );
+       --
+       -- Find the root grp_tree and the root org_unit.  This would be simpler if we 
+       -- could assume that there is only one root.  Theoretically, someday, maybe,
+       -- there could be multiple roots, so we take extra trouble to get the right ones.
+       --
+       SELECT
+               id
+       INTO
+               new_profile
+       FROM
+               permission.grp_ancestors( old_profile )
+       WHERE
+               parent is null;
+       --
+       SELECT
+               id
+       INTO
+               new_home_ou
+       FROM
+               actor.org_unit_ancestors( old_home_ou )
+       WHERE
+(SELECT id FROM permission.grp_tree WHERE name = 'LocalAdmin'),
+(SELECT id FROM permission.perm_list WHERE code = 'MARK_ITEM_DISCARD'),
+1
+),
+(
+(SELECT id FROM permission.grp_tree WHERE name = 'LibraryManager'),
+(SELECT id FROM permission.perm_list WHERE code = 'MARK_ITEM_DISCARD'),
+2
+),
+(
+(SELECT id FROM permission.grp_tree WHERE name = 'SuperCat'),
+(SELECT id FROM permission.perm_list WHERE code = 'MARK_ITEM_DISCARD'),
+0
+),
+(
+(SELECT id FROM permission.grp_tree WHERE name = 'Cat1'),
+(SELECT id FROM permission.perm_list WHERE code = 'MARK_ITEM_DISCARD'),
+1
+),
+(
+(SELECT id FROM permission.grp_tree WHERE name = 'Cat2'),
+(SELECT id FROM permission.perm_list WHERE code = 'MARK_ITEM_DISCARD'),
+1
+),
+(
+(SELECT id FROM permission.grp_tree WHERE name = 'Cat3'),
+(SELECT id FROM permission.perm_list WHERE code = 'MARK_ITEM_DISCARD'),
+1
+),
+(
+(SELECT id FROM permission.grp_tree WHERE name = 'Circ1'),
+(SELECT id FROM permission.perm_list WHERE code = 'MARK_ITEM_DISCARD'),
+1
+),
+(
+(SELECT id FROM permission.grp_tree WHERE name = 'Circ2'),
+(SELECT id FROM permission.perm_list WHERE code = 'MARK_ITEM_DISCARD'),
+1
+),
+-- copy delete warning override for discard/weed feature to work
+(
+(SELECT id FROM permission.grp_tree WHERE name = 'Circ1'),
+(SELECT id FROM permission.perm_list WHERE code = 'COPY_DELETE_WARNING.override'),
+1
+),
+(
+(SELECT id FROM permission.grp_tree WHERE name = 'SuperCat'),
+(SELECT id FROM permission.perm_list WHERE code = 'COPY_DELETE_WARNING.override'),
+0
+)
+;
+
+--need to set grantable for these perms/groups
+INSERT INTO permission.grp_perm_map (grp, perm, depth, grantable)
+VALUES (
+(SELECT id FROM permission.grp_tree WHERE name = 'GlobalAdmin'), 
+(SELECT id FROM permission.perm_list WHERE code = 'COPY_DELETE_WARNING.override'),
+0,
+TRUE
+),
+(
+(SELECT id FROM permission.grp_tree WHERE name = 'LibraryManager'),
+(SELECT id FROM permission.perm_list WHERE code = 'COPY_DELETE_WARNING.override'),
+1,
+TRUE
+)
+;
+
+-- allow multiple email addresses to be entered in patron reg form
+UPDATE actor.org_unit_setting SET value = '"[^@<> ]+@[^@<> ]+\\.[^@.*<> ]{2,}"' WHERE name = 'ui.patron.edit.au.email.regex' and org_unit = 1;
+
+-- settings
+INSERT INTO actor.org_unit_setting (org_unit, name, value) VALUES 
+-- new setting for max duplicate holds
+(1, 'circ.holds.max_duplicate_holds', '"20"'),
+-- settings for parent/guardian field
+(1, 'ui.patron.edit.guardian_required_for_juv', 'true'),
+(1, 'ui.patron.edit.au.guardian.show', 'true'),
+(1, 'ui.patron.edit.au.guardian.suggest', 'true'),
+-- date formatting for web client
+(1, 'webstaff.format.dates', '"MM/dd/yyyy"'),
+(1, 'webstaff.format.date_and_time', '"MM/dd/yyyy HH:mm"'),
+-- allow emailing records without logging in
+(1, 'opac.email_record.allow_without_login', 'true')
+;
+
+-- move parent/guardian field data to new field
+UPDATE actor.usr SET guardian = ident_value2, ident_value2 = NULL WHERE NOT deleted AND ident_value2 IS NOT NULL AND ident_value2 <> '';
+
+COMMIT;
+