% 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 %>
   | 
% }
  | <% mt('Company') |h %> | 
  <% $cust_main->get("${pre}company") |h %> | 
  | <% mt('Address') |h %> | 
  <% $cust_main->get("${pre}address1") |h %> | 
% if ( $cust_main->get("${pre}address2") ) { 
%   my $address2_label =
%     ( $conf->exists('cust_main-require_address2')
%       && ! ( $pre xor $cust_main->has_ship_address )
%     )
%       ? emt('Unit #')
%       : ' ';
  
    | <% $address2_label %> | 
    <% $cust_main->get("${pre}address2") |h %> | 
  
% } 
  | <% mt('City') |h %> | 
  <% $cust_main->get("${pre}city") |h %> | 
% if ( $cust_main->get("${pre}county") ) {
    <% mt('County') |h %> | 
    <% $cust_main->get("${pre}county") |h %> | 
% }
  <% 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") ) %> | 
% if ( $cust_main->get($pre.'latitude') && $cust_main->get($pre.'longitude') ) {
  <& /elements/tr-coords.html, $cust_main->get($pre.'latitude'),
                               $cust_main->get($pre.'longitude'),
                               $cust_main->name_short,
  &>
% }
  | <% $daytime_label %> | 
  
    <& /elements/phonenumber.html,
                  $cust_main->get("${pre}daytime"),
                  'callable'=>1,
                  'calling_list_exempt'=>$cust_main->calling_list_exempt,
    &>
   | 
  | <% $night_label %> | 
  
    <& /elements/phonenumber.html,
                  $cust_main->get("${pre}night"),
                  'callable'=>1,
                  'calling_list_exempt'=>$cust_main->calling_list_exempt,
    &>
   | 
  | <% $mobile_label %> | 
  
    <& /elements/phonenumber.html,
                  $cust_main->get("${pre}mobile"),
                  'callable'=>1,
                  'calling_list_exempt'=>$cust_main->calling_list_exempt,
    &>
   | 
  | <% mt('Fax') |h %> | 
  
    <% $cust_main->get("${pre}fax") || ' ' %>
   | 
% if ( $which eq '' && $conf->exists('show_stateid') ) { 
  
    | <% $stateid_label %> | 
    <% $cust_main->masked('stateid') || ' ' %> | 
    <% $stateid_state_label %> | 
    <% $cust_main->stateid_state || ' ' %> | 
  
% } 
% if ( $which ne 'ship_' ) {
% }
% } 
<& contacts_new.html, $cust_main &>
<%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 $mobile_label = 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');
my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
                      ? 'Driver’s License State'
                      : FS::Msgcat::_gettext('stateid_state');
%once>
<%init>
my( $cust_main ) = @_;
my $conf = new FS::Conf;
my @invoicing_list = $cust_main->invoicing_list;
my $no = emt('no');
%init>