internationalization/localization, RT12515
[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 <TR>
22   <TD ALIGN="right"><% mt('Company') |h %></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 <& /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 <TR>
40   <TD ALIGN="right"><% $daytime_label %></TD>
41   <TD COLSPAN=5>
42     <INPUT TYPE="text" NAME="<%$pre%>daytime" VALUE="<% $cust_main->get($pre.'daytime') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
43   </TD>
44 </TR>
45
46 <TR>
47   <TD ALIGN="right"><% $night_label %></TD>
48   <TD COLSPAN=5>
49     <INPUT TYPE="text" NAME="<%$pre%>night" VALUE="<% $cust_main->get($pre.'night') %>" SIZE=18 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
50   </TD>
51 </TR>
52
53 <TR>
54   <TD ALIGN="right"><% mt('Fax') |h %></TD>
55   <TD COLSPAN=5>
56     <INPUT TYPE="text" NAME="<%$pre%>fax" VALUE="<% $cust_main->get($pre.'fax') %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>>
57   </TD>
58 </TR>
59
60 % if ( $conf->exists('show_stateid') && !$pre ) { 
61
62 <TR>
63   <TD ALIGN="right"><% $stateid_label %></TD>
64   <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%> <%$style%>></TD>
65   <TD ALIGN="right"><% $stateid_state_label %></TD>
66   <TD><& /elements/select-state.html,
67                    'state'    => $cust_main->stateid_state,
68                    'country'  => $cust_main->country,
69                    'prefix'   => 'stateid_',
70                    'onchange' => $onchange,
71                    'disabled' => $disabled,
72                    'style'    => \@style,
73       &>
74   </TD>
75 </TR>
76 % } elsif ( !$pre ) { 
77
78   <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
79   <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
80 % } 
81
82 </TABLE>
83 <%$r%><% mt('required fields') |h %><BR>
84
85 <%init>
86
87 my %opt = @_;
88 my $cust_main = $opt{'cust_main'};
89 my $pre       = $opt{'pre'};
90 my $onchange  = $opt{'onchange'};
91 my $disabled  = $opt{'disabled'};
92 my @style     = ( $opt{'style'} ? @{ $opt{'style'} } : () );
93
94 my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';
95
96 my $conf = new FS::Conf;
97
98 foreach (qw(ss stateid)) {
99   $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
100 }
101
102 #false laziness with ship state
103 my $countrydefault = $conf->config('countrydefault') || 'US';
104 $cust_main->set($pre.'country', $countrydefault )
105   unless $cust_main->get($pre.'country');
106
107 my $statedefault = $conf->config('statedefault')
108                    || ($countrydefault eq 'US' ? 'CA' : '');
109 $cust_main->set($pre.'state', $statedefault )
110   unless $cust_main->get($pre.'state')
111          || $cust_main->get($pre.'country') ne $countrydefault;
112
113 $cust_main->set('stateid_state', $cust_main->state )
114   unless $pre || $cust_main->get('stateid_state');
115
116 $opt{geocode} ||= $cust_main->get('geocode');
117
118 if ( $conf->exists('cust_main-require_censustract') ) {
119   $opt{censustract} ||= $cust_main->censustract;
120 }
121
122 my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
123                   ? 'Day Phone'
124                   : FS::Msgcat::_gettext('daytime');
125 my $night_label = FS::Msgcat::_gettext('night') =~/^(night)?$/
126                 ? 'Night Phone'
127                 : FS::Msgcat::_gettext('night') || 'Night Phone';
128 my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
129                   ? 'Driver&rsquo;s License'
130                   : FS::Msgcat::_gettext('stateid') || 'Driver&rsquo;s License';
131 my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
132                         ? 'Driver&rsquo;s License State'
133                         : FS::Msgcat::_gettext('stateid_state') || 'Driver&rsquo;s License State';
134
135 my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
136
137 </%init>