[freeside-commits] freeside/httemplate/edit/cust_main contact.html, 1.3, 1.4 select-country.html, 1.2, 1.3 select-state.html, 1.1, 1.2

Ivan,,, ivan at wavetail.420.am
Mon Apr 3 02:46:59 PDT 2006


Update of /home/cvs/cvsroot/freeside/httemplate/edit/cust_main
In directory wavetail:/tmp/cvs-serv8347/httemplate/edit/cust_main

Modified Files:
	contact.html select-country.html select-state.html 
Log Message:
have the UI use full country names, and state names outside the US...

Index: select-country.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_main/select-country.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- select-country.html	25 Sep 2005 08:13:35 -0000	1.2
+++ select-country.html	3 Apr 2006 09:46:57 -0000	1.3
@@ -26,7 +26,7 @@
 
   function <%= $opt{'prefix'} %>country_changed(what, callback) {
 
-    country = what.options[what.selectedIndex].text;
+    country = what.options[what.selectedIndex].value;
 
     function <%= $opt{'prefix'} %>update_states(states) {
 
@@ -36,8 +36,8 @@
 
       // add the new states
       var statesArray = eval('(' + states + ')' );
-      for ( var s = 0; s < statesArray.length; s++ ) {
-          var stateLabel = statesArray[s];
+      for ( var s = 0; s < statesArray.length; s=s+2 ) {
+          var stateLabel = statesArray[s+1];
           if ( stateLabel == "" )
               stateLabel = '(n/a)';
           opt(what.form.<%= $opt{'prefix'} %>state, statesArray[s], stateLabel);
@@ -58,13 +58,14 @@
 <SELECT NAME="<%= $opt{'prefix'} %>country" onChange="<%= $opt{'prefix'} %>country_changed(this); <%= $opt{'onchange'} %>" <%= $opt{'disabled'} %>>
 
 <% foreach my $country (
-     sort { ($b eq $countrydefault) <=> ($a eq $countrydefault) or $a cmp $b }
+     sort {    ($b eq $countrydefault) <=> ($a eq $countrydefault)
+            or code2country($a) cmp code2country($b) }
      map { $_->country }
      qsearch( 'cust_main_county',{}, 'DISTINCT ON ( country ) *', )
    ) {
 %>
 
-  <OPTION VALUE="<%= $country %>"<%= $country eq $opt{'country'} ? ' SELECTED' : '' %>><%= $country %>
+  <OPTION VALUE="<%= $country %>"<%= $country eq $opt{'country'} ? ' SELECTED' : '' %>><%= code2country($country). " ($country)" %>
 
 <% } %>
 

Index: select-state.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_main/select-state.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- select-state.html	10 Sep 2005 14:50:56 -0000	1.1
+++ select-state.html	3 Apr 2006 09:46:57 -0000	1.2
@@ -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)' %>
 
 <% } %>
 

Index: contact.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/cust_main/contact.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- contact.html	10 Sep 2005 14:50:56 -0000	1.3
+++ contact.html	3 Apr 2006 09:46:57 -0000	1.4
@@ -96,7 +96,7 @@
 
 <TR>
   <TH ALIGN="right"><%=$r%>Country</TH>
-  <TD><%= include('select-country.html', %select_hash ) %></TD>
+  <TD COLSPAN=5><%= include('select-country.html', %select_hash ) %></TD>
 </TR>
 
 <TR>



More information about the freeside-commits mailing list