Vandelay: default match set
authorJeff Davis <jdavis@sitka.bclibraries.ca>
Wed, 17 Oct 2012 23:19:36 +0000 (16:19 -0700)
committerMike Rylander <mrylander@gmail.com>
Wed, 27 Feb 2013 15:40:05 +0000 (10:40 -0500)
Adds an org unit setting to specify a default Record Match Set when
importing MARC records with Vandelay.  NB: If this is set, it will not
be possible to leave the Record Match Set field blank; it may be
necessary to define a default match set that replicates the current
default behavior.

A new "Vandelay" settings group is also created.

Signed-off-by: Jeff Davis <jdavis@sitka.bclibraries.ca>
Signed-off-by: Ben Shum <bshum@biblio.org>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/sql/Pg/upgrade/XXXX.data.vandelay-default-match-set.sql [new file with mode: 0644]
Open-ILS/web/js/ui/default/vandelay/vandelay.js

diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.vandelay-default-match-set.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.vandelay-default-match-set.sql
new file mode 100644 (file)
index 0000000..32db333
--- /dev/null
@@ -0,0 +1,11 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.settings_group (name, label) VALUES
+    ('vandelay', 'Vandelay');
+
+INSERT INTO config.org_unit_setting_type (name, grp, label, datatype, fm_class) VALUES
+    ('vandelay.default_match_set', 'vandelay', 'Vandelay: Default Record Match Set', 'link', 'vms');
+
+COMMIT;
index 7df3068..26ca3cc 100644 (file)
@@ -93,6 +93,10 @@ var copyStatusCache = {};
 var copyLocationCache = {};
 var localeStrings;
 
+// org settings
+var orgSettings = {};
+const DEFAULT_MATCH_SET = 'vandelay.default_match_set';
+
 /**
   * Grab initial data
   */
@@ -212,6 +216,13 @@ function vlInit() {
         }
     );
 
+    orgSettings = fieldmapper.aou.fetchOrgSettingBatch(openils.User.user.ws_ou(), [
+        DEFAULT_MATCH_SET
+    ]);
+    for(k in orgSettings)
+        if(orgSettings[k])
+            orgSettings[k] = orgSettings[k].value;
+
     vlAttrEditorInit();
     vlExportInit();
 }
@@ -1435,6 +1446,13 @@ function vlUpdateMatchSetSelector(type) {
     type = (type.match(/bib/)) ? 'biblio' : 'authority';
     vlUploadQueueMatchSet.store = 
         new dojo.data.ItemFileReadStore({data:vms.toStoreData(matchSets[type])});
+    // apply default match set
+    for (var i = 0; i < matchSets[type].length; i++) {
+        if (matchSets[type][i].id() == orgSettings[DEFAULT_MATCH_SET]) {
+            vlUploadQueueMatchSet.setValue(matchSets[type][i].id());
+            break;
+        }
+    }
 }
 
 function vlShowUploadForm() {