X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FMisc.pm;h=e425c4a4b5e0c1cbfd146389158b1b933783c484;hb=e78d51a5053c8d3c0c7192c8b5cdeff5999fafd7;hp=8049fdecee572cc9465dcab237536ba1963efc49;hpb=0c76afbb717e1716e6126bc4a120b8d9471614a0;p=freeside.git diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm index 8049fdece..e425c4a4b 100644 --- a/FS/FS/Misc.pm +++ b/FS/FS/Misc.pm @@ -252,12 +252,14 @@ sub send_email { $smtp_opt{'ssl'} = 1 if defined($enc) && $enc eq 'tls'; $transport = Email::Sender::Transport::SMTP->new( %smtp_opt ); } - + push @to, $options{bcc} if defined($options{bcc}); + # make sure + my @env_to = split(/\s*,\s*/, join(', ', @to)); local $@; # just in case eval { sendmail($message, { transport => $transport, from => $from, - to => \@to }) }; + to => \@env_to }) }; my $error = ''; if(ref($@) and $@->isa('Email::Sender::Failure')) { @@ -534,6 +536,9 @@ use Locale::SubCountry; sub states_hash { my($country) = @_; + #a hash? not expecting an explosion of business from unrecognized countries.. + return states_hash_nosubcountry($country) if $country eq 'XC'; + my @states = # sort map { s/[\n\r]//g; $_; } @@ -556,6 +561,27 @@ sub states_hash { @states; } +sub states_hash_nosubcountry { + my($country) = @_; + + my @states = +# sort + map { s/[\n\r]//g; $_; } + map { $_->state; } + qsearch({ + 'select' => 'state', + 'table' => 'cust_main_county', + 'hashref' => { 'country' => $country }, + 'extra_sql' => 'GROUP BY state', + }); + + #"i see your schwartz is as big as mine!" + map { ( $_->[0] => $_->[1] ) } + sort { $a->[1] cmp $b->[1] } + map { [ $_ => $_ ] } + @states; +} + =item counties STATE COUNTRY Returns a list of counties for this state and country.