--exportbarcodesfile will use this file name for a barcode export instead
of the generic 'barcodes_export.txt'
+--item_type_subfield will make use of --holding_code and provide a breakdown of
+bib types by item types. If --branch_subfield is also provided, then the
+breakdown will be further subdivided by branch.
+
=back
=cut
my $uri_threshold = 1;
my $p_holding_code;
my $p_barcode_subfield;
+my $p_item_type_subfield;
+my $p_branch_subfield;
my $p_ils_name = '';
my $holding_threshold = 50;
my $p_ignore_filetype = 'false';
'uri_threshold:i' => \$uri_threshold,
'holding_code:s' => \$p_holding_code,
'barcode_subfield:s' => \$p_barcode_subfield,
+ 'item_type_subfield:s' => \$p_item_type_subfield,
+ 'branch_subfield:s' => \$p_branch_subfield,
'ignore_filetype:s' => \$p_ignore_filetype,
'ils:s' => \$p_ils_name,
'exportbarcodes:s' => \$exportbarcodes,
if (length $p_barcode_subfield != 1) { abort('Barcode subfields must be a single character code.'); }
}
+if ($p_item_type_subfield) {
+ if (!defined $p_holding_code) { abort('An item type field can not be used without a holding code.'); }
+ if (length $p_item_type_subfield != 1) { abort('Item type subfields must be a single character code.'); }
+}
+
+if ($p_branch_subfield) {
+ if (!defined $p_holding_code) { abort('A branch field can not be used without a holding code.'); }
+ if (length $p_branch_subfield != 1) { abort('Branch subfields must be a single character code.'); }
+}
+
# ils name, holding tag, barcode subfield
my @ilses = (
['Mandarin','852','p'],
);
my @temp;
-if ($p_holding_code) {
+if (defined $p_holding_code && defined $p_ils_name && defined $p_barcode_subfield) {
push @temp, $p_ils_name;
push @temp, $p_holding_code;
if ($p_barcode_subfield) { push @temp, lc $p_barcode_subfield; }
my @fields;
my @encodings;
my @types;
+my %bib_types_by_item_type;
my @holding_code_strings;
my %holding_counts;
my %barcode_counts;
push @encodings, $enc;
my $type = substr $record->leader(), 6, 1;
push @types, $type;
+ # bib type by branch and by item type if item subfield (and optionally branch subfield) provided
+ if (defined $p_holding_code && defined $p_item_type_subfield) {
+ my @holding_fields = $record->field($p_holding_code);
+ foreach my $hf (@holding_fields) {
+ my $item_type = $hf->subfield($p_item_type_subfield) || '<missing item type subfield>';
+ my $branch = $p_branch_subfield || 'default';
+ if (! defined $bib_types_by_item_type{ $branch }) {
+ $bib_types_by_item_type{ $branch } = {};
+ }
+ if (! defined $bib_types_by_item_type{ $branch }{ $type }) {
+ $bib_types_by_item_type{ $branch }{ $type } = {};
+ }
+ if (! defined $bib_types_by_item_type{ $branch }{ $type }{ $item_type }) {
+ $bib_types_by_item_type{ $branch }{ $type }{ $item_type } = 0;
+ }
+ $bib_types_by_item_type{ $branch }{ $type }{ $item_type }++;
+ }
+ }
foreach my $f (@fields) {
my $u = $f->subfield('u');
my $n = $f->subfield('9');
}
print "\n";
+if ($p_item_type_subfield) {
+ print "===== Branch / Leader 06 / Item Type\n";
+ foreach my $branch (keys %bib_types_by_item_type) {
+ foreach my $btype (keys %{ $bib_types_by_item_type{$branch} }) {
+ foreach my $itype (keys %{ $bib_types_by_item_type{$branch}{$btype} }) {
+ my $count = $bib_types_by_item_type{$branch}{$btype}{$itype};
+ print "$branch\t$btype (" . give_type($btype) . ")\t$itype\t$count\n";
+ }
+ }
+ }
+ print "\n";
+}
+
print "===== Summary of Select Field Counts\n";
print " $uri_count 856 fields with a subfield u\n";
print " $uri_valid_count 856 fields with a subfield u and valid indicators\n";