From 7aec0cba00014055617a00fdbe01652dc51fd6a0 Mon Sep 17 00:00:00 2001
From: dbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Date: Mon, 1 Nov 2010 20:41:14 +0000
Subject: [PATCH] Replace hard-coded '(CONS)' for MARC control number
 identifier in authority records

We created an actor.org_unit_setting, 'cat.marc_control_number_identifier', for
specifying the preferred MARC control number identifier, but when we create a
new authority record from the MARC editor, the hardcoded value of 'CONS' is being
used.

This teaches the staff client how to pull the appropriate value from the AOUS
when invoking the MARC Editor.

Resolves https://bugs.launchpad.net/evergreen/+bug/669245


git-svn-id: svn://svn.open-ils.org/ILS/trunk@18559 dcc99617-32d9-48b4-a31d-7c20da2025e4
---
 Open-ILS/xul/staff_client/chrome/content/cat/opac.js | 1 +
 Open-ILS/xul/staff_client/server/cat/marcedit.js     | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
index 444b14d0de..c772ba65c6 100644
--- a/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
+++ b/Open-ILS/xul/staff_client/chrome/content/cat/opac.js
@@ -121,6 +121,7 @@ function set_marc_edit() {
     var a =    xulG.url_prefix( urls.XUL_MARC_EDIT );
     var b =    {};
     var c =    {
+            'marc_control_number_identifier' : g.data.hash.aous['cat.marc_control_number_identifier'] || 'Set cat.marc_control_number_identifier in Library Settings',
             'record' : { 'url' : '/opac/extras/supercat/retrieve/marcxml/record/' + docid, "id": docid, "rtype": "bre" },
             'fast_add_item' : function(doc_id,cn_label,cp_barcode) {
                 try {
diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js
index d6b4cc68fd..3ee7f8c929 100644
--- a/Open-ILS/xul/staff_client/server/cat/marcedit.js
+++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js
@@ -142,6 +142,7 @@ function my_init() {
             window.xulG = {};
             window.xulG.record = {};
             window.xulG.save = {};
+            window.xulG.marc_control_number_identifier = 'CONS';
 
             window.xulG.save.label = $('catStrings').getString('staff.cat.marcedit.save.label');
             window.xulG.save.func = function (r) { alert(r); }
@@ -2350,7 +2351,7 @@ function browseAuthority (sf_popup, menu_id, target, sf, limit, page) {
                         [source_f, ses()]
                     );
                     if (new_auth && new_auth.id()) {
-                        var id_sf = <subfield code="0" xmlns="http://www.loc.gov/MARC21/slim">(CONS){new_auth.id()}</subfield>;
+                        var id_sf = <subfield code="0" xmlns="http://www.loc.gov/MARC21/slim">({xulG.marc_control_number_identifier}){new_auth.id()}</subfield>;
                         sf.parent().appendChild(id_sf);
                         var new_sf = marcSubfield(id_sf);
                         target.parentNode.appendChild(new_sf);
@@ -2602,7 +2603,7 @@ function loadMarcEditor(pcrud, marcxml, target, sf) {
                         if (!new_rec) {
                             return '';
                         }
-                        var id_sf = <subfield code="0" xmlns="http://www.loc.gov/MARC21/slim">(CONS){new_rec.id()}</subfield>;
+                        var id_sf = <subfield code="0" xmlns="http://www.loc.gov/MARC21/slim">({xulG.marc_control_number_identifier}){new_rec.id()}</subfield>;
                         sf.parent().appendChild(id_sf);
                         var new_sf = marcSubfield(id_sf);
                         target.parentNode.appendChild(new_sf);
-- 
2.11.0