while( $thisorg ){
# load the local config from the .ini file for exclusions
my $localcfg = $cfg->param(-block=> $thisorg->shortname);
+ my $cfgparam;
# if we see this setting, just skip that org
- if( $localcfg->{'ExcludeEntireOrg'} )
- { skipnote($bib->id,"ExcludeEntireOrg"); next COPYMAP; }
+ $cfgparam = 'ExcludeEntireOrg';
+ if( $localcfg->{$cfgparam} )
+ { skipnote($bib->id, $cfgparam); next COPYMAP; }
# what follows are exclusion rules
# Excluded Flags
- if($localcfg->{'Flags'}){
+ $cfgparam = 'Flags';
+ if($localcfg->{$cfgparam}){
# this little line is just forcing scalars into an array so we can 'use strict' with Config::Simple
- my @flags = ( (ref($localcfg->{'Flags'}) eq "ARRAY") ? @{$localcfg->{'Flags'}} : ($localcfg->{'Flags'}));
+ my @flags = ( (ref($localcfg->{$cfgparam}) eq "ARRAY") ? @{$localcfg->{$cfgparam}} : ($localcfg->{$cfgparam}));
if( grep { $_ eq 'reference' } @flags && $cp->ref eq 't')
{ skipnote($bib->id,"Flags: reference"); next COPYMAP; }
elsif( grep { $_ eq 'unholdable' } @flags && $cp->holdable eq 'f')
elsif( grep { $_ eq 'hidden' } @flags && $cp->opac_visible eq 'f')
{ skipnote($bib->id,"Flags: hidden"); next COPYMAP; }
}
+
# Excluded Circ Modifiers
- if($localcfg->{'CircMods'}){
+ $cfgparam = 'CircMods';
+ if($localcfg->{$cfgparam}){
my $circmod = $cp->circ_modifier || "";
- my @circmods = ( (ref($localcfg->{'CircMods'}) eq "ARRAY") ? @{$localcfg->{'CircMods'}} : ($localcfg->{'CircMods'}) );
+ my @circmods = ( (ref($localcfg->{$cfgparam}) eq "ARRAY") ? @{$localcfg->{$cfgparam}} : ($localcfg->{$cfgparam}) );
if( grep { $_ eq $circmod } @circmods && @circmods)
- { skipnote($bib->id,"CircMods"); next COPYMAP; }
+ { skipnote($bib->id,$cfgparam); next COPYMAP; }
}
# Inverse rule -- only include specified Circ Mods
- if($localcfg->{'OnlyIncludeCircMods'}){
+ $cfgparam = 'OnlyIncludeCircMods';
+ if($localcfg->{$cfgparam}){
my $circmod = $cp->circ_modifier || "";
- my @circmods = ( (ref($localcfg->{'CircMods'}) eq "ARRAY") ? @{$localcfg->{'CircMods'}} : ($localcfg->{'CircMods'}) );
- unless( grep { $_ eq $circmod } @circmods && @circmods)
- { skipnote($bib->id,"OnlyIncludeCircMods"); next COPYMAP; }
+ my @circmods = ( (ref($localcfg->{$cfgparam}) eq "ARRAY") ? @{$localcfg->{$cfgparam}} : ($localcfg->{$cfgparam}) );
+ unless( grep { $_ and $_ eq $circmod } @circmods && @circmods)
+ { skipnote($bib->id,$cfgparam); next COPYMAP; }
}
# Excluded Copy Statuses
- if($localcfg->{'Statuses'}){
- my @statuses = ( (ref($localcfg->{'Statuses'}) eq "ARRAY") ? @{$localcfg->{'Statuses'}} : ($localcfg->{'Statuses'}) );
+ $cfgparam = 'Statuses';
+ if($localcfg->{$cfgparam}){
+ my @statuses = ( (ref($localcfg->{$cfgparam}) eq "ARRAY") ? @{$localcfg->{$cfgparam}} : ($localcfg->{$cfgparam}) );
if( grep { $_ eq $statuses{$cp->status}->name } @statuses && @statuses)
- { skipnote($bib->id,"Statuses"); next COPYMAP; }
+ { skipnote($bib->id,$cfgparam); next COPYMAP; }
}
# Excluded Locations
- if($localcfg->{'Locations'}){
- my @locations = ( (ref($localcfg->{'Locations'}) eq "ARRAY") ? @{$localcfg->{'Locations'}} : ($localcfg->{'Locations'}) );
+ $cfgparam = 'Locations';
+ if($localcfg->{$cfgparam}){
+ my @locations = ( (ref($localcfg->{$cfgparam}) eq "ARRAY") ? @{$localcfg->{$cfgparam}} : ($localcfg->{$cfgparam}) );
if( grep { $_ eq $shelves{$cp->location}->name } @locations && @locations)
- { skipnote($bib->id,"Locations"); next COPYMAP; }
+ { skipnote($bib->id,$cfgparam); next COPYMAP; }
}
# Inverse rule - Only use the specified locations
- if($localcfg->{'OnlyIncludeLocations'}){
- my @locations = ( (ref($localcfg->{'OnlyIncludeLocations'}) eq "ARRAY") ? @{$localcfg->{'OnlyIncludeLocations'}} : ($localcfg->{'Locations'}) );
+ $cfgparam = 'OnlyIncludeLocations';
+ if($localcfg->{$cfgparam}){
+ my @locations = ( (ref($localcfg->{$cfgparam}) eq "ARRAY") ? @{$localcfg->{$cfgparam}} : ($localcfg->{'Locations'}) );
unless( grep { $_ eq $shelves{$cp->location}->name } @locations && @locations)
- { skipnote($bib->id,"OnlyIncludeLocations"); next COPYMAP; }
+ { skipnote($bib->id,$cfgparam); next COPYMAP; }
}
# exclude based on a regex match to location names
- if($localcfg->{'LocationRegex'}){
- my @locregex = ( (ref($localcfg->{'LocationRegex'}) eq "ARRAY") ? @{$localcfg->{'LocationRegex'}} : ($localcfg->{'LocationRegex'}) );
- my $reg = $localcfg->{'LocationRegex'};
+ $cfgparam = 'LocationRegex';
+ if($localcfg->{$cfgparam}){
+ my @locregex = ( (ref($localcfg->{$cfgparam}) eq "ARRAY") ? @{$localcfg->{$cfgparam}} : ($localcfg->{$cfgparam}) );
+ my $reg = $localcfg->{$cfgparam};
if( grep { $shelves{$cp->location}->name =~ m/($reg)/ } @locregex && @locregex)
- { skipnote($bib->id,"LocationRegex"); next COPYMAP; }
+ { skipnote($bib->id,$cfgparam); next COPYMAP; }
}
# include based on a regex match to location names
- if($localcfg->{'OnlyIncludeLocationRegex'}){
- my @locregex = ( (ref($localcfg->{'OnlyIncludeLocationRegex'}) eq "ARRAY") ? @{$localcfg->{'OnlyIncludeLocationRegex'}} : ($localcfg->{'OnlyIncludeLocationRegex'}) );
- my $reg = $localcfg->{'OnlyIncludeLocationRegex'};
+ $cfgparam = 'OnlyIncludeLocationRegex';
+ if($localcfg->{$cfgparam}){
+ my @locregex = ( (ref($localcfg->{$cfgparam}) eq "ARRAY") ? @{$localcfg->{$cfgparam}} : ($localcfg->{$cfgparam}) );
+ my $reg = $localcfg->{$cfgparam};
unless( grep { $shelves{$cp->location}->name =~ m/($reg)/ } @locregex && @locregex)
- { skipnote($bib->id,"OnlyIncludeLocationRegex"); next COPYMAP; }
+ { skipnote($bib->id,$cfgparam); next COPYMAP; }
}
# Exclude based on a callno regex
- if($localcfg->{'CallNoRegex'}){
- my @callnoregex = ( (ref($localcfg->{'CallNoRegex'}) eq "ARRAY") ? @{$localcfg->{'CallNoRegex'}} : ($localcfg->{'CallNoRegex'}) );
- my $reg = $localcfg->{'CallNoRegex'};
+ $cfgparam = 'CallNoRegex';
+ if($localcfg->{$cfgparam}){
+ my @callnoregex = ( (ref($localcfg->{$cfgparam}) eq "ARRAY") ? @{$localcfg->{$cfgparam}} : ($localcfg->{$cfgparam}) );
+ my $reg = $localcfg->{$cfgparam};
if( grep { $cn->label =~ m/($reg)/ } @callnoregex && @callnoregex)
- { skipnote($bib->id,"CallNoRegex"); next COPYMAP; }
+ { skipnote($bib->id,$cfgparam); next COPYMAP; }
}
# Include based on a callno regex
- if($localcfg->{'OnlyIncludeCallNoRegex'}){
- my @callnoregex = ( (ref($localcfg->{'OnlyIncludeCallNoRegex'}) eq "ARRAY") ? @{$localcfg->{'OnlyIncludeCallNoRegex'}} : ($localcfg->{'OnlyIncludeCallNoRegex'}) );
- my $reg = $localcfg->{'OnlyIncludeCallNoRegex'};
+ $cfgparam = 'OnlyIncludeCallNoRegex';
+ if($localcfg->{$cfgparam}){
+ my @callnoregex = ( (ref($localcfg->{$cfgparam}) eq "ARRAY") ? @{$localcfg->{$cfgparam}} : ($localcfg->{$cfgparam}) );
+ my $reg = $localcfg->{$cfgparam};
unless( grep { $cn->label =~ m/($reg)/ } @callnoregex && @callnoregex)
- { skipnote($bib->id,"OnlyIncludeCallNoRegex"); next COPYMAP; }
+ { skipnote($bib->id,$cfgparam); next COPYMAP; }
}
# Trim call number to a float and exclude based on Dewey Range
stats() if (! ($count{cp} % 100 ));
- } # for cnmap
- } # for cnlist
- } # if block
- } # if block
+ } # COPYMAP: for my $cp ( @$cn_map_list )
+ } # for my $cn ( @$cn_list )
+ } # if ($cp_list && @$cp_list)
+ } # if ($cn_list && @$cn_list)
} # sub
sub skipnote {