From cd2371a35a0c416366fa1822d99571ca68a5ad1e Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 19 Mar 2002 17:48:28 +0000 Subject: changes dum big "state/county/country" select to three, linked with javascript closes: Bug#353 --- httemplate/edit/cust_main.cgi | 79 ++++++++++++++++------------------- httemplate/edit/process/cust_main.cgi | 13 ------ 2 files changed, 37 insertions(+), 55 deletions(-) (limited to 'httemplate/edit') diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index 89a946b0f..39b6ca594 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -69,7 +69,7 @@ print qq!
!, # agent -my $r = qq!*!; +my $r = qq!* !; my @agents = qsearch( 'agent', {} ); #die "No agents created!" unless @agents; @@ -147,7 +147,7 @@ my($last,$first,$ss,$company,$address1,$address2,$city,$zip)=( ); print "

Billing address", &itable("#cccccc"), <${r}Contact name
(last, first) +${r}Contact name
(last, first) END print <Company ${r}Address   -${r}City${r}State/Country${r}State END -#false laziness with ship_state +#false laziness with ship state my $countrydefault = $conf->config('countrydefault') || 'US'; $cust_main->country( $countrydefault ) unless $cust_main->country; + $cust_main->state( $conf->config('statedefault') || 'CA' ) unless $cust_main->state || $cust_main->country ne 'US'; -foreach ( sort { - ( $b->country eq $countrydefault ) <=> ( $a->country eq $countrydefault ) - or $a->country cmp $b->country - or $a->state cmp $b->state - or $a->county cmp $b->county -} qsearch('cust_main_county',{}) ) { - print "state eq $_->state - && $cust_main->county eq $_->county - && $cust_main->country eq $_->country - ); - print ">",$_->state; - print " (",$_->county,")" if $_->county; - print " / ", $_->country; -} -print qq!${r}Zip!; + +my($county_html, $state_html, $country_html) = + FS::cust_main_county::regionselector( $cust_main->county, + $cust_main->state, + $cust_main->country ); + +print "$county_html $state_html"; + +print qq!${r}Zip!; my($daytime,$night,$fax)=( $cust_main->daytime, @@ -199,12 +193,13 @@ my($daytime,$night,$fax)=( ); print <${r}Country$country_html Day Phone Night Phone Fax END -print "$r required fields
"; +print "${r}required fields
"; # service address @@ -221,7 +216,11 @@ END print " what.form.ship_$_.value = what.form.$_.value;\n" for (qw( last first company address1 address2 city zip daytime night fax )); print < @@ -251,7 +250,7 @@ END ); print &itable("#cccccc"), <${r}Contact name
(last, first) + ${r}Contact name
(last, first) END print <Company ${r}Address   - ${r}City${r}State/Country${r}State END #false laziness with regular state - $cust_main->ship_country( $conf->config('countrydefault') || 'US' ) - unless $cust_main->ship_country; + $cust_main->ship_country( $countrydefault ) unless $cust_main->ship_country; + $cust_main->ship_state( $conf->config('statedefault') || 'CA' ) unless $cust_main->ship_state || $cust_main->ship_country ne 'US'; - foreach ( sort { - ( $b->country eq $countrydefault ) <=> ( $a->country eq $countrydefault ) - or $a->country cmp $b->country - or $a->state cmp $b->state - or $a->county cmp $b->county - } qsearch('cust_main_county',{}) ) { - print "ship_state eq $_->state - && $cust_main->ship_county eq $_->county - && $cust_main->ship_country eq $_->country - ); - print ">",$_->state; - print " (",$_->county,")" if $_->county; - print " / ", $_->country; - } - print qq!${r}Zip!; + + my($ship_county_html, $ship_state_html, $ship_country_html) = + FS::cust_main_county::regionselector( $cust_main->ship_county, + $cust_main->ship_state, + $cust_main->ship_country, + 'ship_', + 'changed(this)', ); + + print "$ship_county_html $ship_state_html"; + + print qq!${r}Zip!; my($ship_daytime,$ship_night,$ship_fax)=( $cust_main->ship_daytime, @@ -296,12 +290,13 @@ END ); print <${r}Country$ship_country_html Day Phone Night Phone Fax END - print "$r required fields
"; + print "${r}required fields
"; } diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index c8038ecf6..6ce60d14a 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -8,19 +8,6 @@ $cgi->param('tax','') unless defined $cgi->param('tax'); $cgi->param('refnum', (split(/:/, ($cgi->param('refnum'))[0] ))[0] ); -$cgi->param('state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ - or die "Oops, illegal \"state\" param: ". $cgi->param('state'); -$cgi->param('state', $1); -$cgi->param('county', $3 || ''); -$cgi->param('country', $4); - -$cgi->param('ship_state') =~ /^(\w*)( \(([\w ]+)\))? ?\/ ?(\w+)$/ - or $cgi->param('ship_state') =~ /^(((())))$/ - or die "Oops, illegal \"ship_state\" param: ". $cgi->param('ship_state'); -$cgi->param('ship_state', $1); -$cgi->param('ship_county', $3 || ''); -$cgi->param('ship_country', $4); - my $payby = $cgi->param('payby'); if ( $payby ) { $cgi->param('payinfo', $cgi->param( $payby. '_payinfo' ) ); -- cgit v1.2.1