"user_pin",
"user_profile",
"user_status",
+ "user_library",
"user_priv_granted",
"user_priv_expires",
"user_mailingaddr",
"user_category1",
"user_category2",
"user_category3",
+ "user_category4",
"dept",
"guardian",
+ "license",
+ "aup",
+ "photo",
+ "notify_via",
"user_claims_ret",
- #"user_environment",
- #"user_library",
+ "user_environment",
"user_department"
);
"dayphone",
"homephone",
"workphone",
+ "cellphone",
"email",
"location",
"usefor",
- "care_of"
+ "care_of",
+ "known_bad"
);
print STDOUT join("\t", @base_elements);
foreach my $addr ( 1..3 ) {
print STDOUT "\t" . join("\t", @addr_elements);
}
+print STDOUT "\tuserid_active\tinactive_barcode1\tinactive_barcode2";
print STDOUT "\n";
for my $patron ( $doc->documentElement->childNodes ) {
next if ($patron->nodeType == 3);
- my $bc = $patron->findvalue( 'user_id' );
+ my $bc = $patron->findvalue( 'user_id' ); $bc =~ s/^\s+//; $bc =~ s/\s+$//;
if (exists($s_map{$bc})) {
$count++;
warn "\n!!! already saw barcode $bc, skipping\n";
}
foreach my $e ( @base_elements ) {
- my $v = $patron->findvalue( $e );
+ my $v = $patron->findvalue( $e ); $v =~ s/^\s+//; $v =~ s/\s+$//;
if ( $v && ( $e eq 'birthdate' || $e eq 'user_priv_granted' || $e eq 'user_priv_expires' ) ) { $v = parse_date($v); }
print STDOUT ( $v ? $v : '' ) . "\t";
}
foreach my $t ( 1..3 ) {
if ($addresses{$t}) {
foreach my $e ( @addr_elements ) {
- my $v = $addresses{$t}->findvalue( $e );
+ my $v;
+ if ($e eq "known_bad") {
+ $v = $addresses{$t}->getAttribute( $e ); if ($v) { $v =~ s/^\s+//; $v =~ s/\s+$//; }
+ } else {
+ $v = $addresses{$t}->findvalue( $e ); $v =~ s/^\s+//; $v =~ s/\s+$//;
+ }
print STDOUT ( $v ? $v : '' ) . "\t";
}
} else {
}
}
+ my $inactive_barcode1 = '';
+ my $inactive_barcode2 = '';
+ my $userid_active = 't';
+ my @barcodes = $patron->findnodes( "barcodes" );
+ for my $i_bc ( $barcodes[0]->findnodes( "barcode" ) ) {
+ my $active = $i_bc->getAttribute('active');
+ if ($active eq "0" && $i_bc->textContent eq $bc) {
+ $userid_active = 'f';
+ }
+ if ($active eq "0" && $i_bc->textContent ne $bc) {
+ if (! $inactive_barcode1 ) {
+ $inactive_barcode1 = $i_bc->textContent;
+ $inactive_barcode1 =~ s/^\s+//;
+ $inactive_barcode1 =~ s/\s+$//;
+ } else {
+ if (! $inactive_barcode2 ) {
+ $inactive_barcode2 = $i_bc->textContent;
+ $inactive_barcode2 =~ s/^\s+//;
+ $inactive_barcode2 =~ s/\s+$//;
+ } else {
+ warn "Extra barcode (" . $i_bc->textContent . ") for user with id = " . $bc . "\n";
+ }
+ }
+ }
+ }
+ print STDOUT "$userid_active\t$inactive_barcode1\t$inactive_barcode2";
+
print STDOUT "\n";
$count++;
}