From 5fe597a36d79cc71e5c975edcb80fd5cadc5adcf Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Fri, 19 Dec 2014 16:02:33 -0500 Subject: [PATCH] another option for excluding certain items this time by circ_modifier --exclude-item-circmod-file= Works in conjunction with --exclude-itemless-bibs, so if that argument is in effect and all items on a given bib are effectively filtered out via an --exclude-item argument, then the bib itself will not be included in the output. Signed-off-by: Jason Etheridge --- Open-ILS/src/support-scripts/marc_export.in | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Open-ILS/src/support-scripts/marc_export.in b/Open-ILS/src/support-scripts/marc_export.in index c7cfe898d4..cb09985eff 100755 --- a/Open-ILS/src/support-scripts/marc_export.in +++ b/Open-ILS/src/support-scripts/marc_export.in @@ -85,6 +85,7 @@ sub new { 'exclude-itemless-bibs', 'exclude-item-id-file=s', 'exclude-item-barcode-file=s', + 'exclude-item-circmod-file=s', 'mfhd', 'all', 'replace_001', @@ -132,8 +133,9 @@ Usage: $0 [options] Additional options for type = 'BIBLIO': --items or -i Include items (holdings) in the output - --exclude-item-id-file File containing list of item ids to exclude - --exclude-item-barcode-file File containing list of item barcodes to exclude + --exclude-item-id-file Specify a file containing list of item ids to exclude + --exclude-item-barcode-file Specify a file containing list of item barcodes to exclude + --exclude-item-circmod-file Specify a file containing list of circmods to exclude --exclude-itemless-bibs Don't output bibs without holdings (requires --items) --money Currency symbol to use in item price field [\$] --mfhd Export serial MFHD records for associated bib records @@ -230,7 +232,19 @@ HELP die "Could not find file for exclude-item-barcode-file: " . $opts{'exclude-item-barcode-file'}; } } - + $opts{'exclude-item-circmods'} = {}; + if ($opts{'exclude-item-circmod-file'}) { + if (-e $opts{'exclude-item-circmod-file'}) { + open FILE, $opts{'exclude-item-circmod-file'}; + while (my $item_circmod = ) { + chomp $item_circmod; + $opts{'exclude-item-circmods'}->{$item_circmod} = 1; + } + close FILE; + } else { + die "Could not find file for exclude-item-circmod-file: " . $opts{'exclude-item-circmod-file'}; + } + } if ($opts{mfhd}) { if ($opts{type} ne 'biblio') { @@ -499,6 +513,7 @@ sub next { next unless ($acp); next if defined $Marque::config->option_value('exclude-item-ids')->{$acp->id()}; next if defined $Marque::config->option_value('exclude-item-barcodes')->{$acp->barcode()}; + next if defined $Marque::config->option_value('exclude-item-circmods')->{$acp->circ_modifier()}; $item_count++; my $location = $Marque::config->option_value('location'); my $price = ($acp->price() ? $Marque::config->option_value('money').$acp->price() : ''); -- 2.11.0