[open-ils-commits] r19073 - in trunk/Open-ILS: src/perlmods/OpenILS/Application/Cat xul/staff_client/server/cat (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Dec 28 22:37:40 EST 2010


Author: dbs
Date: 2010-12-28 22:37:38 -0500 (Tue, 28 Dec 2010)
New Revision: 19073

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/Authority.pm
   trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
Log:
Create authority records with meaningful cataloging agency values

Hardcoded values in the 040 are problematic for sites that want
to be a source of authority records; with the addition of another
parameter to the open-ils.cat.authority.record.create_from_bib(.readonly)
API, we can solve that problem. The callers of this API (the MARC editor)
have access to the cat.marc_control_number_identifier OU setting, so as
long as that is set correctly, problem solved.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/Authority.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/Authority.pm	2010-12-29 03:12:04 UTC (rev 19072)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Cat/Authority.pm	2010-12-29 03:37:38 UTC (rev 19073)
@@ -44,6 +44,7 @@
         desc => q/Create an authority record entry from a field in a bibliographic record/,
         params => q/
             @param field A hash representing the field to control, consisting of: { tag: string, ind1: string, ind2: string, subfields: [ [code, value] ... ] }
+            @param identifier A MARC control number identifier
             @param authtoken A valid authentication token
             @returns The new record object 
  /}
@@ -56,13 +57,19 @@
         desc => q/Creates MARCXML for an authority record entry from a field in a bibliographic record/,
         params => q/
             @param field A hash representing the field to control, consisting of: { tag: string, ind1: string, ind2: string, subfields: [ [code, value] ... ] }
+            @param identifier A MARC control number identifier
             @returns The MARCXML for the authority record
  /}
 );
 
 sub create_authority_record_from_bib_field {
-    my($self, $conn, $field, $auth) = @_;
+    my($self, $conn, $field, $cni, $auth) = @_;
 
+    # Control number identifier should have been passed in
+    if (!$cni) {
+        $cni = 'UNSET';
+    }
+
     # Change the first character of the incoming bib field tag to a '1'
     # for use in our authority record; close enough for now?
     my $tag = $field->{'tag'};
@@ -95,7 +102,7 @@
 <record xmlns:marc="http://www.loc.gov/MARC21/slim" xmlns="http://www.loc.gov/MARC21/slim"><leader>     nz  a22     o  4500</leader>
 <controlfield tag="001">$arn</controlfield>
 <controlfield tag="008">      ||||||||||||||||||||||||||||||||||</controlfield>
-<datafield tag="040" ind1=" " ind2=" "><subfield code="a">CONS</subfield><subfield code="c">CONS</subfield></datafield>
+<datafield tag="040" ind1=" " ind2=" "><subfield code="a">$cni</subfield><subfield code="c">$cni</subfield></datafield>
 $control
 </record>
 MARCXML

Modified: trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js
===================================================================
--- trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-12-29 03:12:04 UTC (rev 19072)
+++ trunk/Open-ILS/xul/staff_client/server/cat/marcedit.js	2010-12-29 03:37:38 UTC (rev 19073)
@@ -2398,7 +2398,7 @@
                     var source_f = summarizeField(sf);
                     var new_auth = fieldmapper.standardRequest(
                         ["open-ils.cat", "open-ils.cat.authority.record.create_from_bib"],
-                        [source_f, ses()]
+                        [source_f, xulG.marc_control_number_identifier, ses()]
                     );
                     if (new_auth && new_auth.id()) {
                         var id_sf = <subfield code="0" xmlns="http://www.loc.gov/MARC21/slim">({xulG.marc_control_number_identifier}){new_auth.id()}</subfield>;
@@ -2423,7 +2423,7 @@
                     var pcrud = new openils.PermaCrud({"authtoken": authtoken});
                     var rec = fieldmapper.standardRequest(
                         ["open-ils.cat", "open-ils.cat.authority.record.create_from_bib.readonly"],
-                        { "params": [source_f] }
+                        { "params": [source_f, xulG.marc_control_number_identifier] }
                     );
                     loadMarcEditor(pcrud, rec, target, sf);
                 }



More information about the open-ils-commits mailing list