summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorivan <ivan>2006-04-03 09:46:57 +0000
committerivan <ivan>2006-04-03 09:46:57 +0000
commit929f432c766bbe3bdeed5b80818a12ddf6ec6339 (patch)
tree8129b16aa927db1e4182fcaaeea0c5ee9f050fd4 /httemplate/edit
parent36693c42cbaca86f6957d5ed6794624810018bb3 (diff)
have the UI use full country names, and state names outside the US...
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/cust_main/contact.html2
-rw-r--r--httemplate/edit/cust_main/select-country.html11
-rw-r--r--httemplate/edit/cust_main/select-state.html13
3 files changed, 10 insertions, 16 deletions
diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html
index e0cd06f56..6e4f08957 100644
--- a/httemplate/edit/cust_main/contact.html
+++ b/httemplate/edit/cust_main/contact.html
@@ -96,7 +96,7 @@ my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
<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>
diff --git a/httemplate/edit/cust_main/select-country.html b/httemplate/edit/cust_main/select-country.html
index 014effd66..3941f2f93 100644
--- a/httemplate/edit/cust_main/select-country.html
+++ b/httemplate/edit/cust_main/select-country.html
@@ -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)" %>
<% } %>
diff --git a/httemplate/edit/cust_main/select-state.html b/httemplate/edit/cust_main/select-state.html
index 98e685ab8..64da36ba7 100644
--- a/httemplate/edit/cust_main/select-state.html
+++ b/httemplate/edit/cust_main/select-state.html
@@ -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)' %>
<% } %>