Append the $0 controlling subfield to newly created authorities
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 21 Sep 2010 03:25:05 +0000 (03:25 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 21 Sep 2010 03:25:05 +0000 (03:25 +0000)
Still a work in progress; obviously we need to try and grab a better
institutional code, need to teach the "Create and edit..." option
how to do the same thing, and should augment the "Authority created"
dialog box to tell the user to save the record or lose the changes
they just made.

At some point we need to consider auto-saving records, perhaps immediately
after we provide infinite undo capability to step back through previous
changes.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@17857 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/cat/marcedit.js

index 6c68fcd..f4f66e7 100644 (file)
@@ -2338,16 +2338,17 @@ function browseAuthority (sf_popup, menu_id, target, sf, limit, page) {
                 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'));
+                    }
                 }
             })
         );