GetOptions(\%opts,
'help',
'items',
+ 'exclude-itemless-bibs',
'mfhd',
'all',
'replace_001',
--since Export records modified since a certain date and time.
Additional options for type = 'BIBLIO':
- --items or -i Include items (holdings) in the output
- --money Currency symbol to use in item price field [\$]
- --mfhd Export serial MFHD records for associated bib records
- Not compatible with --format=BRE
- --location or -l MARC Location Code for holdings from
- http://www.loc.gov/marc/organizations/orgshome.html
- --library Export the bibliographic records that have attached
- holdings for the listed library or libraries as
- identified by shortname
+ --items or -i Include items (holdings) in the output
+ --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
+ Not compatible with --format=BRE
+ --location or -l MARC Location Code for holdings from
+ http://www.loc.gov/marc/organizations/orgshome.html
+ --library Export the bibliographic records that have attached
+ holdings for the listed library or libraries as
+ identified by shortname
Examples:
if ($opts{format} eq 'BRE' && $opts{items}) {
die "Format BRE is not compatible with exporting holdings."
}
+ if ($opts{'exclude-itemless-bibs'} && ! $opts{items}) {
+ die "If excluding itemless bibs, must export holdings.";
+ }
if ($opts{mfhd}) {
if ($opts{type} ne 'biblio') {
if ($Marque::config->option_value('items')) {
unless ($acn_joined) {
- $from .= "\njoin $acnTable on $acnTable.record = $breTable.id";
+ $from .= "\nleft join $acnTable on $acnTable.record = $breTable.id";
$from .= "\nand $acnTable.deleted = 'f'" unless ($Marque::config->option_value('since'));
}
- $from .= "\njoin $acpTable on $acpTable.call_number = $acnTable.id";
+ $from .= "\nleft join $acpTable on $acpTable.call_number = $acnTable.id";
$from .= "\nand $acpTable.deleted = 'f'" unless ($Marque::config->option_value('since'));
}
}
if ($Marque::config->option_value('items')) {
my @acps = $self->acps_for_bre($r);
+ my $item_count = 0;
foreach my $acp (@acps) {
next unless ($acp);
+ $item_count++;
my $location = $Marque::config->option_value('location');
my $price = ($acp->price() ? $Marque::config->option_value('money').$acp->price() : '');
$marc->insert_grouped_field(
(!$U->is_true($acp->opac_visible()) ? (x => 'hidden') : ())
));
}
+ if ($item_count == 0 && $Marque::config->option_value('exclude-itemless-bibs')) {
+ import MARC::File::XML; # Reset SAX Parser.
+ return $self->next(); # skip this bib
+ }
}
if ($Marque::config->option_value('mfhd')) {
$self->{mfhds} = [$self->sres_for_bre($r)];