This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / httemplate / edit / cust_main / contact.html
1 <% &ntable("#cccccc") %>
2
3 <TR>
4   <TH ALIGN="right"><%$r%>Contact&nbsp;name<BR>(last,&nbsp;first)</TH>
5   <TD COLSPAN=7>
6     <INPUT TYPE="text" NAME="<%$pre%>last" VALUE="<% $cust_main->get($pre.'last') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>> , 
7     <INPUT TYPE="text" NAME="<%$pre%>first" VALUE="<% $cust_main->get($pre.'first') |h %>" onChange="<% $onchange %>" <%$disabled%> <%$style%>>
8   </TD>
9 % if ( $conf->exists('show_ss') && !$pre ) { 
10
11   <TD ALIGN="right">SS#</TD>
12   <TD><INPUT TYPE="text" NAME="ss" VALUE="<% $opt{ss} %>" SIZE=11></TD>
13 % } elsif ( !$pre ) { 
14
15   <TD><INPUT TYPE="hidden" NAME="ss" VALUE="<% $opt{ss} %>"></TD>
16 % } 
17
18
19 </TR>
20
21 <TR>
22   <TD ALIGN="right">Company</TD>
23   <TD COLSPAN=7>
24     <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
25   </TD>
26 </TR>
27
28 <% include('/elements/location.html',
29              'prefix'       => $pre,
30              'object'       => $cust_main,
31              'onchange'     => $onchange,
32              'disabled'     => $disabled,
33              'style'        => \@style,
34              'same_checked' => $opt{'same_checked'},
35              'geocode'      => $opt{'geocode'},
36              'censustract'  => $opt{'censustract'},
37           )
38 %>
39
40 <TR>
41   <TD ALIGN="right"><% $daytime_label %></TD>
42   <TD COLSPAN=5>
43     <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
44   </TD>
45 </TR>
46
47 <TR>
48   <TD ALIGN="right"><% $night_label %></TD>
49   <TD COLSPAN=5>
50     <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
51   </TD>
52 </TR>
53
54 <TR>
55   <TD ALIGN="right">Fax</TD>
56   <TD COLSPAN=5>
57     <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
58   </TD>
59 </TR>
60
61 % if ( $conf->exists('show_stateid') && !$pre ) { 
62
63 <TR>
64   <TD ALIGN="right"><% $stateid_label %></TD>
65   <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>></TD>
66   <TD ALIGN="right"><% $stateid_state_label %></TD>
67   <TD><% include('/elements/select-state.html',
68                    'state'    => $cust_main->stateid_state,
69                    'country'  => $cust_main->country,
70                    'prefix'   => 'stateid_',
71                    'onchange' => $onchange,
72                    'disabled' => $disabled,
73                    'style'    => \@style,
74                 )
75       %>
76   </TD>
77 </TR>
78 % } elsif ( !$pre ) { 
79
80   <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
81   <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
82 % } 
83
84 </TABLE>
85 <%$r%>required fields<BR>
86
87 <%init>
88
89 #my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
90 my %opt = @_;
91 my $cust_main = $opt{'cust_main'};
92 my $pre       = $opt{'pre'};
93 my $onchange  = $opt{'onchange'};
94 my $disabled  = $opt{'disabled'};
95 my @style     = ( $opt{'style'} ? @{ $opt{'style'} } : () );
96
97 #push @style, 'background-color: #dddddd' if $disabled;
98 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
99
100 my $conf = new FS::Conf;
101
102 foreach (qw(ss stateid)) {
103   $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
104 }
105
106 #false laziness with ship state
107 my $countrydefault = $conf->config('countrydefault') || 'US';
108 $cust_main->set($pre.'country', $countrydefault )
109   unless $cust_main->get($pre.'country');
110
111 my $statedefault = $conf->config('statedefault')
112                    || ($countrydefault eq 'US' ? 'CA' : '');
113 $cust_main->set($pre.'state', $statedefault )
114   unless $cust_main->get($pre.'state')
115          || $cust_main->get($pre.'country') ne $countrydefault;
116
117 $cust_main->set('stateid_state', $cust_main->state )
118   unless $pre || $cust_main->get('stateid_state');
119
120 $opt{geocode} ||= $cust_main->get('geocode');
121
122 if ( $conf->exists('cust_main-require_censustract') ) {
123   $opt{censustract} ||= $cust_main->censustract;
124 }
125
126 #my($county_html, $state_html, $country_html) =
127 #  FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
128 #                                        $cust_main->get($pre.'state'),
129 #                                        $cust_main->get($pre.'country'),
130 #                                        $pre,
131 #                                        $onchange,
132 #                                        $disabled,
133 #                                      );
134
135 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
136                   ? 'Day Phone'
137                   : FS::Msgcat::_gettext('daytime');
138 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
139                 ? 'Night Phone'
140                 : FS::Msgcat::_gettext('night') || 'Night Phone';
141 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
142                   ? 'Driver&rsquo;s License'
143                   : FS::Msgcat::_gettext('stateid') || 'Driver&rsquo;s License';
144 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
145                         ? 'Driver&rsquo;s License State'
146                         : FS::Msgcat::_gettext('stateid_state') || 'Driver&rsquo;s License State';
147
148 my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
149
150 </%init>