
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, main has been updated via 175578befb6b19a0a88e0c5124b341492954ee1d (commit) via bef7f50fb704fa6e4931ae02d1c1a927d32e08a7 (commit) from f42fcd10270c972e55bfe3bb0866c0f5640898ed (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 175578befb6b19a0a88e0c5124b341492954ee1d Author: Jeff Godin <jgodin@tadl.org> Date: Tue Jul 15 16:52:51 2025 -0400 Forward-port 3.15.2-3.15.3 upgrade script Signed-off-by: Jeff Godin <jgodin@tadl.org> diff --git a/Open-ILS/src/sql/Pg/version-upgrade/3.15.2-3.15.3-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/3.15.2-3.15.3-upgrade-db.sql new file mode 100644 index 0000000000..4d6a8b496c --- /dev/null +++ b/Open-ILS/src/sql/Pg/version-upgrade/3.15.2-3.15.3-upgrade-db.sql @@ -0,0 +1,118 @@ +--Upgrade Script for 3.15.2 to 3.15.3 +\set eg_version '''3.15.3''' +BEGIN; +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('3.15.3', :eg_version); + +SELECT evergreen.upgrade_deps_block_check('1474', :eg_version); + +CREATE OR REPLACE FUNCTION vandelay.auto_overlay_org_unit_copies ( import_id BIGINT, merge_profile_id INT, lwm_ratio_value_p NUMERIC ) RETURNS BOOL AS $$ +DECLARE + eg_id BIGINT; + match_count INT; + rec vandelay.bib_match%ROWTYPE; + v_owning_lib INT; + scope_org INT; + scope_orgs INT[]; + copy_count INT := 0; + max_copy_count INT := 0; +BEGIN + + PERFORM * FROM vandelay.queued_bib_record WHERE import_time IS NOT NULL AND id = import_id; + + IF FOUND THEN + -- RAISE NOTICE 'already imported, cannot auto-overlay' + RETURN FALSE; + END IF; + + -- Gather all the owning libs for our import items. + -- These are our initial scope_orgs. + SELECT ARRAY_AGG(DISTINCT owning_lib) INTO scope_orgs + FROM vandelay.import_item + WHERE record = import_id; + + WHILE CARDINALITY(scope_orgs) IS NOT NULL LOOP + EXIT WHEN CARDINALITY(scope_orgs) = 0; + FOR scope_org IN SELECT * FROM UNNEST(scope_orgs) LOOP + -- For each match, get a count of all copies at descendants of our scope org. + FOR rec IN SELECT * FROM vandelay.bib_match AS vbm + WHERE queued_record = import_id + ORDER BY vbm.eg_record DESC + LOOP + SELECT COUNT(acp.id) INTO copy_count + FROM asset.copy AS acp + INNER JOIN asset.call_number AS acn + ON acp.call_number = acn.id + WHERE acn.owning_lib IN (SELECT id FROM + actor.org_unit_descendants(scope_org)) + AND acn.record = rec.eg_record + AND acp.deleted = FALSE; + IF copy_count > max_copy_count THEN + max_copy_count := copy_count; + eg_id := rec.eg_record; + END IF; + END LOOP; + END LOOP; + + EXIT WHEN eg_id IS NOT NULL; + + -- If no matching bibs had holdings, gather our next set of orgs to check, and iterate. + IF max_copy_count = 0 THEN + SELECT ARRAY_AGG(DISTINCT parent_ou) INTO scope_orgs + FROM actor.org_unit + WHERE id IN (SELECT * FROM UNNEST(scope_orgs)) + AND parent_ou IS NOT NULL; + EXIT WHEN CARDINALITY(scope_orgs) IS NULL; + END IF; + END LOOP; + + IF eg_id IS NULL THEN + -- Could not determine best match via copy count + -- fall back to default best match + IF (SELECT * FROM vandelay.auto_overlay_bib_record_with_best( import_id, merge_profile_id, lwm_ratio_value_p )) THEN + RETURN TRUE; + ELSE + RETURN FALSE; + END IF; + END IF; + + RETURN vandelay.overlay_bib_record( import_id, eg_id, merge_profile_id ); +END; +$$ LANGUAGE PLPGSQL; + + +SELECT evergreen.upgrade_deps_block_check('1475', :eg_version); + +INSERT into config.workstation_setting_type (name, grp, datatype, label) +VALUES ( + 'eg.grid.admin.local.config.standing_penalty', 'gui', 'object', + oils_i18n_gettext( + 'eg.grid.admin.local.config.standing_penalty', + 'Grid Config: admin.local.config.standing_penalty', + 'cwst', 'label' + ) +); + + +SELECT evergreen.upgrade_deps_block_check('1476', :eg_version); + +INSERT INTO config.workstation_setting_type (name, grp, label, description, datatype, fm_class) +VALUES ( + 'eg.circ.patron.search.ou', + 'circ', + oils_i18n_gettext( + 'eg.circ.patron.search.ou', + 'Staff Client patron search: home organization unit', + 'cwst', 'label'), + oils_i18n_gettext( + 'eg.circ.patron.search.ou', + 'Specifies the home organization unit for patron search', + 'cwst', 'description'), + 'link', + 'aou' + ); + +COMMIT; + +-- Update auditor tables to catch changes to source tables. +-- Can be removed/skipped if there were no schema changes. +SELECT auditor.update_auditors(); commit bef7f50fb704fa6e4931ae02d1c1a927d32e08a7 Author: Jeff Godin <jgodin@tadl.org> Date: Tue Jul 15 16:50:03 2025 -0400 Forward-port 3.14.7-3.14.8 upgrade script Signed-off-by: Jeff Godin <jgodin@tadl.org> diff --git a/Open-ILS/src/sql/Pg/version-upgrade/3.14.7-3.14.8-upgrade-db.sql b/Open-ILS/src/sql/Pg/version-upgrade/3.14.7-3.14.8-upgrade-db.sql new file mode 100644 index 0000000000..e1d65c090e --- /dev/null +++ b/Open-ILS/src/sql/Pg/version-upgrade/3.14.7-3.14.8-upgrade-db.sql @@ -0,0 +1,118 @@ +--Upgrade Script for 3.14.7 to 3.14.8 +\set eg_version '''3.14.8''' +BEGIN; +INSERT INTO config.upgrade_log (version, applied_to) VALUES ('3.14.8', :eg_version); + +SELECT evergreen.upgrade_deps_block_check('1474', :eg_version); + +CREATE OR REPLACE FUNCTION vandelay.auto_overlay_org_unit_copies ( import_id BIGINT, merge_profile_id INT, lwm_ratio_value_p NUMERIC ) RETURNS BOOL AS $$ +DECLARE + eg_id BIGINT; + match_count INT; + rec vandelay.bib_match%ROWTYPE; + v_owning_lib INT; + scope_org INT; + scope_orgs INT[]; + copy_count INT := 0; + max_copy_count INT := 0; +BEGIN + + PERFORM * FROM vandelay.queued_bib_record WHERE import_time IS NOT NULL AND id = import_id; + + IF FOUND THEN + -- RAISE NOTICE 'already imported, cannot auto-overlay' + RETURN FALSE; + END IF; + + -- Gather all the owning libs for our import items. + -- These are our initial scope_orgs. + SELECT ARRAY_AGG(DISTINCT owning_lib) INTO scope_orgs + FROM vandelay.import_item + WHERE record = import_id; + + WHILE CARDINALITY(scope_orgs) IS NOT NULL LOOP + EXIT WHEN CARDINALITY(scope_orgs) = 0; + FOR scope_org IN SELECT * FROM UNNEST(scope_orgs) LOOP + -- For each match, get a count of all copies at descendants of our scope org. + FOR rec IN SELECT * FROM vandelay.bib_match AS vbm + WHERE queued_record = import_id + ORDER BY vbm.eg_record DESC + LOOP + SELECT COUNT(acp.id) INTO copy_count + FROM asset.copy AS acp + INNER JOIN asset.call_number AS acn + ON acp.call_number = acn.id + WHERE acn.owning_lib IN (SELECT id FROM + actor.org_unit_descendants(scope_org)) + AND acn.record = rec.eg_record + AND acp.deleted = FALSE; + IF copy_count > max_copy_count THEN + max_copy_count := copy_count; + eg_id := rec.eg_record; + END IF; + END LOOP; + END LOOP; + + EXIT WHEN eg_id IS NOT NULL; + + -- If no matching bibs had holdings, gather our next set of orgs to check, and iterate. + IF max_copy_count = 0 THEN + SELECT ARRAY_AGG(DISTINCT parent_ou) INTO scope_orgs + FROM actor.org_unit + WHERE id IN (SELECT * FROM UNNEST(scope_orgs)) + AND parent_ou IS NOT NULL; + EXIT WHEN CARDINALITY(scope_orgs) IS NULL; + END IF; + END LOOP; + + IF eg_id IS NULL THEN + -- Could not determine best match via copy count + -- fall back to default best match + IF (SELECT * FROM vandelay.auto_overlay_bib_record_with_best( import_id, merge_profile_id, lwm_ratio_value_p )) THEN + RETURN TRUE; + ELSE + RETURN FALSE; + END IF; + END IF; + + RETURN vandelay.overlay_bib_record( import_id, eg_id, merge_profile_id ); +END; +$$ LANGUAGE PLPGSQL; + + +SELECT evergreen.upgrade_deps_block_check('1475', :eg_version); + +INSERT into config.workstation_setting_type (name, grp, datatype, label) +VALUES ( + 'eg.grid.admin.local.config.standing_penalty', 'gui', 'object', + oils_i18n_gettext( + 'eg.grid.admin.local.config.standing_penalty', + 'Grid Config: admin.local.config.standing_penalty', + 'cwst', 'label' + ) +); + + +SELECT evergreen.upgrade_deps_block_check('1476', :eg_version); + +INSERT INTO config.workstation_setting_type (name, grp, label, description, datatype, fm_class) +VALUES ( + 'eg.circ.patron.search.ou', + 'circ', + oils_i18n_gettext( + 'eg.circ.patron.search.ou', + 'Staff Client patron search: home organization unit', + 'cwst', 'label'), + oils_i18n_gettext( + 'eg.circ.patron.search.ou', + 'Specifies the home organization unit for patron search', + 'cwst', 'description'), + 'link', + 'aou' + ); + +COMMIT; + +-- Update auditor tables to catch changes to source tables. +-- Can be removed/skipped if there were no schema changes. +SELECT auditor.update_auditors(); ----------------------------------------------------------------------- Summary of changes: .../3.14.7-3.14.8-upgrade-db.sql} | 39 ++++++++++++++++++++++ .../3.15.2-3.15.3-upgrade-db.sql} | 39 ++++++++++++++++++++++ 2 files changed, 78 insertions(+) copy Open-ILS/src/sql/Pg/{upgrade/1474.schema.vandelay.auto_overlay_org_unit_copies.sql => version-upgrade/3.14.7-3.14.8-upgrade-db.sql} (69%) copy Open-ILS/src/sql/Pg/{upgrade/1474.schema.vandelay.auto_overlay_org_unit_copies.sql => version-upgrade/3.15.2-3.15.3-upgrade-db.sql} (69%) hooks/post-receive -- Evergreen ILS