have the UI use full country names, and state names outside the US...
[freeside.git] / httemplate / edit / cust_main / select-state.html
index 98e685a..64da36b 100644 (file)
@@ -9,17 +9,10 @@
 
 <SELECT NAME="<%= $opt{'prefix'} %>state" onChange="<%= $opt{'prefix'} %>state_changed(this); <%= $opt{'onchange'} %>" <%= $opt{'disabled'} %>>
 
-<% foreach my $state (
-     sort
-     map { $_->state }
-     qsearch( 'cust_main_county',
-              { 'country' => $opt{'country'} },
-              'DISTINCT ON ( state ) *',
-            )
-   ) {
-%>
+<% tie my %states, 'Tie::IxHash', states_hash( $opt{'country'} ); %>
+<% foreach my $state ( keys %states ) { %>
 
-  <OPTION VALUE="<%= $state %>"<%= $state eq $opt{'state'} ? ' SELECTED' : '' %>><%= $state || '(n/a)' %>
+  <OPTION VALUE="<%= $state %>"<%= $state eq $opt{'state'} ? ' SELECTED' : '' %>><%= $states{$state} || '(n/a)' %>
 
 <% } %>