X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FMisc.pm;h=9a4318086fcfcf9aa22e0fc5f2751905e34ed881;hp=d06653eddaad9d9b7b2df0f31565c2c0b3cef5db;hb=389b6f1116c3309c2ee57a6c295ed1a793503095;hpb=1cfc3ea3efb8c75388ad344ea9481f6f8df072b9 diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm index d06653edd..9a4318086 100644 --- a/FS/FS/Misc.pm +++ b/FS/FS/Misc.pm @@ -284,7 +284,8 @@ sub send_email { 'status' => ($error ? 'failed' : 'sent'), 'msgtype' => $options{'msgtype'}, }); - $cust_msg->insert; # ignore errors + my $log_error = $cust_msg->insert; + warn "Error logging message: $log_error\n" if $log_error; # at least warn } $error; @@ -509,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; $_; } @@ -531,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.