add cust_main-require_address2 config, reimplement address2-search config ("Unit...
[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") %>
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 <TR>
21   <TD ALIGN="right">Company</TD>
22   <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}company") %></TD>
23 </TR>
24 <TR>
25   <TD ALIGN="right">Address</TD>
26   <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address1") %></TD>
27 </TR>
28
29 % if ( $cust_main->get("${pre}address2") ) { 
30 %   my $address2_label =
31 %     ( $conf->exists('cust_main-require_address2')
32 %       #  && (    ( !$which && !$cust_main->has_ship_address )
33 %       #       || (  $which &&  $cust_main->has_ship_address )
34 %       #     )
35 %       && ! ( $which xor $cust_main->has_ship_address )
36 %     )
37 %       ? 'Unit&nbsp;#'
38 %       : '&nbsp;';
39
40   <TR>
41     <TD ALIGN="right"><% $address2_label %></TD>
42     <TD COLSPAN=7 BGCOLOR="#ffffff"><% $cust_main->get("${pre}address2") %></TD>
43   </TR>
44
45 % } 
46
47 <TR>
48   <TD ALIGN="right">City</TD>
49   <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}city") %></TD>
50 % if ( $cust_main->get("${pre}county") ) {
51     <TD ALIGN="right">County</TD>
52     <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}county") %></TD>
53 % }
54   <TD ALIGN="right">State</TD>
55   <TD BGCOLOR="#ffffff"><% state_label( $cust_main->get("${pre}state"), $cust_main->get("${pre}country") ) %></TD>
56   <TD ALIGN="right">Zip</TD>
57   <TD BGCOLOR="#ffffff"><% $cust_main->get("${pre}zip") %></TD>
58 </TR>
59 <TR>
60   <TD ALIGN="right">Country</TD>
61   <TD BGCOLOR="#ffffff"><% code2country( $cust_main->get("${pre}country") ) %></TD>
62 </TR>
63 <TR>
64   <TD ALIGN="right"><% $daytime_label %></TD>
65   <TD COLSPAN=3 BGCOLOR="#ffffff">
66     <% include('/elements/phonenumber.html',
67                   $cust_main->get("${pre}daytime"),
68                   'callable'=>1
69                )
70     %>
71   </TD>
72 </TR>
73 <TR>
74   <TD ALIGN="right"><% $night_label %></TD>
75   <TD COLSPAN=3 BGCOLOR="#ffffff">
76     <% include('/elements/phonenumber.html',
77                   $cust_main->get("${pre}night"),
78                   'callable'=>1
79                )
80     %>
81   </TD>
82 </TR>
83 <TR>
84   <TD ALIGN="right">Fax</TD>
85   <TD COLSPAN=3 BGCOLOR="#ffffff">
86     <% $cust_main->get("${pre}fax") || '&nbsp' %>
87   </TD>
88 </TR>
89 % if ( $which eq '' && $conf->exists('show_stateid') ) { 
90   <TR>
91     <TD ALIGN="right"><% $stateid_label %></TD>
92     <TD BGCOLOR="#ffffff"><% $cust_main->masked('stateid') || '&nbsp' %></TD>
93     <TD ALIGN="right"><% $stateid_state_label %></TD>
94     <TD BGCOLOR="#ffffff"><% $cust_main->stateid_state || '&nbsp' %></TD>
95   </TR>
96 % } 
97 </TABLE></TD></TR></TABLE>
98 % if ( $which ne 'ship_' ) {
99 <BR>
100 % }
101 % } 
102
103 <%once>
104
105 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
106                       ? 'Day&nbsp;Phone'
107                       : FS::Msgcat::_gettext('daytime');
108 my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/
109                       ? 'Night&nbsp;Phone'
110                       : FS::Msgcat::_gettext('night');
111 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
112                       ? 'Driver&rsquo;s&nbsp;License'
113                       : FS::Msgcat::_gettext('stateid');
114 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
115                       ? 'Driver&rsquo;s&nbsp;License State'
116                       : FS::Msgcat::_gettext('stateid_state');
117
118 </%once>
119 <%init>
120
121 my( $cust_main ) = @_;
122 my $conf = new FS::Conf;
123
124 </%init>
125