RT# 32234 Allow unmask of SSN/DL#
[freeside.git] / httemplate / edit / cust_main / name.html
1 <%def .namepart>
2 % my ($field, $value, $label, $extra, $unmask_field) = @_;
3 <DIV STYLE="display: inline-block" ID="<% $field %>_input">
4   <INPUT TYPE="text" NAME="<% $field %>" VALUE="<% $value |h %>" <%$extra%>>
5 % if (
6 %   ref $unmask_field
7 %   && !$unmask_field->{unmask_ss}
8 %   && $FS::CurrentUser::CurrentUser->access_right( $unmask_field->{access_right} )
9 % ) {
10   <& /elements/link-replace_element_text.html, {
11       target_id    => $unmask_field->{target_id},
12       replace_text => $unmask_field->{replace_text},
13   } &>
14 % }
15   <BR><FONT SIZE="-1" COLOR="#333333"><% emt($label) %></FONT>
16 </DIV>
17 </%def>
18
19 <TR>
20   <TH CLASS="required label" ALIGN="right"><% mt('Contact name') |h %></TD>
21   <TD COLSPAN=6 STYLE="vertical-align:top">
22         <& .namepart, 'last', $cust_main->last, 'Last', ',' &>
23         <& .namepart, 'first', $cust_main->first, 'First' &>
24 % if ( $conf->exists('show_ss') ) {
25         &nbsp;
26         <& .namepart, 'ss', $ss, 'SS#', "SIZE=11 ID='ss'", {
27           target_id    => 'ss',
28           replace_text => $cust_main->ss,
29           access_right => 'Unmask customer SSN',
30           unmask_ss    => $conf->exists('unmask_ss'),
31         } &>
32 % } else  {
33         <INPUT TYPE="hidden" NAME="ss" VALUE="<% $ss %>">
34 % }
35   </TD>
36 </TR>
37 % if ( $conf->exists('cust_main-enable_spouse') ) {
38 <TR ID="spouse_row">
39   <TH CLASS="label" ALIGN="right"><DIV ID="spouse_label"><% mt('Spouse\'s name') |h %></DIV></TD>
40   <TD COLSPAN=6>
41         <& .namepart, 'spouse_last', $cust_main->spouse_last, 'Last', ',' &>
42         <& .namepart, 'spouse_first', $cust_main->spouse_first, 'First' &>
43   </TD>
44 </TR>
45 % }
46
47 <TR>
48   <TH ALIGN="right">
49     <SPAN ID="invoice_email_label" CLASS="
50     <% $conf->exists('cust_main-require_invoicing_list_email', $agentnum)
51         ? 'required label'
52         : 'label' %>">Email address(es)</SPAN>
53   </TH>
54   <TD COLSPAN=6>
55     <INPUT TYPE="text" NAME="invoice_email"  ID="invoice_email_input" SIZE=40
56            VALUE="<% $cust_main->invoicing_list_emailonly_scalar %>">
57   </TD>
58 </TR>
59 <%init>
60 my $cust_main = shift;
61 my $agentnum = $cust_main->agentnum if $cust_main->custnum;
62 my $conf = FS::Conf->new;
63 my $ss;
64
65 if ( $cgi->param('error') or $conf->exists('unmask_ss') ) {
66   $ss = $cust_main->ss;
67 } else {
68   $ss = $cust_main->masked('ss');
69 }
70 </%init>