X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main.cgi;h=39b6ca594556a94b043dcad4a307117dafa86dc2;hb=f1038a648b3d53db925b23519e7cd2a30c6837ed;hp=a0472bdf58a8e730dfe522bfebf1bace90f4b8ac;hpb=22a35047ecdffff80110e06cc08fc84f9ddba9b0;p=freeside.git diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index a0472bdf5..39b6ca594 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -1,3 +1,4 @@ + <% #for misplaced logic below @@ -68,7 +69,7 @@ print qq!
!, # agent -my $r = qq!*!; +my $r = qq!* !; my @agents = qsearch( 'agent', {} ); #die "No agents created!" unless @agents; @@ -146,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 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, @@ -197,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 @@ -219,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 < @@ -230,7 +231,8 @@ END unless ( $cust_main->ship_last ) { print ' CHECKED'; foreach ( - qw( last first company address1 address2 city state zip daytime night fax) + qw( last first company address1 address2 city county state zip country + daytime night fax ) ) { $cust_main->set("ship_$_", $cust_main->get($_) ); } @@ -248,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 - $cust_main->ship_country( $conf->config('countrydefault') || 'US' ) - unless $cust_main->ship_country; + #false laziness with regular state + $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 ( 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, @@ -287,12 +290,13 @@ END ); print <${r}Country$ship_country_html Day Phone Night Phone Fax END - print "$r required fields
"; + print "${r}required fields
"; }