X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fcontacts.html;h=efcf48eccad2abcb34d8052eb213b61d1f41e2fb;hp=56fbac8c6213c96e40e71347e08f9f9f8ae091a7;hb=e8740b7c8f772508c0a393d3c0de2b3c8531280d;hpb=dd65ba99bb9281571f19744154a3b03bcd3f01ab diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 56fbac8c6..efcf48ecc 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -1,116 +1,235 @@ -% my %which = ( -% '' => emt('Billing'), -% 'ship_' => emt('Service'), -% ); -% foreach my $which ( '', 'ship_' ) { -% my $pre = $cust_main->get("${which}last") ? $which : ''; - -<% $which{$which} %> <% mt('address') |h %> -<% ntable("#cccccc") %><% ntable("#cccccc",2) %> - - <% mt('Contact name') |h %> - - <% $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") |h %> - -% if ( $which eq '' && $conf->exists('show_ss') ) { - <% mt('SS#') |h %> - <% $cust_main->masked('ss') || ' ' %> -% } - -% if ( $conf->exists('cust-email-high-visibility') && $which eq '') { - - <% mt('Email invoices') |h %> - - <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || $no %> - - +% my %addr_label = ('bill' => 'Billing address', 'ship' => 'Service address'); + +%# Locations (possibly break this out) +% my @which = ('bill', 'ship'); +% while (@which) { +% my $this = shift @which; +% my $method = $this.'_location'; +% my $location = $cust_main->$method; +<% mt( $addr_label{$this} ) |h %> +% if ( $this eq 'ship' and +% $cust_main->bill_locationnum == $cust_main->ship_locationnum ) +% { + (<% emt('same as billing') %>) +% } + +% if ( +% ($this eq 'ship') +% && $cust_main->invoice_ship_address +% && !$conf->exists('invoice-ship_address') #it's always on, so hide per-cust config +% ) { +(<% emt('included on invoices') %>) +% } + + +% if ( $this eq 'bill' ) { +% #billing contact fields + + + +% if ( $conf->exists('show_ss') ) { + + +% } + +% if ( $conf->exists('cust_main-enable_spouse') and +% ($cust_main->spouse_last or $cust_main->spouse_first) ) { + + + + +% } +% +% # invoicing email +% if ( scalar(@invoicing_list) == 1 ) { # typical individual user; show here + + + + +% } elsif ( scalar(@invoicing_list) > 1 ) { +% # business customer with a contact list +% # show nothing here +% +% } else { # there is no invoice email for them + + +% if ( !$cust_main->postal_invoice or +% $conf->exists('cust_main-require_invoicing_list_email', +% $cust_main->agentnum) +% ) { +% # we need a contact email for this customer (either because that's +% # policy, or because otherwise they won't receive invoices) but we +% # don't have one. + +% } else { + +% } +% } # end of invoicing email + +% if ( $cust_main->company ) { + + + + +% } +% } elsif ( $this eq 'ship' ) { +% if ( $cust_main->ship_company ) { # mostly obsolete these days... + + + + +% } % } + + +% if ( $location ) { # now the actual address + +% if ( $location->locationname ) { + + + + +% } + - - - - - - + + -% if ( $cust_main->get("${pre}address2") ) { -% my $address2_label = -% ( $conf->exists('cust_main-require_address2') -% && ! ( $pre xor $cust_main->has_ship_address ) -% ) -% ? emt('Unit #') -% : ' '; +% if ( $location->get('address2') ) { +% my $address2_label = $conf->exists('cust_main-require_address2') +% ? emt('Unit #') +% : ' '; - - - - + + + + % } - - -% if ( $cust_main->get("${pre}county") ) { - - + + - - - - - - - +<% ($location->city || $location->county) ? ', ' : ''%><% state_label( $location->state, $location->country ) |h %> + <% $location->zip |h %> + - - + + + +% if ( $location->latitude && $location->longitude ) { + <& /elements/tr-coords.html, $location->latitude, + $location->longitude, + $cust_main->name_short, + $cust_main->agentnum, + &> +% } +<& /elements/tr-censustract.html, $location &> + +% } + +% if ( $this eq 'bill' ) { +% # billing contact phone numbers +% foreach my $phone (qw(daytime night mobile)) { +% next if !$cust_main->get($phone); - - - - - - -% if ( $which eq '' && $conf->exists('show_stateid') ) { + +% } #foreach $phone +% if ( $cust_main->get('fax') ) { + - - - - + + -% } -
<% mt('Contact name') |h %><% $cust_main->contact |h %><% mt('SS#') |h %> + + <% $cust_main->masked('ss') || ' ' %> +% if ( +% $cust_main->ss +% && $FS::CurrentUser::CurrentUser->access_right('Unmask customer SSN') +% ) { + <& /elements/link-replace_element_text.html, { + target_id => 'ss_span', + replace_text => $cust_main->ss, + element_type => 'span' + } &> +% } + +
<% mt('Spouse') |h %> + <% join(', ', grep $_, + $cust_main->spouse_last, $cust_main->spouse_first) %> +
<% mt('Email address') |h %> + <% $invoicing_list[0] %> +
<% mt('Email address') |h %><% emt('none') %><% emt('no') %>
<% mt('Company') |h %><% $cust_main->company |h %>
<% mt('Company') |h %><% $cust_main->ship_company |h %>
<% mt('Location ID') |h %><% $location->locationname |h %>
<% mt('Company') |h %><% $cust_main->get("${pre}company") |h %>
<% mt('Address') |h %><% $cust_main->get("${pre}address1") |h %><% mt('Address') |h %><% $location->address1 |h %>
<% $address2_label %><% $cust_main->get("${pre}address2") |h %>
<% $address2_label %><% $location->address2 |h %>
<% mt('City') |h %><% $cust_main->get("${pre}city") |h %><% mt('County') |h %><% $cust_main->get("${pre}county") |h %><% $location->city |h %>\ +% if ( $location->county ) { + (<% $location->county |h %> county)\ % } - <% mt('State') |h %><% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) |h %><% mt('Zip') |h %><% $cust_main->get("${pre}zip") %>
<% mt('Country') |h %><% code2country( $cust_main->get("${pre}country") ) %>
<% $daytime_label %> - <& /elements/phonenumber.html, - $cust_main->get("${pre}daytime"), - 'callable'=>1 - &> - <% $location->country_full |h %>
<% $night_label %> + <% $phone_label{$phone} %> + <& /elements/phonenumber.html, - $cust_main->get("${pre}night"), - 'callable'=>1 + $cust_main->get($phone), + callable => 1, + calling_list_exempt => $cust_main->calling_list_exempt, &>
<% mt('Fax') |h %> - <% $cust_main->get("${pre}fax") || ' ' %> -
<% $stateid_label %><% $cust_main->masked('stateid') || ' ' %><% $stateid_state_label %><% $cust_main->stateid_state || ' ' %><% mt('Fax') |h %> + <% $cust_main->get('fax') || ' ' %> +
-% if ( $which ne 'ship_' ) { + +% } +% +% if ( $conf->exists('show_stateid') ) { + + + <% $stateid_label %> + + + <% $cust_main->masked('stateid') || ' ' %> +% if ( +% $cust_main->stateid +% && $FS::CurrentUser::CurrentUser->access_right('Unmask customer DL') +% ) { + <& /elements/link-replace_element_text.html, { + target_id => 'stateid_span', + replace_text => $cust_main->stateid, + element_type => 'span' + } &> +% } + + + <% $stateid_state_label %> + <% $cust_main->stateid_state || ' ' %> + + +% } +% } #if $this eq 'bill' + +% if ( @which ) {
% } -% } -<& contacts_new.html, $cust_main &> +% } #while @which <%once> -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'); +my %phone_label = ( + + 'daytime' => ( FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ + ? 'Day Phone' + : FS::Msgcat::_gettext('daytime') + ), + + 'night' => ( FS::Msgcat::_gettext('night') =~ /^(night)?$/ + ? 'Night Phone' + : FS::Msgcat::_gettext('night') + ), + + 'mobile' => ( FS::Msgcat::_gettext('mobile') =~ /^(mobile)?$/ + ? 'Mobile Phone' + : FS::Msgcat::_gettext('Mobile') + ), +); + my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/ ? 'Driver’s License' : FS::Msgcat::_gettext('stateid'); @@ -121,10 +240,8 @@ my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_st <%init> -my( $cust_main ) = @_; +my $cust_main = shift; my $conf = new FS::Conf; -my @invoicing_list = $cust_main->invoicing_list; -my $no = emt('no'); +my @invoicing_list = $cust_main->invoicing_list_emailonly; -