From 8f6bd0e563ac251d8839befc248211a2c7e71058 Mon Sep 17 00:00:00 2001 From: "Bradley M. Kuhn" Date: Tue, 10 Dec 2019 09:38:20 -0800 Subject: [PATCH] Handle multiple addresses. --- scripts/t-shirt-label-print.plx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/t-shirt-label-print.plx b/scripts/t-shirt-label-print.plx index 564b794..afb05f4 100644 --- a/scripts/t-shirt-label-print.plx +++ b/scripts/t-shirt-label-print.plx @@ -121,6 +121,7 @@ foreach my $id (sort { sortFunction($a, $b); } @supporterIds) { my(@postalAddresses) = $sp->getPostalAddresses($id); $postalAddress = $postalAddresses[0]; } + my(@arrayPostal) = split("\n", $postalAddress); my $latexPostal = latex_encode($postalAddress); $latexPostal =~ s/\\unmatched\{0141\}/\L{}/g; $latexPostal =~ s/\\unmatched\{0142\}/\l{}/g; @@ -137,10 +138,12 @@ foreach my $id (sort { sortFunction($a, $b); } @supporterIds) { $overallCount++; $lines{$sizeNeeded}{labels} = "" unless defined $lines{$sizeNeeded}{labels}; $lines{$sizeNeeded}{checklist} = [] unless defined $lines{$sizeNeeded}{checklist}; + $lines{$sizeNeeded}{addressList} = [] unless defined $lines{$sizeNeeded}{addressList}; $lines{$sizeNeeded}{labels} .= '\mlabel{}{TO: \\\\ ' . join(' \\\\ ', split('\n', $latexPostal)) . "}\n"; my $shortLatexPostal = latex_encode(sprintf('%-30.30s', join(" ", reverse split('\n', $postalAddress)))); $shortLatexPostal =~ s/\\unmatched\{0141\}/\L{}/g; $shortLatexPostal =~ s/\\unmatched\{0142\}/\l{}/g; + push(@{$lines{$sizeNeeded}{addressList}}, { id => $id, address => \@arrayPostal }); push(@{$lines{$sizeNeeded}{checklist}}, '{ $\Box$} &' . sprintf("%-3d & %5s & %-30s & %s ", $id, encode('UTF-8', $sp->getLedgerEntityId($id)), encode('UTF-8', $sizeNeeded), @@ -148,6 +151,7 @@ foreach my $id (sort { sortFunction($a, $b); } @supporterIds) { '\\\\ \hline' . "\n"); } my $lineCount = 0; +my @allAddresses; foreach my $size (sort { $a cmp $b } keys %lines) { foreach my $line (@{$lines{$size}{checklist}}) { if ($lineCount++ > 40) { @@ -156,8 +160,10 @@ foreach my $size (sort { $a cmp $b } keys %lines) { } print LIST $line; } + push(@allAddresses, @{$lines{$size}{addressList}}); print LABELS $lines{$size}{labels}; delete $lines{$size}{labels}; + delete $lines{$size}{addressList}; } print LIST "\n\n", '\end{tabular}',"\n";