RT# 32233 Show unmask widget only if a value exists to unmask
authorMitch Jackson <mitch@freeside.biz>
Sat, 16 Jun 2018 02:14:44 +0000 (21:14 -0500)
committerMitch Jackson <mitch@freeside.biz>
Sat, 16 Jun 2018 02:16:26 +0000 (21:16 -0500)
httemplate/edit/cust_main/name.html
httemplate/edit/cust_main/stateid.html
httemplate/view/cust_main/contacts.html

index c1078d4..120475b 100644 (file)
@@ -3,7 +3,8 @@
 <DIV STYLE="display: inline-block" ID="<% $field %>_input">
   <INPUT TYPE="text" NAME="<% $field %>" VALUE="<% $value |h %>" <%$extra%>>
 % if (
-%   ref $unmask_field
+%   $value
+%   && ref $unmask_field
 %   && !$unmask_field->{unmask_ss}
 %   && $FS::CurrentUser::CurrentUser->access_right( $unmask_field->{access_right} )
 % ) {
index cc0890f..0f28809 100644 (file)
@@ -3,7 +3,7 @@
   <TH ALIGN="right"><% $stateid_label %></TH>
   <TD>
     <INPUT TYPE="text" NAME="stateid" VALUE="<% $stateid %>" SIZE=12 ID="stateid">
-% if ( $FS::CurrentUser::CurrentUser->access_right( 'Unmask customer DL' )) {
+% if ( $stateid && $FS::CurrentUser::CurrentUser->access_right( 'Unmask customer DL' )) {
     <& /elements/link-replace_element_text.html, {target_id => 'stateid', replace_text => $cust_main->stateid} &>
 % }
   </TD>
index 3676592..11efcd5 100644 (file)
       <% $conf->exists('unmask_ss')
            ? $cust_main->ss
            : $cust_main->masked('ss') || '&nbsp;' %>
-%   if ( !$conf->exists('unmask_ss') && $FS::CurrentUser::CurrentUser->access_right('Unmask customer SSN')) {
+%   if (
+%         $cust_main->ss
+%         && !$conf->exists('unmask_ss')
+%         && $FS::CurrentUser::CurrentUser->access_right('Unmask customer SSN')
+%   ) {
       <& /elements/link-replace_element_text.html, {
            target_id    => 'ss_span',
            replace_text => $cust_main->ss,
     <TD>
       <span id="stateid_span" style="white-space:nowrap;">
       <% $cust_main->masked('stateid') || '&nbsp' %>
-%   if ( $FS::CurrentUser::CurrentUser->access_right('Unmask customer DL')) {
+%   if (
+%         $cust_main->stateid
+%         && $FS::CurrentUser::CurrentUser->access_right('Unmask customer DL')
+%   ) {
       <& /elements/link-replace_element_text.html, {
            target_id => 'stateid_span',
            replace_text => $cust_main->stateid,