From 4e3c4dd6bb16e49a42327507e3c17b90734310b9 Mon Sep 17 00:00:00 2001 From: Jason Etheridge Date: Mon, 18 Aug 2008 20:28:54 +0000 Subject: [PATCH] previous barcodes --- unicorn_patron_xml2text.pl | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/unicorn_patron_xml2text.pl b/unicorn_patron_xml2text.pl index b0ca3c8..86bf793 100755 --- a/unicorn_patron_xml2text.pl +++ b/unicorn_patron_xml2text.pl @@ -62,6 +62,7 @@ print STDOUT join("\t", @base_elements); foreach my $addr ( 1..3 ) { print STDOUT "\t" . join("\t", @addr_elements); } +print STDOUT "\tinactive_barcode1\tinactive_barcode2"; print STDOUT "\n"; for my $patron ( $doc->documentElement->childNodes ) { @@ -107,6 +108,24 @@ for my $patron ( $doc->documentElement->childNodes ) { } } + my $inactive_barcode1 = ''; + my $inactive_barcode2 = ''; + for my $i_bc ( $patron->findnodes( "barcode" ) ) { + my $active = $i_bc->getAttribute('active'); + if ($active eq "0") { + if (! $inactive_barcode1 ) { + $inactive_barcode1 = $i_bc->textContent; + } else { + if (! $inactive_barcode2 ) { + $inactive_barcode2 = $i_bc->textContent; + } else { + warn "Extra barcode (" . $i_bc->textContent . ") for user with id = " . $bc . "\n"; + } + } + } + } + print STDOUT "$inactive_barcode1\t$inactive_barcode2" + print STDOUT "\n"; $count++; } -- 1.7.2.5