X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fcontact.html;h=99bc558c3a65ab4e3a560275f73539d27342caf1;hb=d6741df87df9e3352d7ae47a02d0e3f46154fef9;hp=a001634a229950e38f9071bcf2bd80f2d08767ba;hpb=3ce7691203a7737406bf2d4442f7fd84b81f847e;p=freeside.git diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html index a001634a2..99bc558c3 100644 --- a/httemplate/edit/cust_main/contact.html +++ b/httemplate/edit/cust_main/contact.html @@ -1,60 +1,18 @@ -% -% -%my( $cust_main, $pre, $onchange, $disabled ) = @_; -%my $conf = new FS::Conf; -% -%#false laziness with ship state -%my $countrydefault = $conf->config('countrydefault') || 'US'; -%$cust_main->set($pre.'country', $countrydefault ) -% unless $cust_main->get($pre.'country'); -% -%my $statedefault = $conf->config('statedefault') -% || ($countrydefault eq 'US' ? 'CA' : ''); -%$cust_main->set($pre.'state', $statedefault ) -% unless $cust_main->get($pre.'state') -% || $cust_main->get($pre.'country') ne $countrydefault; -% -%#my($county_html, $state_html, $country_html) = -%# FS::cust_main_county::regionselector( $cust_main->get($pre.'county'), -%# $cust_main->get($pre.'state'), -%# $cust_main->get($pre.'country'), -%# $pre, -%# $onchange, -%# $disabled, -%# ); -% -%my %select_hash = ( -% 'county' => $cust_main->get($pre.'county'), -% 'state' => $cust_main->get($pre.'state'), -% 'country' => $cust_main->get($pre.'country'), -% 'prefix' => $pre, -% 'onchange' => $onchange, -% 'disabled' => $disabled, -%); -% -%my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone'; -%my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone'; -% -%my $r = qq!* !; -% -% - - <% &ntable("#cccccc") %> <%$r%>Contact name
(last, first) - - > , - > + + <%$style%>> , + <%$style%>> % if ( $conf->exists('show_ss') && !$pre ) { SS# - + % } elsif ( !$pre ) { - + % } @@ -62,67 +20,131 @@ Company - - > + + <%$style%>> - - <%$r%>Address - - > - - +<% include('/elements/location.html', + 'prefix' => $pre, + 'object' => $cust_main, + 'onchange' => $onchange, + 'disabled' => $disabled, + 'style' => \@style, + 'same_checked' => $opt{'same_checked'}, + 'geocode' => $opt{'geocode'}, + 'censustract' => $opt{'censustract'}, + ) +%> -   + <% $daytime_label %> - > - - - - - <%$r%>City - - > - - <%$r%>State - - <% include('select-county.html', %select_hash ) %> - <% include('select-state.html', %select_hash ) %> + <%$style%>> - <%$r%>Zip - - > - - - - - <%$r%>Country - <% include('select-country.html', %select_hash ) %> - <% $daytime_label %> + <% $night_label %> - > + <%$style%>> - <% $night_label %> + Fax - > + <%$style%>> +% if ( $conf->exists('show_stateid') && !$pre ) { + - Fax - - > + <% $stateid_label %> + <%$style%>> + <% $stateid_state_label %> + <% include('/elements/select-state.html', + 'state' => $cust_main->stateid_state, + 'country' => $cust_main->country, + 'prefix' => 'stateid_', + 'onchange' => $onchange, + 'disabled' => $disabled, + 'style' => \@style, + ) + %> +% } elsif ( !$pre ) { + + + +% } <%$r%>required fields
+<%init> + +#my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_; +my %opt = @_; +my $cust_main = $opt{'cust_main'}; +my $pre = $opt{'pre'}; +my $onchange = $opt{'onchange'}; +my $disabled = $opt{'disabled'}; +my @style = ( $opt{'style'} ? @{ $opt{'style'} } : () ); + +#push @style, 'background-color: #dddddd' if $disabled; +my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : ''; + +my $conf = new FS::Conf; + +foreach (qw(ss stateid)) { + $opt{$_} = $cust_main->masked($_) unless exists $opt{$_}; +} + +#false laziness with ship state +my $countrydefault = $conf->config('countrydefault') || 'US'; +$cust_main->set($pre.'country', $countrydefault ) + unless $cust_main->get($pre.'country'); + +my $statedefault = $conf->config('statedefault') + || ($countrydefault eq 'US' ? 'CA' : ''); +$cust_main->set($pre.'state', $statedefault ) + unless $cust_main->get($pre.'state') + || $cust_main->get($pre.'country') ne $countrydefault; + +$cust_main->set('stateid_state', $cust_main->state ) + unless $pre || $cust_main->get('stateid_state'); + +$opt{geocode} ||= $cust_main->get('geocode'); + +if ( $conf->exists('cust_main-require_censustract') ) { + $opt{censustract} ||= $cust_main->censustract; +} + +#my($county_html, $state_html, $country_html) = +# FS::cust_main_county::regionselector( $cust_main->get($pre.'county'), +# $cust_main->get($pre.'state'), +# $cust_main->get($pre.'country'), +# $pre, +# $onchange, +# $disabled, +# ); + +my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ + ? 'Day Phone' + : FS::Msgcat::_gettext('daytime'); +my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/ + ? 'Night Phone' + : FS::Msgcat::_gettext('night') || 'Night Phone'; +my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/ + ? 'Driver’s License' + : FS::Msgcat::_gettext('stateid') || 'Driver’s License'; +my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/ + ? 'Driver’s License State' + : FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State'; + +my $r = qq!* !; + +