From: Robin H. Johnson Date: Tue, 12 Aug 2014 22:47:58 +0000 (-0700) Subject: Implement control over which 852 4b value is used for BCREK/COTR export as needed... X-Git-Url: https://git.sitka.bclibraries.ca/gitweb/?p=sitka%2Fsitka-tools.git;a=commitdiff_plain;h=41d8e042b8e2131946b861b075c5799f60ef585b Implement control over which 852 4b value is used for BCREK/COTR export as needed by MLB Signed-off-by: Robin H. Johnson --- diff --git a/marc_export_custom/marc_export_custom b/marc_export_custom/marc_export_custom index 1bcb3e6..8839d65 100755 --- a/marc_export_custom/marc_export_custom +++ b/marc_export_custom/marc_export_custom @@ -30,6 +30,7 @@ my ($exclusion_ini,$collapse_to_depth, $output_file); my $cfg; my $force901; my $onlyholdings; +my $field852_4b_type = 'collapsed'; GetOptions( 'help' => \$help, @@ -50,12 +51,16 @@ GetOptions( 'onlyholdings' => \$onlyholdings, 'output-file=s' => \$output_file, 'quiet' => \$quiet, + 'field-852-4b-type=s' => \$field852_4b_type, ); if ($exclusion_ini) { die "exclusion ini file does not exist" unless (-r $exclusion_ini and -s $exclusion_ini); $cfg = new Config::Simple($exclusion_ini) } +unless($field852_4b_type =~ /^(collapsed?|circ|owning)/) { + die sprintf("Invalid argument '%s' to --field-852-4b-type", $field852_4b_type); +} if ($help) { print <<"HELP"; @@ -99,6 +104,8 @@ Usage: $0 [options] will be collapsed up to the parent org unit at the set depth --onlyholdings Clean out 852s before adding new ones, and only export items that successfully recieved an 852 field + --field-852-4b-type TYPE TYPE IN 'circ', 'owning', 'collapsed' (default) + What library should be displayed in field 852 4\$b? Examples: @@ -619,13 +626,22 @@ sub add_bib_holdings { } } + my $field_852_4b = undef; + if($field852_4b_type =~ /collapsed?/) { + $field_852_4b = $orgs{$printlib}->shortname; + } elsif($field852_4b_type == 'circ') { + $field_852_4b = $orgs{$circlib}->shortname; + } elsif($field852_4b_type == 'owning') { + $field_852_4b = $orgs{$owninglib}->shortname; + } else { + die "Should not have reached here, invalid \$field852_4b_type=${field852_4b_type}"; + } + $r->append_fields( MARC::Field->new( 852, '4', '', a => $location, - b => $orgs{$printlib}->shortname, - #b => $orgs{$owninglib}->shortname, - #b => $orgs{$circlib}->shortname, + b => $field_852_4b, c => $shelves{$cp->location}->name, j => $cn->label, ($cp->circ_modifier ? ( g => $cp->circ_modifier ) : ()),