[open-ils-commits] [GIT] Evergreen ILS branch master updated. 670a9115b9aaad5570f1f7143d630f0c985537e6

Evergreen Git git at git.evergreen-ils.org
Thu May 12 16:51:28 EDT 2016


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  670a9115b9aaad5570f1f7143d630f0c985537e6 (commit)
       via  651020ea6ceb732bc4ac743075bf0080c10ae39f (commit)
      from  e56780cf177b0c25109da3091fb944a95d101b4e (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 670a9115b9aaad5570f1f7143d630f0c985537e6
Author: Kathy Lussier <klussier at masslnc.org>
Date:   Thu May 12 16:49:11 2016 -0400

    LP#1447746 Stamping upgrade script for update-bib-source flag in Vandelay
    
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql
index cad3b82..23f4074 100644
--- a/Open-ILS/src/sql/Pg/002.schema.config.sql
+++ b/Open-ILS/src/sql/Pg/002.schema.config.sql
@@ -91,7 +91,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 ('0979', :eg_version); -- miker/dyrcona/bshum
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0980', :eg_version); -- DPearl/kmlussier
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.merge_overlay_control.sql b/Open-ILS/src/sql/Pg/upgrade/0980.schema.merge.overlay_control.sql
similarity index 97%
rename from Open-ILS/src/sql/Pg/upgrade/XXXX.schema.merge_overlay_control.sql
rename to Open-ILS/src/sql/Pg/upgrade/0980.schema.merge.overlay_control.sql
index e13ac33..ed5a697 100644
--- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.merge_overlay_control.sql
+++ b/Open-ILS/src/sql/Pg/upgrade/0980.schema.merge.overlay_control.sql
@@ -1,6 +1,6 @@
 BEGIN;
 
-SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+SELECT evergreen.upgrade_deps_block_check('0980', :eg_version);
 
 ALTER TABLE vandelay.merge_profile ADD COLUMN update_bib_source BOOLEAN NOT NULL DEFAULT false;
 UPDATE vandelay.merge_profile SET update_bib_source = true WHERE id=2;

commit 651020ea6ceb732bc4ac743075bf0080c10ae39f
Author: Dan Pearl <dpearl at cwmars.org>
Date:   Thu Feb 4 12:46:46 2016 -0500

    LP#1447746: Do not update bib source on match-only merge
    
    This adds a flag to control the updating of the bib source on a vandelay operation.
    
    Signed-off-by: Dan Pearl <dpearl at cwmars.org>
    Signed-off-by: Kathy Lussier <klussier at masslnc.org>

diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml
index a51113f..13c94e1 100644
--- a/Open-ILS/examples/fm_IDL.xml
+++ b/Open-ILS/examples/fm_IDL.xml
@@ -200,6 +200,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 			<field reporter:label="Remove Specification" name="strip_spec" reporter:datatype="text"/>
 			<field reporter:label="Preserve Specification" name="preserve_spec" reporter:datatype="text"/>
 			<field reporter:label="Min. Quality Ratio" name="lwm_ratio" reporter:datatype="float"/>
+                        <field reporter:label="Update Bib. Source" name="update_bib_source" reporter:datatype="bool"/>
 		</fields>
 		<links>
 			<link field="owner" reltype="has_a" key="id" map="" class="aou"/>
diff --git a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
index bfc3586..6c9325d 100644
--- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
+++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql
@@ -210,6 +210,7 @@ CREATE TABLE vandelay.merge_profile (
     replace_spec    TEXT,
     strip_spec      TEXT,
     preserve_spec   TEXT,
+    update_bib_source BOOLEAN	NOT NULL DEFAULT FALSE,
     lwm_ratio       NUMERIC,
 	CONSTRAINT vand_merge_prof_owner_name_idx UNIQUE (owner,name),
 	CONSTRAINT add_replace_strip_or_preserve CHECK ((preserve_spec IS NOT NULL OR replace_spec IS NOT NULL) OR (preserve_spec IS NULL AND replace_spec IS NULL))
@@ -1463,6 +1464,7 @@ DECLARE
     v_bib_source    INT;
     update_fields   TEXT[];
     update_query    TEXT;
+    update_bib      BOOL;
 BEGIN
 
     SELECT  q.marc, q.bib_source INTO v_marc, v_bib_source
@@ -1481,29 +1483,33 @@ BEGIN
                 import_time = NOW()
           WHERE id = import_id;
 
-        editor_string := (oils_xpath('//*[@tag="905"]/*[@code="u"]/text()',v_marc))[1];
+	  SELECT q.update_bib_source INTO update_bib FROM vandelay.merge_profile q where q.id = merge_profile_Id;
 
-        IF editor_string IS NOT NULL AND editor_string <> '' THEN
-            SELECT usr INTO editor_id FROM actor.card WHERE barcode = editor_string;
+          IF update_bib THEN
+		editor_string := (oils_xpath('//*[@tag="905"]/*[@code="u"]/text()',v_marc))[1];
 
-            IF editor_id IS NULL THEN
-                SELECT id INTO editor_id FROM actor.usr WHERE usrname = editor_string;
-            END IF;
+		IF editor_string IS NOT NULL AND editor_string <> '' THEN
+		    SELECT usr INTO editor_id FROM actor.card WHERE barcode = editor_string;
 
-            IF editor_id IS NOT NULL THEN
-                --only update the edit date if we have a valid editor
-                update_fields := ARRAY_APPEND(update_fields, 'editor = ' || editor_id || ', edit_date = NOW()');
-            END IF;
-        END IF;
+		    IF editor_id IS NULL THEN
+			SELECT id INTO editor_id FROM actor.usr WHERE usrname = editor_string;
+		    END IF;
 
-        IF v_bib_source IS NOT NULL THEN
-            update_fields := ARRAY_APPEND(update_fields, 'source = ' || v_bib_source);
-        END IF;
+		    IF editor_id IS NOT NULL THEN
+			--only update the edit date if we have a valid editor
+			update_fields := ARRAY_APPEND(update_fields, 'editor = ' || editor_id || ', edit_date = NOW()');
+		    END IF;
+		END IF;
+
+		IF v_bib_source IS NOT NULL THEN
+		    update_fields := ARRAY_APPEND(update_fields, 'source = ' || v_bib_source);
+		END IF;
 
-        IF ARRAY_LENGTH(update_fields, 1) > 0 THEN
-            update_query := 'UPDATE biblio.record_entry SET ' || ARRAY_TO_STRING(update_fields, ',') || ' WHERE id = ' || eg_id || ';';
-            --RAISE NOTICE 'query: %', update_query;
-            EXECUTE update_query;
+		IF ARRAY_LENGTH(update_fields, 1) > 0 THEN
+		    update_query := 'UPDATE biblio.record_entry SET ' || ARRAY_TO_STRING(update_fields, ',') || ' WHERE id = ' || eg_id || ';';
+		    --RAISE NOTICE 'query: %', update_query;
+		    EXECUTE update_query;
+		END IF;
         END IF;
 
         RETURN TRUE;
diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
index eae5327..f98044f 100644
--- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql
+++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql
@@ -14481,11 +14481,11 @@ INSERT INTO action_trigger.environment (
     'owning_lib.billing_address'
 );
 
-INSERT INTO vandelay.merge_profile (id, owner, name, replace_spec) 
-    VALUES (1, 1, oils_i18n_gettext(1, 'Match-Only Merge', 'vmp', 'name'), '901c');
+INSERT INTO vandelay.merge_profile (id, owner, name, replace_spec, update_bib_source) 
+    VALUES (1, 1, oils_i18n_gettext(1, 'Match-Only Merge', 'vmp', 'name'), '901c', false);
 
-INSERT INTO vandelay.merge_profile (id, owner, name, preserve_spec) 
-    VALUES (2, 1, oils_i18n_gettext(2, 'Full Overlay', 'vmp', 'name'), '901c');
+INSERT INTO vandelay.merge_profile (id, owner, name, replace_spec, update_bib_source) 
+    VALUES (2, 1, oils_i18n_gettext(2, 'Full Overlay', 'vmp', 'name'), '901c', true);
 
 SELECT SETVAL('vandelay.merge_profile_id_seq'::TEXT, 100);
 
diff --git a/Open-ILS/src/sql/Pg/t/lp1447746_import_flag.pg b/Open-ILS/src/sql/Pg/t/lp1447746_import_flag.pg
new file mode 100644
index 0000000..ca835ed
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/t/lp1447746_import_flag.pg
@@ -0,0 +1,14 @@
+-- Load the TAP functions.
+BEGIN;
+
+-- Plan the tests.
+SELECT plan(1);
+
+-- Run the tests.
+
+SELECT has_column('vandelay', 'merge_profile', 'update_bib_source', 
+    'Column "update_bib_source" on vandelay.merge_profile should exist');
+
+-- Finish the tests and clean up.
+SELECT * FROM finish();
+ROLLBACK;
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.merge_overlay_control.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.merge_overlay_control.sql
new file mode 100644
index 0000000..e13ac33
--- /dev/null
+++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.merge_overlay_control.sql
@@ -0,0 +1,74 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+ALTER TABLE vandelay.merge_profile ADD COLUMN update_bib_source BOOLEAN NOT NULL DEFAULT false;
+UPDATE vandelay.merge_profile SET update_bib_source = true WHERE id=2;
+
+CREATE OR REPLACE FUNCTION vandelay.overlay_bib_record ( import_id BIGINT, eg_id BIGINT, merge_profile_id INT ) RETURNS BOOL AS $$
+DECLARE
+    editor_string   TEXT;
+    editor_id       INT;
+    v_marc          TEXT;
+    v_bib_source    INT;
+    update_fields   TEXT[];
+    update_query    TEXT;
+    update_bib      BOOL;
+BEGIN
+
+    SELECT  q.marc, q.bib_source INTO v_marc, v_bib_source
+      FROM  vandelay.queued_bib_record q
+            JOIN vandelay.bib_match m ON (m.queued_record = q.id AND q.id = import_id)
+      LIMIT 1;
+
+    IF v_marc IS NULL THEN
+        -- RAISE NOTICE 'no marc for vandelay or bib record';
+        RETURN FALSE;
+    END IF;
+
+    IF vandelay.template_overlay_bib_record( v_marc, eg_id, merge_profile_id) THEN
+        UPDATE  vandelay.queued_bib_record
+          SET   imported_as = eg_id,
+                import_time = NOW()
+          WHERE id = import_id;
+
+	  SELECT q.update_bib_source INTO update_bib FROM vandelay.merge_profile q where q.id = merge_profile_id;
+
+          IF update_bib THEN
+		editor_string := (oils_xpath('//*[@tag="905"]/*[@code="u"]/text()',v_marc))[1];
+
+		IF editor_string IS NOT NULL AND editor_string <> '' THEN
+		    SELECT usr INTO editor_id FROM actor.card WHERE barcode = editor_string;
+
+		    IF editor_id IS NULL THEN
+			SELECT id INTO editor_id FROM actor.usr WHERE usrname = editor_string;
+		    END IF;
+
+		    IF editor_id IS NOT NULL THEN
+			--only update the edit date if we have a valid editor
+			update_fields := ARRAY_APPEND(update_fields, 'editor = ' || editor_id || ', edit_date = NOW()');
+		    END IF;
+		END IF;
+
+		IF v_bib_source IS NOT NULL THEN
+		    update_fields := ARRAY_APPEND(update_fields, 'source = ' || v_bib_source);
+		END IF;
+
+		IF ARRAY_LENGTH(update_fields, 1) > 0 THEN
+		    update_query := 'UPDATE biblio.record_entry SET ' || ARRAY_TO_STRING(update_fields, ',') || ' WHERE id = ' || eg_id || ';';
+		    --RAISE NOTICE 'query: %', update_query;
+		    EXECUTE update_query;
+		END IF;
+        END IF;
+
+        RETURN TRUE;
+    END IF;
+
+    -- RAISE NOTICE 'update of biblio.record_entry failed';
+
+    RETURN FALSE;
+
+END;
+$$ LANGUAGE PLPGSQL;
+
+COMMIT;
diff --git a/Open-ILS/src/templates/vandelay/inc/profiles.tt2 b/Open-ILS/src/templates/vandelay/inc/profiles.tt2
index 32caff5..4526465 100644
--- a/Open-ILS/src/templates/vandelay/inc/profiles.tt2
+++ b/Open-ILS/src/templates/vandelay/inc/profiles.tt2
@@ -13,7 +13,7 @@
     </div>
     <table  jsId="pGrid"
             dojoType="openils.widget.AutoGrid"
-            fieldOrder="['name', 'owner', 'preserve_spec', 'replace_spec', 'add_spec', 'strip_spec', 'lwm_ratio']"
+            fieldOrder="['name', 'owner', 'update_bib_source', 'preserve_spec', 'replace_spec', 'add_spec', 'strip_spec', 'lwm_ratio']"
             query="{id: '*'}"
             defaultCellWidth='"14%"'
             fmClass='vmp'
diff --git a/docs/RELEASE_NOTES_NEXT/Cataloging/marc_bib_update.adoc b/docs/RELEASE_NOTES_NEXT/Cataloging/marc_bib_update.adoc
new file mode 100644
index 0000000..fb67cb4
--- /dev/null
+++ b/docs/RELEASE_NOTES_NEXT/Cataloging/marc_bib_update.adoc
@@ -0,0 +1,15 @@
+Selectable Bibliographic Source Update
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+During vandelay, the bib source has always recorded the record source,
+the time of the update and the identity of the user associated with the 
+operation.  This is not really desired for match-only merges.
+
+This feature provides a way to control whether the bib source data 
+is updated or not.
+
+In MARC Import, select the "Merge / Overlay" tab.  Each entry in the table has 
+a value in the new "Update bib. source" column. If that value is "true", then 
+the bib source data will be updated.
+
+The two system-defined entries have been pre-set to appropriate values (Full Overlay = true;
+Match-Only Merge = false).

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/examples/fm_IDL.xml                       |    1 +
 Open-ILS/src/sql/Pg/002.schema.config.sql          |    2 +-
 Open-ILS/src/sql/Pg/012.schema.vandelay.sql        |   42 ++++++-----
 Open-ILS/src/sql/Pg/950.data.seed-values.sql       |    8 +-
 Open-ILS/src/sql/Pg/t/lp1447746_import_flag.pg     |   14 ++++
 .../upgrade/0980.schema.merge.overlay_control.sql  |   74 ++++++++++++++++++++
 Open-ILS/src/templates/vandelay/inc/profiles.tt2   |    2 +-
 .../Cataloging/marc_bib_update.adoc                |   15 ++++
 8 files changed, 134 insertions(+), 24 deletions(-)
 create mode 100644 Open-ILS/src/sql/Pg/t/lp1447746_import_flag.pg
 create mode 100644 Open-ILS/src/sql/Pg/upgrade/0980.schema.merge.overlay_control.sql
 create mode 100644 docs/RELEASE_NOTES_NEXT/Cataloging/marc_bib_update.adoc


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list