[open-ils-commits] r17859 - branches/rel_2_0/Open-ILS/xul/staff_client/server/cat (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Sep 20 23:48:35 EDT 2010


Author: dbs
Date: 2010-09-20 23:48:32 -0400 (Mon, 20 Sep 2010)
New Revision: 17859

Modified:
   branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/marcedit.js
Log:
Merge r17587 and r17588 from trunk to add $0 control subfields for newly controlled fields

In the MARC editor, when editing a bibliographic record and right-clicking on
a controllable subfield, the "Create new authority from this field" options
now both add a $0 control subfield to the target bib field once the new
auth record has successfully been created.


Modified: branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-09-21 03:44:35 UTC (rev 17858)
+++ branches/rel_2_0/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-09-21 03:48:32 UTC (rev 17859)
@@ -2338,16 +2338,17 @@
                 command : function() { 
                     // Call middle-layer function to create and save the new authority
                     var source_f = summarizeField(sf);
-                    fieldmapper.standardRequest(
+                    var new_auth = fieldmapper.standardRequest(
                         ["open-ils.cat", "open-ils.cat.authority.record.create_from_bib"],
-                        {
-                            "async": true,
-                            "params": [source_f, ses()],
-                            "oncomplete": function() {
-                                alert($('catStrings').getString('staff.cat.marcedit.create_authority_success.label'));
-                            }
-                        }
+                        [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>;
+                        sf.parent().appendChild(id_sf);
+                        var new_sf = marcSubfield(id_sf);
+                        target.parentNode.appendChild(new_sf);
+                        alert($('catStrings').getString('staff.cat.marcedit.create_authority_success.label'));
+                    }
                 }
             })
         );
@@ -2366,7 +2367,7 @@
                         ["open-ils.cat", "open-ils.cat.authority.record.create_from_bib.readonly"],
                         { "params": [source_f] }
                     );
-                    loadMarcEditor(pcrud, rec);
+                    loadMarcEditor(pcrud, rec, target, sf);
                 }
             })
         );
@@ -2567,7 +2568,7 @@
     }
 }
 
-function loadMarcEditor(pcrud, marcxml) {
+function loadMarcEditor(pcrud, marcxml, target, sf) {
     /*
        To run in Firefox directly, must set signed.applets.codebase_principal_support
        to true in about:config
@@ -2589,7 +2590,15 @@
                 rec.last_xact_id(xact_id);
                 rec.isnew(true);
                 pcrud.create(rec, {
-                    "oncomplete": function () {
+                    "oncomplete": function (r, objs) {
+                        var new_rec = objs[0];
+                        if (!new_rec) {
+                            return '';
+                        }
+                        var id_sf = <subfield code="0" xmlns="http://www.loc.gov/MARC21/slim">(CONS){new_rec.id()}</subfield>;
+                        sf.parent().appendChild(id_sf);
+                        var new_sf = marcSubfield(id_sf);
+                        target.parentNode.appendChild(new_sf);
                         alert($('catStrings').getString('staff.cat.marcedit.create_authority_success.label'));
                         win.close();
                     }



More information about the open-ils-commits mailing list