[open-ils-commits] [GIT] Evergreen ILS branch master updated. aa91defb1548dc2228a505dfa4f42b9cda4244fd
Evergreen Git
git at git.evergreen-ils.org
Mon Jul 27 10:58:14 EDT 2020
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".
The branch, master has been updated
via aa91defb1548dc2228a505dfa4f42b9cda4244fd (commit)
via f3bdc3d12df98bfd59052b8478d6101add44e2aa (commit)
via 6628319ef031988d42ed4fcd695b8a5f74b56e74 (commit)
via 2e86369e96af2d52fbc69ffb7d05e54b9ca300c8 (commit)
from 70c3cbeba6f3a754effcc7a3be6a17ebb8f005b5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit aa91defb1548dc2228a505dfa4f42b9cda4244fd
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Mon Jul 27 10:55:19 2020 -0400
LP#1802166: stamp schema update
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index f02ba5f95c..02bab54b56 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -92,7 +92,7 @@ CREATE TRIGGER no_overlapping_deps
BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1210', :eg_version); -- csharp/rhamby/sandbergja/gmcharlt
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('1211', :eg_version); -- Dyrcona/rhamby/gmcharlt
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.actor_usr_delete.sql b/Open-ILS/src/sql/Pg/upgrade/1211.function.actor_usr_delete.sql
similarity index 96%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.function.actor_usr_delete.sql
rename to Open-ILS/src/sql/Pg/upgrade/1211.function.actor_usr_delete.sql
index 12fcdb792c..334fe4192e 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.actor_usr_delete.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/1211.function.actor_usr_delete.sql
@@ -1,6 +1,6 @@
BEGIN;
---SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('1211', :eg_version); -- Dyrcona/rhamby/gmcharlt
CREATE OR REPLACE FUNCTION actor.usr_delete(
src_usr IN INTEGER,
commit f3bdc3d12df98bfd59052b8478d6101add44e2aa
Author: Galen Charlton <gmc at equinoxinitiative.org>
Date: Mon Jul 27 10:51:37 2020 -0400
LP#1802166: (follow-up) document a way to clear names from already-purged patron records
For reference, the following SQL will clear the preferred name
and name keyword fields from already-purged records:
UPDATE actor.usr
SET pref_prefix = NULL,
pref_first_given_name = NULL,
pref_second_given_name = NULL,
pref_family_name = NULL,
pref_suffix = NULL,
name_keywords = NULL
WHERE usrname ~ ('^' || id || '-PURGED')
AND NOT active
AND deleted
AND (
pref_prefix IS NOT NULL OR
pref_first_given_name IS NOT NULL OR
pref_second_given_name IS NOT NULL OR
pref_family_name IS NOT NULL OR
pref_suffix IS NOT NULL OR
name_keywords IS NOT NULL
);
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/docs/RELEASE_NOTES_NEXT/Circulation/purge_usr_pref_names.adoc b/docs/RELEASE_NOTES_NEXT/Circulation/purge_usr_pref_names.adoc
index bb3eb22e26..6f16aaaeb4 100644
--- a/docs/RELEASE_NOTES_NEXT/Circulation/purge_usr_pref_names.adoc
+++ b/docs/RELEASE_NOTES_NEXT/Circulation/purge_usr_pref_names.adoc
@@ -3,3 +3,28 @@ Purge User Preferred Names
The new, user preferred name fields are now set to NULL in the
database when a user account is purged via the staff client or using
the actor.usr_delete function in the database.
+
+To clear the preferred name fields from records that have already been
+purged, run the following SQL update:
+
+[source,sql]
+----
+UPDATE actor.usr
+SET pref_prefix = NULL,
+ pref_first_given_name = NULL,
+ pref_second_given_name = NULL,
+ pref_family_name = NULL,
+ pref_suffix = NULL,
+ name_keywords = NULL
+WHERE usrname ~ ('^' || id || '-PURGED')
+AND NOT active
+AND deleted
+AND (
+ pref_prefix IS NOT NULL OR
+ pref_first_given_name IS NOT NULL OR
+ pref_second_given_name IS NOT NULL OR
+ pref_family_name IS NOT NULL OR
+ pref_suffix IS NOT NULL OR
+ name_keywords IS NOT NULL
+);
+----
commit 6628319ef031988d42ed4fcd695b8a5f74b56e74
Author: Jason Stephenson <jason at sigio.com>
Date: Fri Feb 15 13:33:08 2019 -0500
Lp 1802166: Purge User Name Keywords
Add the name_keywords field to the fields that get set to null in
actor.usr_delete.
Signed-off-by: Jason Stephenson <jason at sigio.com>
Signed-off-by: Rogan Hamby <rogan.hamby at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/999.functions.global.sql b/Open-ILS/src/sql/Pg/999.functions.global.sql
index 4c983ef430..45321a0d2b 100644
--- a/Open-ILS/src/sql/Pg/999.functions.global.sql
+++ b/Open-ILS/src/sql/Pg/999.functions.global.sql
@@ -856,6 +856,7 @@ BEGIN
pref_second_given_name = NULL,
pref_family_name = NULL,
pref_suffix = NULL,
+ name_keywords = NULL,
create_date = now(),
expire_date = now()
WHERE
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.actor_usr_delete.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.actor_usr_delete.sql
index 9cd4e80698..12fcdb792c 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.actor_usr_delete.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.actor_usr_delete.sql
@@ -114,6 +114,7 @@ BEGIN
pref_second_given_name = NULL,
pref_family_name = NULL,
pref_suffix = NULL,
+ name_keywords = NULL,
create_date = now(),
expire_date = now()
WHERE
commit 2e86369e96af2d52fbc69ffb7d05e54b9ca300c8
Author: Jason Stephenson <jason at sigio.com>
Date: Fri Feb 15 12:21:19 2019 -0500
Lp 1802166: Purge User Preferred Names
When the preferred names feature was added, the new fields were not
added to the update in the actor.usr_delete function. This commit
sets those new fields to NULL in that function.
Signed-off-by: Jason Stephenson <jason at sigio.com>
Signed-off-by: Rogan Hamby <rogan.hamby at gmail.com>
Signed-off-by: Galen Charlton <gmc at equinoxinitiative.org>
diff --git a/Open-ILS/src/sql/Pg/999.functions.global.sql b/Open-ILS/src/sql/Pg/999.functions.global.sql
index 71aba5a30e..4c983ef430 100644
--- a/Open-ILS/src/sql/Pg/999.functions.global.sql
+++ b/Open-ILS/src/sql/Pg/999.functions.global.sql
@@ -851,6 +851,11 @@ BEGIN
credit_forward_balance = DEFAULT,
last_xact_id = DEFAULT,
alert_message = NULL,
+ pref_prefix = NULL,
+ pref_first_given_name = NULL,
+ pref_second_given_name = NULL,
+ pref_family_name = NULL,
+ pref_suffix = NULL,
create_date = now(),
expire_date = now()
WHERE
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.function.actor_usr_delete.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.actor_usr_delete.sql
new file mode 100644
index 0000000000..9cd4e80698
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.function.actor_usr_delete.sql
@@ -0,0 +1,124 @@
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+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
+ parent_ou is null;
+ --
+ -- Truncate date of birth
+ --
+ IF new_dob IS NOT NULL THEN
+ new_dob := date_trunc( 'year', new_dob );
+ END IF;
+ --
+ UPDATE
+ actor.usr
+ SET
+ card = NULL,
+ profile = new_profile,
+ usrname = new_name,
+ email = NULL,
+ passwd = random()::text,
+ standing = DEFAULT,
+ ident_type =
+ (
+ SELECT MIN( id )
+ FROM config.identification_type
+ ),
+ ident_value = NULL,
+ ident_type2 = NULL,
+ ident_value2 = NULL,
+ net_access_level = DEFAULT,
+ photo_url = NULL,
+ prefix = NULL,
+ first_given_name = new_name,
+ second_given_name = NULL,
+ family_name = new_name,
+ suffix = NULL,
+ alias = NULL,
+ guardian = NULL,
+ day_phone = NULL,
+ evening_phone = NULL,
+ other_phone = NULL,
+ mailing_address = NULL,
+ billing_address = NULL,
+ home_ou = new_home_ou,
+ dob = new_dob,
+ active = FALSE,
+ master_account = DEFAULT,
+ super_user = DEFAULT,
+ barred = FALSE,
+ deleted = TRUE,
+ juvenile = DEFAULT,
+ usrgroup = 0,
+ claims_returned_count = DEFAULT,
+ credit_forward_balance = DEFAULT,
+ last_xact_id = DEFAULT,
+ alert_message = NULL,
+ pref_prefix = NULL,
+ pref_first_given_name = NULL,
+ pref_second_given_name = NULL,
+ pref_family_name = NULL,
+ pref_suffix = NULL,
+ create_date = now(),
+ expire_date = now()
+ WHERE
+ id = src_usr;
+END;
+$$ LANGUAGE plpgsql;
+
+COMMIT;
diff --git a/docs/RELEASE_NOTES_NEXT/Circulation/purge_usr_pref_names.adoc b/docs/RELEASE_NOTES_NEXT/Circulation/purge_usr_pref_names.adoc
new file mode 100644
index 0000000000..bb3eb22e26
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/Circulation/purge_usr_pref_names.adoc
@@ -0,0 +1,5 @@
+Purge User Preferred Names
+^^^^^^^^^^^^^^^^^^^^^^^^^^
+The new, user preferred name fields are now set to NULL in the
+database when a user account is purged via the staff client or using
+the actor.usr_delete function in the database.
-----------------------------------------------------------------------
Summary of changes:
Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +-
Open-ILS/src/sql/Pg/999.functions.global.sql | 6 +++++
...tion.sql => 1211.function.actor_usr_delete.sql} | 9 +++++--
.../Circulation/purge_usr_pref_names.adoc | 30 ++++++++++++++++++++++
4 files changed, 44 insertions(+), 3 deletions(-)
copy Open-ILS/src/sql/Pg/upgrade/{1148.schema.fix_actor_usr_delete_function.sql => 1211.function.actor_usr_delete.sql} (89%)
create mode 100644 docs/RELEASE_NOTES_NEXT/Circulation/purge_usr_pref_names.adoc
hooks/post-receive
--
Evergreen ILS
More information about the open-ils-commits
mailing list