[open-ils-commits] [GIT] Evergreen ILS branch master updated. 06ce842345c36031a704ab1e86f75332a54a614b

Evergreen Git git at git.evergreen-ils.org
Sun Jan 19 22:26:21 EST 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Evergreen ILS".

The branch, master has been updated
       via  06ce842345c36031a704ab1e86f75332a54a614b (commit)
       via  928642438e58b4d4a283817b0e62c087bd613954 (commit)
      from  bb5a18038514cac32c9314a4f39e4625b4e6c270 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 06ce842345c36031a704ab1e86f75332a54a614b
Author: Dan Scott <dscott at laurentian.ca>
Date:   Sun Jan 19 22:24:07 2014 -0500

    Create 008 - take only the first field/subfield combo
    
    In the event that there were multiple $a subfields in, say, 044, the create 008
    function could spew raw XML into the 008 field. Avoid that by taking the primary
    instance.
    
    Signed-off-by: Dan Scott <dscott at laurentian.ca>

diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js
index 9237ff9..27f5870 100644
--- a/Open-ILS/xul/staff_client/server/cat/marcedit.js
+++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js
@@ -65,7 +65,7 @@ function get_new_008() {
     if (xml_record.datafield.(@tag == '041')) {
 	var field = xml_record.datafield.(@tag == '041')[0];
 	if (field && field.subfield.(@code == 'a')) {
-	    lang = field.subfield.(@code == 'a');
+	    lang = field.subfield.(@code == 'a')[0];
 	}
     }
 
@@ -74,7 +74,7 @@ function get_new_008() {
     if (xml_record.datafield.(@tag == '044')) {
 	var field = xml_record.datafield.(@tag == '044')[0];
 	if (field && field.subfield.(@code == 'a')) {
-	    country = field.subfield.(@code == 'a');
+	    country = field.subfield.(@code == 'a')[0];
 	}
     }
     while (country.length < 3) country = country + ' ';
@@ -85,7 +85,7 @@ function get_new_008() {
     if (xml_record.datafield.(@tag == '260')) {
 	var field = xml_record.datafield.(@tag == '260')[0];
 	if (field && field.subfield.(@code == 'c')) {
-	    var tmpd = field.subfield.(@code == 'c').replace(/[^0-9]/g, '');
+	    var tmpd = field.subfield.(@code == 'c')[0].replace(/[^0-9]/g, '');
 	    if (tmpd.match(/^\d\d\d\d/)) {
 		date1 = tmpd.substr(0, 4);
 	    }

commit 928642438e58b4d4a283817b0e62c087bd613954
Author: Pasi Kallinen <pasi.kallinen at pttk.fi>
Date:   Thu Jul 18 21:00:31 2013 +0300

    Allow generating fixed data in control field 008 quickly
    
    Language and country codes come from 041a and 044a,
    Date1 comes from 260c, and the record date is set to current day.
    
    Signed-off-by: Pasi Kallinen <pasi.kallinen at pttk.fi>
    Signed-off-by: Dan Scott <dscott at laurentian.ca>
    
    Conflicts:
    	Open-ILS/xul/staff_client/server/cat/marcedit.js

diff --git a/Open-ILS/xul/staff_client/server/cat/marcedit.js b/Open-ILS/xul/staff_client/server/cat/marcedit.js
index 4292e78..9237ff9 100644
--- a/Open-ILS/xul/staff_client/server/cat/marcedit.js
+++ b/Open-ILS/xul/staff_client/server/cat/marcedit.js
@@ -46,6 +46,61 @@ function $(id) { return document.getElementById(id); }
 
 var acs; // AuthorityControlSet
 
+function get_new_008() {
+    var orig008 = '                                        ';
+    var now = new Date();
+    var y = now.getUTCFullYear().toString().substr(2,2);
+    var m = now.getUTCMonth() + 1;
+    if (m < 10) m = '0' + m;
+    var d = now.getUTCDate();
+    if (d < 10) d = '0' + d;
+
+    if (xml_record.controlfield.(@tag == '008')) {
+	var field = xml_record.controlfield.(@tag == '008')[0];
+	orig008 = field.text();
+    }
+
+    /* lang code from 041a */
+    var lang = orig008.substr(35, 3);
+    if (xml_record.datafield.(@tag == '041')) {
+	var field = xml_record.datafield.(@tag == '041')[0];
+	if (field && field.subfield.(@code == 'a')) {
+	    lang = field.subfield.(@code == 'a');
+	}
+    }
+
+    /* country code from 044a */
+    var country = orig008.substr(15, 3);
+    if (xml_record.datafield.(@tag == '044')) {
+	var field = xml_record.datafield.(@tag == '044')[0];
+	if (field && field.subfield.(@code == 'a')) {
+	    country = field.subfield.(@code == 'a');
+	}
+    }
+    while (country.length < 3) country = country + ' ';
+    if (country.length > 3) country = country.substr(0,3);
+
+    /* date1 from 260c */
+    var date1 = now.getUTCFullYear().toString();
+    if (xml_record.datafield.(@tag == '260')) {
+	var field = xml_record.datafield.(@tag == '260')[0];
+	if (field && field.subfield.(@code == 'c')) {
+	    var tmpd = field.subfield.(@code == 'c').replace(/[^0-9]/g, '');
+	    if (tmpd.match(/^\d\d\d\d/)) {
+		date1 = tmpd.substr(0, 4);
+	    }
+	}
+    }
+
+    var date2 = orig008.substr(11, 4);
+    var datetype = orig008.substr(6, 1);
+    var modded = orig008.substr(38, 1);
+    var catsrc = orig008.substr(39, 1);
+
+    return '' + y + m + d + datetype + date1 + date2 + country + '                 ' + lang + modded + catsrc;
+
+}
+
 function mangle_005() {
     var now = new Date();
     var y = now.getUTCFullYear();
@@ -736,7 +791,7 @@ function createMARCTextbox (element,attrs) {
                 loadRecord();
             } else if (event.keyCode == 119 && event.ctrlKey) { // ctrl + F8
                 box = null;
-                createControlField('008','                                        ');
+                createControlField('008', get_new_008());
                 loadRecord();
             }
 

-----------------------------------------------------------------------

Summary of changes:
 Open-ILS/xul/staff_client/server/cat/marcedit.js |   57 +++++++++++++++++++++-
 1 files changed, 56 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
Evergreen ILS


More information about the open-ils-commits mailing list