From: Dan Scott Date: Tue, 17 Apr 2018 18:10:04 +0000 (-0400) Subject: Make 'consortium' flag optional X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=16d7af45d32f7e7a2ef0343d4834162bf34846e7;p=contrib%2FConifer.git Make 'consortium' flag optional As not all purchases are consortial in nature. Signed-off-by: Dan Scott --- diff --git a/tools/ebooks/prep_ebook_records.py b/tools/ebooks/prep_ebook_records.py index becf553fa4..8b6d07da00 100755 --- a/tools/ebooks/prep_ebook_records.py +++ b/tools/ebooks/prep_ebook_records.py @@ -107,9 +107,6 @@ Required arguments: -a / --authorization: The name of the online platorm to be inserted in each 506$e access restriction note. - -c / --consortium : The name of the consortial license to be inserted in - each 506$b access restriction note. - -p / --publisher : The name of the publisher to be inserted in a 710 field with a subfield 4 relator code 'pbl'. @@ -123,6 +120,9 @@ Required arguments: -L / --laurentian: Add an 856 for Laurentian University Optional arguments: + -c / --consortium : The name of the consortial license to be inserted in + each 506$b access restriction note. + -C / --clean : Try to clean up diacritics - some of the records we get have corrupted diacritics. @@ -193,7 +193,6 @@ def check_options(options): _req = { '--input': "* Missing -i / --input argument!", '--output': "* Missing -o / --output argument!", - '--consortium': "* Missing -c / --consortium argument!", '--authorization': "* Missing -a / --authorization argument!", '--publisher': "* Missing -p / --publisher argument!" } @@ -376,10 +375,10 @@ def check_libraries(options): def parse_opts(): """Get command-line arguments from the script""" try: - _short_opts = 'i:o:a:c:p:P:ABLWeCI:d:F:T:t:u:n:s:h' - _long_opts = ['input=', 'output=', 'authorization=', 'consortium=', + _short_opts = 'i:o:a:p:P:ABLc:eCId:F:T:t:u:n:s:x:h' + _long_opts = ['input=', 'output=', 'authorization=', 'publisher=', 'platform=', 'algoma', 'boreal', 'laurentian', - 'ebrary', 'clean', 'isbn-sfx', 'duplicate=', + 'consortium=', 'ebrary', 'clean', 'isbn-sfx', 'duplicate=', 'from-format=', 'to-format=', 'tcn=', 'url=', 'note=', 'sample=', 'help' ] @@ -885,14 +884,22 @@ def add_restriction(new_record, options, publisher): libopts = options['settings'].get_settings(library) # Add the access restriction note - note = pymarc.Field(tag = '506', - indicators = ['1', ' '], + if 'consortium' in options: subfields = [ 'a', append_space_semi_space(libopts['access_note']), 'b', append_space_semi_space(options['consortium']), 'e', authnote, '9', libopts['lac_symbol'] ] + else: + subfields = [ + 'a', append_space_semi_space(libopts['access_note']), + 'e', authnote, + '9', libopts['lac_symbol'] + ] + note = pymarc.Field(tag = '506', + indicators = ['1', ' '], + subfields = subfields ) new_record.add_ordered_field(note)