summaryrefslogtreecommitdiff
path: root/FS/FS/Misc.pm
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2015-12-04 14:37:35 -0800
committerIvan Kohler <ivan@freeside.biz>2015-12-04 14:37:35 -0800
commit796d991531fd0d630bf0db9e87447e0459c7e5d6 (patch)
tree8d658ae6943cd905a14536e77daf8092f2a44510 /FS/FS/Misc.pm
parentc0f97a82840821c3520b719694dbdb552f1e6416 (diff)
add northern cyprus, RT#39335
Diffstat (limited to 'FS/FS/Misc.pm')
-rw-r--r--FS/FS/Misc.pm24
1 files changed, 24 insertions, 0 deletions
diff --git a/FS/FS/Misc.pm b/FS/FS/Misc.pm
index 18cb275..9a43180 100644
--- a/FS/FS/Misc.pm
+++ b/FS/FS/Misc.pm
@@ -510,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; $_; }
@@ -532,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.