X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FMisc.pm;h=9a4318086fcfcf9aa22e0fc5f2751905e34ed881;hp=cbf449520b1494f1fab089cc4b1b268a0fe33740;hb=389b6f1116c3309c2ee57a6c295ed1a793503095;hpb=d31d59c63c8f4dfd52ca19a02ffcf32fcf49f497 diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm index cbf449520..9a4318086 100644 --- a/FS/FS/Misc.pm +++ b/FS/FS/Misc.pm @@ -414,34 +414,6 @@ sub generate_email { } -=item process_send_email OPTION => VALUE ... - -Takes arguments as per generate_email() and sends the message. This -will die on any error and can be used in the job queue. - -=cut - -sub process_send_email { - my %message = @_; - my $error = send_email(generate_email(%message)); - die "$error\n" if $error; - ''; -} - -=item process_send_generated_email OPTION => VALUE ... - -Takes arguments as per send_email() and sends the message. This -will die on any error and can be used in the job queue. - -=cut - -sub process_send_generated_email { - my %args = @_; - my $error = send_email(%args); - die "$error\n" if $error; - ''; -} - =item send_fax OPTION => VALUE ... Options: @@ -538,6 +510,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; $_; } @@ -560,6 +535,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.