diff options
Diffstat (limited to 'httemplate/edit/cust_main/select-country.html')
-rw-r--r-- | httemplate/edit/cust_main/select-country.html | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/httemplate/edit/cust_main/select-country.html b/httemplate/edit/cust_main/select-country.html deleted file mode 100644 index 014effd66..000000000 --- a/httemplate/edit/cust_main/select-country.html +++ /dev/null @@ -1,72 +0,0 @@ -<% - - my %opt = @_; - foreach my $opt (qw( county state country prefix onchange disabled )) { - $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); - } - - my $conf = new FS::Conf; - my $countrydefault = $conf->config('countrydefault') || 'US'; - -%> - -<%= include('/elements/xmlhttp.html', - 'url' => $p.'misc/states.cgi', - 'subs' => [ $opt{'prefix'}. 'get_states' ], - ) -%> - -<SCRIPT TYPE="text/javascript"> - - function opt(what,value,text) { - var optionName = new Option(text, value, false, false); - var length = what.length; - what.options[length] = optionName; - } - - function <%= $opt{'prefix'} %>country_changed(what, callback) { - - country = what.options[what.selectedIndex].text; - - function <%= $opt{'prefix'} %>update_states(states) { - - // blank the current state list - for ( var i = what.form.<%= $opt{'prefix'} %>state.length; i >= 0; i-- ) - what.form.<%= $opt{'prefix'} %>state.options[i] = null; - - // add the new states - var statesArray = eval('(' + states + ')' ); - for ( var s = 0; s < statesArray.length; s++ ) { - var stateLabel = statesArray[s]; - if ( stateLabel == "" ) - stateLabel = '(n/a)'; - opt(what.form.<%= $opt{'prefix'} %>state, statesArray[s], stateLabel); - } - - //run the callback - if ( callback != null ) - callback(); - } - - // go get the new states - <%= $opt{'prefix'} %>get_states( country, <%= $opt{'prefix'} %>update_states ); - - } - -</SCRIPT> - -<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 } - map { $_->country } - qsearch( 'cust_main_county',{}, 'DISTINCT ON ( country ) *', ) - ) { -%> - - <OPTION VALUE="<%= $country %>"<%= $country eq $opt{'country'} ? ' SELECTED' : '' %>><%= $country %> - -<% } %> - -</SELECT> - |