ticket 1528 add driver's license field, mask it and ssn
authorjeff <jeff>
Mon, 2 Apr 2007 15:49:37 +0000 (15:49 +0000)
committerjeff <jeff>
Mon, 2 Apr 2007 15:49:37 +0000 (15:49 +0000)
FS/FS/Conf.pm
FS/FS/Schema.pm
FS/FS/Setup.pm
FS/FS/cust_main.pm
httemplate/edit/cust_main/contact.html
httemplate/edit/process/cust_main.cgi
httemplate/view/cust_main/contacts.html

index 5f7cb8f..22e1932 100644 (file)
@@ -1181,6 +1181,13 @@ httemplate/docs/config.html
     'type'        => 'checkbox',
   },
 
+  {
+    'key'         => 'show_stateid',
+    'section'     => 'UI',
+    'description' => 'Turns on display/collection of state issued id numbers in the web interface.',
+    'type'        => 'checkbox',
+  },
+
   { 
     'key'         => 'agent_defaultpkg',
     'section'     => 'UI',
index e0fef91..85ad945 100644 (file)
@@ -408,6 +408,8 @@ sub tables_hashref {
 #        'middle',   'varchar', 'NULL', $char_d, '', '', 
         'first',    'varchar', '',     $char_d, '', '', 
         'ss',       'varchar', 'NULL', 11, '', '', 
+        'stateid', 'varchar', 'NULL', $char_d, '', '', 
+        'stateid_state', 'varchar', 'NULL', $char_d, '', '', 
         'birthdate' ,@date_type, '', '', 
         'signupdate',@date_type, '', '', 
         'company',  'varchar', 'NULL', $char_d, '', '', 
index 4864cfe..17101a7 100644 (file)
@@ -475,6 +475,14 @@ sub msgcat_messages {
       'en_US' => 'Title',
     },
 
+    'stateid' => {
+      'en_US' => 'Driver\'s License',
+    },
+
+    'stateid_state' => {
+      'en_US' => 'Driver\'s License State',
+    },
+
   );
 }
 
index d437db6..80111da 100644 (file)
@@ -1219,6 +1219,8 @@ sub check {
     || $self->ut_country('country')
     || $self->ut_anything('comments')
     || $self->ut_numbern('referral_custnum')
+    || $self->ut_textn('stateid')
+    || $self->ut_textn('stateid_state')
   ;
   #barf.  need message catalogs.  i18n.  etc.
   $error .= "Please select an advertising source."
@@ -4141,6 +4143,22 @@ sub fuzzy_search {
 
 }
 
+=item masked FIELD
+
+Returns a masked version of the named field
+
+=cut
+
+sub masked {
+my ($self,$field) = @_;
+
+# Show last four
+
+'x'x(length($self->getfield($field))-4).
+  substr($self->getfield($field), (length($self->getfield($field))-4));
+
+}
+
 =back
 
 =head1 SUBROUTINES
index e813986..6efad44 100644 (file)
@@ -9,10 +9,10 @@
 % if ( $conf->exists('show_ss') && !$pre ) { 
 
   <TD ALIGN="right">SS#</TD>
-  <TD><INPUT TYPE="text" NAME="ss" VALUE="<% $cust_main->ss %>" SIZE=11></TD>
+  <TD><INPUT TYPE="text" NAME="ss" VALUE="<% $opt{ss} %>" SIZE=11></TD>
 % } elsif ( !$pre ) { 
 
-  <TD><INPUT TYPE="hidden" NAME="ss" VALUE="<% $cust_main->ss %>"></TD>
+  <TD><INPUT TYPE="hidden" NAME="ss" VALUE="<% $opt{ss} %>"></TD>
 % } 
 
 
   </TD>
 </TR>
 
+% if ( $conf->exists('show_stateid') && !$pre ) { 
+
+<TR>
+  <TD ALIGN="right"><% $stateid_label %></TD>
+  <TD><INPUT TYPE="text" NAME="stateid" VALUE="<% $opt{stateid} %>" SIZE=12 onChange="<% $onchange %>" <%$disabled%>></TD>
+  <TD ALIGN="right"><% $stateid_state_label %></TD>
+  <TD><% include('select-state.html', 'state' => $cust_main->stateid_state,
+                                      'country' => $cust_main->country,
+                                      'prefix'  => 'stateid_',
+                                      'onchange' => $onchange,
+                                      'disabled' => $disabled) %></TD>
+</TR>
+% } elsif ( !$pre ) { 
+
+  <TD><INPUT TYPE="hidden" NAME="stateid" VALUE="<% $opt{stateid} %>"></TD>
+  <TD><INPUT TYPE="hidden" NAME="stateid_state" VALUE="<% $cust_main->stateid_state %>"></TD>
+% } 
+
 </TABLE>
 <%$r%>required fields<BR>
 
 <%init>
 
-my( $cust_main, $pre, $onchange, $disabled ) = @_;
+my( $cust_main, $pre, $onchange, $disabled, %opt ) = @_;
 my $conf = new FS::Conf;
 
+foreach (qw(ss stateid)) {
+  $opt{$_} = $cust_main->masked($_) unless exists $opt{$_};
+}
+
 #false laziness with ship state
 my $countrydefault = $conf->config('countrydefault') || 'US';
 $cust_main->set($pre.'country', $countrydefault )
@@ -103,6 +125,9 @@ $cust_main->set($pre.'state', $statedefault )
   unless $cust_main->get($pre.'state')
          || $cust_main->get($pre.'country') ne $countrydefault;
 
+$cust_main->set('stateid_state', $cust_main->state )
+  unless $pre || $cust_main->get('stateid_state');
+
 #my($county_html, $state_html, $country_html) =
 #  FS::cust_main_county::regionselector( $cust_main->get($pre.'county'),
 #                                        $cust_main->get($pre.'state'),
@@ -128,6 +153,8 @@ my $county_style = scalar(@counties) > 1 ? '' : 'STYLE="visibility:hidden"';
 
 my $daytime_label = FS::Msgcat::_gettext('daytime') || 'Day Phone';
 my $night_label = FS::Msgcat::_gettext('night') || 'Night Phone';
+my $stateid_label = FS::Msgcat::_gettext('stateid') || 'Driver&rsquo;s License';
+my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') || 'Driver&rsquo;s License State';
 
 my $r = qq!<font color="#ff0000">*</font>&nbsp;!;
 
index a4a70ca..b270fc6 100755 (executable)
 %       && $new->paycvv =~ /^\s*\*+\s*$/ ) {
 %    $new->paycvv($old->paycvv);
 %  }
+%  if ($new->ss =~ /xx/) {
+%    $new->ss($old->ss);
+%  }
+%  if ($new->stateid =~ /^xxx/) {
+%    $new->stateid($old->stateid);
+%  }
 %  if ($new->payby =~ /^(CARD|DCRD|CHEK|DCHK)$/ && $new->payinfo =~ /xx/) {
 %    $new->payinfo($old->payinfo);
 %  }
index d5788c9..22594c5 100644 (file)
@@ -14,7 +14,7 @@
   </TD>
 % if ( $which eq '' && $conf->exists('show_ss') ) { 
     <TD ALIGN="right">SS#</TD>
-    <TD BGCOLOR="#ffffff"><% $cust_main->ss || '&nbsp' %></TD>
+    <TD BGCOLOR="#ffffff"><% $cust_main->masked('ss') || '&nbsp' %></TD>
 % } 
 </TR>
 <TR>
     <% $cust_main->get("${pre}fax") || '&nbsp' %>
   </TD>
 </TR>
+% if ( $which eq '' && $conf->exists('show_stateid') ) { 
+  <TR>
+    <TD ALIGN="right"><% $stateid_label %></TD>
+    <TD BGCOLOR="#ffffff"><% $cust_main->masked('stateid') || '&nbsp' %></TD>
+    <TD ALIGN="right"><% $stateid_state_label %></TD>
+    <TD BGCOLOR="#ffffff"><% $cust_main->stateid_state || '&nbsp' %></TD>
+  </TR>
+% } 
 </TABLE></TD></TR></TABLE>
 % if ( $which ne 'ship_' ) {
 <BR>
@@ -89,6 +97,12 @@ my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/
 my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/
                       ? 'Night&nbsp;Phone'
                       : FS::Msgcat::_gettext('night');
+my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/
+                      ? 'Driver&rsquo;s&nbsp;License'
+                      : FS::Msgcat::_gettext('stateid');
+my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/
+                      ? 'Driver&rsquo;s&nbsp;License State'
+                      : FS::Msgcat::_gettext('stateid_state');
 
 </%once>
 <%init>