fix regression in view/cust_main/contacts.html, RT13094
[freeside.git] / httemplate / view / cust_main / contacts.html
1 % my %which = (
2 %   ''      => 'Billing',
3 %   'ship_' => 'Service',
4 % );
5 % foreach my $which ( '', 'ship_' ) {
6 %   my $pre = $cust_main->get("${which}last") ? $which : '';
7
8 <% $which{$which} %> address
9 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
10 <TR>
11   <TD ALIGN="right">Contact name</TD>
12   <TD COLSPAN=5 BGCOLOR="#ffffff">
13     <% $cust_main->get("${pre}last"). ', '. $cust_main->get("${pre}first") |h %>
14   </TD>
15 % if ( $which eq '' && $conf->exists('show_ss') ) { 
16     <TD ALIGN="right">SS#</TD>
17     <TD BGCOLOR="#ffffff"><% $cust_main->masked('ss') || '&nbsp' %></TD>
18 % } 
19 </TR>
20 % if ( $conf->exists('cust-email-high-visibility') && $which eq '') {
21 <TR>
22   <TD ALIGN="right">Email invoices</TD>
23   <TD BGCOLOR="#ffff00">
24     <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %>
25   </TD>
26 </TR>
27 % }
28 <TR>
29   <TD ALIGN="right">Company</TD>
30   <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}company") |h %></TD>
31 </TR>
32 <TR>
33   <TD ALIGN="right">Address</TD>
34   <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address1") |h %></TD>
35 </TR>
36
37 % if ( $cust_main->get("${pre}address2") ) { 
38 %   my $address2_label =
39 %     ( $conf->exists('cust_main-require_address2')
40 %       && ! ( $pre xor $cust_main->has_ship_address )
41 %     )
42 %       ? 'Unit&nbsp;#'
43 %       : '&nbsp;';
44
45   <TR>
46     <TD ALIGN="right"><% $address2_label %></TD>
47     <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address2") |h %></TD>
48   </TR>
49
50 % } 
51
52 <TR>
53   <TD ALIGN="right">City</TD>
54   <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}city") |h %></TD>
55 % if ( $cust_main->get("${pre}county") ) {
56     <TD ALIGN="right">County</TD>
57     <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}county") |h %></TD>
58 % }
59   <TD ALIGN="right">State</TD>
60   <TD BGCOLOR="#ffffff"><% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) |h %></TD>
61   <TD ALIGN="right">Zip</TD>
62   <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}zip") %></TD>
63 </TR>
64 <TR>
65   <TD ALIGN="right">Country</TD>
66   <TD BGCOLOR="#ffffff"><% code2country( $cust_main->get("${pre}country") ) %></TD>
67 </TR>
68 <TR>
69   <TD ALIGN="right"><% $daytime_label %></TD>
70   <TD COLSPAN=3 BGCOLOR="#ffffff">
71     <% include('/elements/phonenumber.html',
72                   $cust_main->get("${pre}daytime"),
73                   'callable'=>1
74                )
75     %>
76   </TD>
77 </TR>
78 <TR>
79   <TD ALIGN="right"><% $night_label %></TD>
80   <TD COLSPAN=3 BGCOLOR="#ffffff">
81     <% include('/elements/phonenumber.html',
82                   $cust_main->get("${pre}night"),
83                   'callable'=>1
84                )
85     %>
86   </TD>
87 </TR>
88 <TR>
89   <TD ALIGN="right">Fax</TD>
90   <TD COLSPAN=3 BGCOLOR="#ffffff">
91     <% $cust_main->get("${pre}fax") || '&nbsp' %>
92   </TD>
93 </TR>
94 % if ( $which eq '' && $conf->exists('show_stateid') ) { 
95   <TR>
96     <TD ALIGN="right"><% $stateid_label %></TD>
97     <TD BGCOLOR="#ffffff"><% $cust_main->masked('stateid') || '&nbsp' %></TD>
98     <TD ALIGN="right"><% $stateid_state_label %></TD>
99     <TD BGCOLOR="#ffffff"><% $cust_main->stateid_state || '&nbsp' %></TD>
100   </TR>
101 % } 
102 </TABLE></TD></TR></TABLE>
103 % if ( $which ne 'ship_' ) {
104 <BR>
105 % }
106 % } 
107
108 <%once>
109
110 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
111                       ? 'Day&nbsp;Phone'
112                       : FS::Msgcat::_gettext('daytime');
113 my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/
114                       ? 'Night&nbsp;Phone'
115                       : FS::Msgcat::_gettext('night');
116 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
117                       ? 'Driver&rsquo;s&nbsp;License'
118                       : FS::Msgcat::_gettext('stateid');
119 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
120                       ? 'Driver&rsquo;s&nbsp;License State'
121                       : FS::Msgcat::_gettext('stateid_state');
122
123 </%once>
124 <%init>
125
126 my( $cust_main ) = @_;
127 my $conf = new FS::Conf;
128 my @invoicing_list = $cust_main->invoicing_list;
129
130 </%init>
131