diff options
Diffstat (limited to 'httemplate/edit')
-rw-r--r-- | httemplate/edit/cust_main/billing.html | 4 | ||||
-rw-r--r-- | httemplate/edit/cust_main/contact.html | 20 | ||||
-rw-r--r-- | httemplate/edit/cust_main/select-country.html | 76 | ||||
-rw-r--r-- | httemplate/edit/cust_main/select-county.html | 113 | ||||
-rw-r--r-- | httemplate/edit/cust_main/select-state.html | 4 |
5 files changed, 14 insertions, 203 deletions
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index d4c503412..8724db9dc 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -199,11 +199,11 @@ % ( $conf->exists('show_bankstate') ? % qq!<TR><TD ALIGN="right" WIDTH="200">$paystate_label</TD>!. % qq!<TD COLSPAN="3" WIDTH="408">!. -% include('select-state.html', +% include('/elements/select-state.html', % 'empty' => '(choose)', % 'state' => $cust_main->paystate, % 'country' => $cust_main->country, -% 'prefix' => 'pay', +% 'prefix' => 'pay', % ). "</TD></TR>" % : '<INPUT TYPE="hidden" NAME="paystate" VALUE="'. % $cust_main->paystate. '">' diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html index 2d37dc895..d93d41728 100644 --- a/httemplate/edit/cust_main/contact.html +++ b/httemplate/edit/cust_main/contact.html @@ -54,11 +54,11 @@ </TD> <TH ALIGN="right" ID="<%$pre%>countylabel" <%$county_style%>><%$r%>County</TH> <TD> - <% include('select-county.html', %select_hash ) %> + <% include('/elements/select-county.html', %select_hash ) %> </TD> <TH ALIGN="right"><%$r%>State</TH> <TD> - <% include('select-state.html', %select_hash ) %> + <% include('/elements/select-state.html', %select_hash ) %> </TD> <TH><%$r%>Zip</TH> <TD> @@ -68,7 +68,7 @@ <TR> <TH ALIGN="right"><%$r%>Country</TH> - <TD COLSPAN=5><% include('select-country.html', %select_hash ) %></TD> + <TD COLSPAN=5><% include('/elements/select-country.html', %select_hash ) %></TD> % if ( !$pre ) { <TD><INPUT TYPE="hidden" NAME="geocode" VALUE="<% $opt{geocode} %>"></TD> % } @@ -102,11 +102,15 @@ <TD ALIGN="right"><% $stateid_label %></TD> <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>></TD> <TD ALIGN="right"><% $stateid_state_label %></TD> - <TD><% include('select-state.html', 'state' => $cust_main->stateid_state, - 'country' => $cust_main->country, - 'prefix' => 'stateid_', - 'onchange' => $onchange, - 'disabled' => $disabled) %></TD> + <TD><% include('/elements/select-state.html', + 'state' => $cust_main->stateid_state, + 'country' => $cust_main->country, + 'prefix' => 'stateid_', + 'onchange' => $onchange, + 'disabled' => $disabled, + ) + %> + </TD> </TR> % } elsif ( !$pre ) { diff --git a/httemplate/edit/cust_main/select-country.html b/httemplate/edit/cust_main/select-country.html deleted file mode 100644 index 137f61975..000000000 --- a/httemplate/edit/cust_main/select-country.html +++ /dev/null @@ -1,76 +0,0 @@ - -<% 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].value; - - 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=s+2 ) { - var stateLabel = statesArray[s+1]; - 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 code2country($a) cmp code2country($b) } -% map { $_->country } -% qsearch({ -% 'select' => 'country', -% 'table' => 'cust_main_county', -% 'hashref' => {}, -% 'extra_sql' => 'GROUP BY country', -% }) -% ) { - - <OPTION VALUE="<% $country %>"<% $country eq $opt{'country'} ? ' SELECTED' : '' %>><% code2country($country). " ($country)" %> - -% } - -</SELECT> - -<%init> -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'; -</%init> - diff --git a/httemplate/edit/cust_main/select-county.html b/httemplate/edit/cust_main/select-county.html deleted file mode 100644 index 0dc826896..000000000 --- a/httemplate/edit/cust_main/select-county.html +++ /dev/null @@ -1,113 +0,0 @@ -% if ( $countyflag ) { - - <% include('/elements/xmlhttp.html', - 'url' => $p.'misc/counties.cgi', - 'subs' => [ $opt{'prefix'}. 'get_counties' ], - ) - %> - - <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'} %>state_changed(what, callback) { - - state = what.options[what.selectedIndex].value; - country = what.form.<% $opt{'prefix'} %>country.options[what.form.<% $opt{'prefix'} %>country.selectedIndex].value; - - function <% $opt{'prefix'} %>update_counties(counties) { - - // blank the current county list - for ( var i = what.form.<% $opt{'prefix'} %>county.length; i >= 0; i-- ) - what.form.<% $opt{'prefix'} %>county.options[i] = null; - - // add the new counties - var countiesArray = eval('(' + counties + ')' ); - for ( var s = 0; s < countiesArray.length; s++ ) { - var countyLabel = countiesArray[s]; - if ( countyLabel == "" ) - countyLabel = '(n/a)'; - opt(what.form.<% $opt{'prefix'} %>county, countiesArray[s], countyLabel); - } - - var countyFormLabel = document.getElementById('<% $opt{'prefix'} %>countylabel'); - - if ( countiesArray.length > 1 ) { - what.form.<% $opt{'prefix'} %>county.style.display = ''; - countyFormLabel.style.visibility = 'visible'; - } else { - what.form.<% $opt{'prefix'} %>county.style.display = 'none'; - countyFormLabel.style.visibility = 'hidden'; - } - - //run the callback - if ( callback != null ) - callback(); - } - - // go get the new counties - <% $opt{'prefix'} %>get_counties( state, country, <% $opt{'prefix'} %>update_counties ); - - } - - </SCRIPT> - - <SELECT NAME="<% $opt{'prefix'} %>county" onChange="<% $opt{'onchange'} %>" <% $opt{'disabled'} %>> - -% foreach my $county ( @counties ) { - - <OPTION VALUE="<% $county %>"<% $county eq $opt{'county'} ? ' SELECTED' : '' %>><% $county %> - -% } - - </SELECT> - -% } else { - - - <SCRIPT TYPE="text/javascript"> - function <% $opt{'prefix'} %>state_changed(what) { - } - </SCRIPT> - - <INPUT TYPE="hidden" NAME="<% $opt{'prefix'} %>county" VALUE="<% $opt{'county'} %>"> - -% } - -<%init> - -my %opt = @_; -foreach my $opt (qw( county state country prefix onchange disabled )) { - $opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_}); -} - -my @counties = (); -if ( $countyflag ) { - - @counties = counties( $opt{'state'}, $opt{'country'} ); - - # this is very hacky - unless ( scalar(@counties) > 1 ) { - if ( $opt{'disabled'} =~ /STYLE=/i ) { - $opt{'disabled'} =~ s/STYLE="([^"]+)"/STYLE="$1; display:none"/i; - } else { - $opt{'disabled'} .= ' STYLE="display:none"'; - } - } - -} - -</%init> -<%once> - -my $sql = "SELECT COUNT(*) FROM cust_main_county". - " WHERE county IS NOT NULL AND county != ''"; -my $sth = dbh->prepare($sql) or die dbh->errstr; -$sth->execute or die $sth->errstr; -my $countyflag = $sth->fetchrow_arrayref->[0]; - -</%once> diff --git a/httemplate/edit/cust_main/select-state.html b/httemplate/edit/cust_main/select-state.html deleted file mode 100644 index ce08443e4..000000000 --- a/httemplate/edit/cust_main/select-state.html +++ /dev/null @@ -1,4 +0,0 @@ -<% include('/elements/select-state.html', @_) %> -<%init> -warn "cust_main/select-state.html depreated; use /elements/select-state.html instead"; -</%init> |