add cust_main.mobile and ship_mobile to support uniserve portal, RT#13656
[freeside.git] / httemplate / edit / cust_main / contact.html
1 <% &ntable("#cccccc") %>
2
3 <TR>
4   <TH ALIGN="right"><%$r%><% mt('Contact name (last, first)') |h %></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"><% mt('SS#') |h %></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 % if ( $conf->exists('cust-email-high-visibility') && !$pre ) {
22     <TR>
23       <TD ALIGN="right" WIDTH="200">
24         <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es)
25       </TD>
26       <TD bgcolor="#FFFF00">
27         <INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>">
28       </TD>
29     </TR>
30 % }
31
32 % unless ( $conf->exists('cust-edit-alt-field-order') ) {
33 <TR>
34   <TD ALIGN="right"><% mt('Company') |h %></TD>
35   <TD COLSPAN=7>
36     <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
37   </TD>
38 </TR>
39
40 <& /elements/location.html,
41              'prefix'       => $pre,
42              'object'       => $cust_main,
43              'onchange'     => $onchange,
44              'disabled'     => $disabled,
45              'style'        => \@style,
46              'same_checked' => $opt{'same_checked'},
47              'geocode'      => $opt{'geocode'},
48              'censustract'  => $opt{'censustract'},
49 &>
50
51 <TR>
52   <TD ALIGN="right"><% $daytime_label %></TD>
53   <TD COLSPAN=5>
54     <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
55   </TD>
56 </TR>
57
58 <TR>
59   <TD ALIGN="right"><% $night_label %></TD>
60   <TD COLSPAN=5>
61     <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
62   </TD>
63 </TR>
64
65 <TR>
66   <TD ALIGN="right"><% $mobile_label %></TD>
67   <TD COLSPAN=5>
68     <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
69   </TD>
70 </TR>
71
72 <TR>
73   <TD ALIGN="right"><% mt('Fax') |h %></TD>
74   <TD COLSPAN=5>
75     <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
76   </TD>
77 </TR>
78
79 % } else {
80
81 <TR>
82   <TD ALIGN="right"><% $daytime_label %></TD>
83   <TD COLSPAN=5>
84     <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
85   </TD>
86 </TR>
87
88 <TR>
89   <TD ALIGN="right"><% $night_label %></TD>
90   <TD COLSPAN=5>
91     <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
92   </TD>
93 </TR>
94
95 <TR>
96   <TD ALIGN="right"><% $mobile_label %></TD>
97   <TD COLSPAN=5>
98     <INPUT TYPE="text" NAME="<%$pre%>mobile" VALUE="<% $cust_main->get($pre.'mobile') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
99   </TD>
100 </TR>
101
102 <& /elements/location.html,
103              'prefix'       => $pre,
104              'object'       => $cust_main,
105              'onchange'     => $onchange,
106              'disabled'     => $disabled,
107              'style'        => \@style,
108              'same_checked' => $opt{'same_checked'},
109              'geocode'      => $opt{'geocode'},
110              'censustract'  => $opt{'censustract'},
111 &>
112
113 <TR>
114   <TD ALIGN="right"><% mt('Fax') |h %></TD>
115   <TD COLSPAN=5>
116     <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
117   </TD>
118 </TR>
119
120 <TR>
121   <TD ALIGN="right"><% mt('Company') |h %></TD>
122   <TD COLSPAN=7>
123     <INPUT TYPE="text" NAME="<%$pre%>company" VALUE="<% $cust_main->get($pre.'company') |h %>" SIZE=70 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
124   </TD>
125 </TR>
126
127 % }
128
129 % if ( $conf->exists('show_stateid') && !$pre ) { 
130
131 <TR>
132   <TD ALIGN="right"><% $stateid_label %></TD>
133   <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>></TD>
134   <TD ALIGN="right"><% $stateid_state_label %></TD>
135   <TD><& /elements/select-state.html,
136                    'state'    => $cust_main->stateid_state,
137                    'country'  => $cust_main->country,
138                    'prefix'   => 'stateid_',
139                    'onchange' => $onchange,
140                    'disabled' => $disabled,
141                    'style'    => \@style,
142       &>
143   </TD>
144 </TR>
145 % } elsif ( !$pre ) { 
146
147   <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
148   <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
149 % } 
150
151 </TABLE>
152 <%$r%><% mt('required fields') |h %><BR>
153
154 <%init>
155
156 my %opt = @_;
157 my $cust_main = $opt{'cust_main'};
158 my $pre       = $opt{'pre'};
159 my $onchange  = $opt{'onchange'};
160 my $disabled  = $opt{'disabled'};
161 my @style     = ( $opt{'style'} ? @{ $opt{'style'} } : () );
162
163 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
164
165 my $conf = new FS::Conf;
166
167 foreach (qw(ss stateid)) {
168   $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
169 }
170
171 #false laziness with ship state
172 my $countrydefault = $conf->config('countrydefault') || 'US';
173 $cust_main->set($pre.'country', $countrydefault )
174   unless $cust_main->get($pre.'country');
175
176 my $statedefault = $conf->config('statedefault')
177                    || ($countrydefault eq 'US' ? 'CA' : '');
178 $cust_main->set($pre.'state', $statedefault )
179   unless $cust_main->get($pre.'state')
180          || $cust_main->get($pre.'country') ne $countrydefault;
181
182 $cust_main->set('stateid_state', $cust_main->state )
183   unless $pre || $cust_main->get('stateid_state');
184
185 $opt{geocode} ||= $cust_main->get('geocode');
186
187 if ( $conf->exists('cust_main-require_censustract') ) {
188   $opt{censustract} ||= $cust_main->censustract;
189 }
190
191 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
192                       ? 'Day Phone'
193                       : FS::Msgcat::_gettext('daytime');
194 my $night_label   = FS::Msgcat::_gettext('night') =~/^(night)?$/
195                       ? 'Night Phone'
196                       : FS::Msgcat::_gettext('night') || 'Night Phone';
197 my $mobile_label = FS::Msgcat::_gettext('mobile') =~/^(mobile)?$/
198                       ? 'Mobile Phone'
199                       : FS::Msgcat::_gettext('mobile') || 'Mobile Phone';
200
201 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
202                   ? 'Driver&rsquo;s License'
203                   : FS::Msgcat::_gettext('stateid') || 'Driver&rsquo;s License';
204 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
205                         ? 'Driver&rsquo;s License State'
206                         : FS::Msgcat::_gettext('stateid_state') || 'Driver&rsquo;s License State';
207
208 my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
209
210 my @invoicing_list = $cust_main->invoicing_list;
211
212 </%init>