From dbe3c9d86e7dde9b96d68d6f4f056a4040b6c112 Mon Sep 17 00:00:00 2001 From: dbs Date: Thu, 25 Nov 2010 15:59:19 +0000 Subject: [PATCH] Create or extend the 040 according to MARC spec (040 = NR) Also, don't identify OWA as a modifying source if they're not part of the batch load. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/conifer/branches/rel_1_6_1@1087 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- tools/ebooks/prep_ebook_records.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tools/ebooks/prep_ebook_records.py b/tools/ebooks/prep_ebook_records.py index 7f630cb12d..b98600564f 100644 --- a/tools/ebooks/prep_ebook_records.py +++ b/tools/ebooks/prep_ebook_records.py @@ -245,13 +245,29 @@ def process_records(options): ) new_record.add_field(note) + add_cat_source(new_record, options) + + writer.write(new_record) + +def add_cat_source(record, options): + """Add or extend the 040 field to identify the cataloguing source""" + + # Only Windsor wants to do this + if 'windsor' not in options['libraries']: + return + + cat_source = record['040'] + if cat_source: + # Add subfield 'd' identifying Windsor + cat_source.add_subfield('d', 'CaOWA') + else: + # Add a 040 with subfield 'd' identifying Windsor forty = pymarc.Field(tag = '040', indicators = [' ', ' '], - subfields = [ 'a', 'CaOWA' ] + subfields = [ 'd', 'CaOWA' ] ) - new_record.add_field(forty) + record.add_field(forty) - writer.write(new_record) def process_urls(field, options): """Creates 856 fields required by Conifer""" -- 2.11.0