Use preferred postal address if available.
Test first to see if a preferred postal address is available before attempting to just accept one.
This commit is contained in:
		
							parent
							
								
									e98b8b9d42
								
							
						
					
					
						commit
						04ae300292
					
				
					 1 changed files with 8 additions and 4 deletions
				
			
		|  | @ -93,10 +93,14 @@ foreach my $id (sort { sortFunction($a, $b); } @supporterIds) { | |||
|     next; | ||||
|   } | ||||
| 
 | ||||
|   my $postalAddress = $sp->getPreferredEmailAddress($id); | ||||
|   if (not defined $postalAddress) { | ||||
|     my(@postalAddresses) = $sp->getPostalAddresses($id); | ||||
|   my $latexPostal = latex_encode($postalAddresses[0]); | ||||
|     $postalAddress = $postalAddresses[0]; | ||||
|   } | ||||
|   my $latexPostal = latex_encode($postalAddress); | ||||
|   if ($latexPostal =~ /unmatched/) { | ||||
|     print "Skipping $id request for $sizeNeeded because the address has characters the post office will not accept\n" if $VERBOSE; | ||||
|     print "Skipping $id request for $sizeNeeded because the address has characters the post office will not accept\n  Address was: ", encode('UTF-8', $postalAddress), "\n and became\n$latexPostal\n"  if $VERBOSE; | ||||
|     next; | ||||
|   } | ||||
| 
 | ||||
|  | @ -109,7 +113,7 @@ foreach my $id (sort { sortFunction($a, $b); } @supporterIds) { | |||
|   $lines{$sizeNeeded}{labels} = "" unless defined $lines{$sizeNeeded}{labels}; | ||||
|   $lines{$sizeNeeded}{checklist} = [] unless defined $lines{$sizeNeeded}{checklist}; | ||||
|   $lines{$sizeNeeded}{labels} .= '\mlabel{}{TO: \\\\ ' . join(' \\\\ ', split('\n', $latexPostal)) . "}\n"; | ||||
|   my $shortLatexPostal = latex_encode(sprintf('%-30.30s', join(" ", reverse split('\n', $postalAddresses[0])))); | ||||
|   my $shortLatexPostal = latex_encode(sprintf('%-30.30s', join(" ", reverse split('\n', $postalAddress)))); | ||||
|   push(@{$lines{$sizeNeeded}{checklist}}, '{ $\Box$} &' . sprintf("%-3d  & %5s & %-30s  & %s ", | ||||
|                                                   $id, encode('UTF-8', $sp->getLedgerEntityId($id)), | ||||
|                                                   encode('UTF-8', $sizeNeeded), | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Bradley M. Kuhn
						Bradley M. Kuhn