From 51bf0e9b404cd6e4ae84435230447619269f77c0 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 2 Apr 2007 15:49:37 +0000 Subject: [PATCH] ticket 1528 add driver's license field, mask it and ssn --- FS/FS/Conf.pm | 7 ++++++ FS/FS/Schema.pm | 2 ++ FS/FS/Setup.pm | 8 ++++++ FS/FS/cust_main.pm | 18 ++++++++++++++ httemplate/edit/cust_main/contact.html | 33 ++++++++++++++++++++++--- httemplate/edit/process/cust_main.cgi | 6 +++++ httemplate/view/cust_main/contacts.html | 16 +++++++++++- 7 files changed, 86 insertions(+), 4 deletions(-) diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 5f7cb8fec..22e193215 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -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', diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index e0fef9126..85ad94531 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -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, '', '', diff --git a/FS/FS/Setup.pm b/FS/FS/Setup.pm index 4864cfea8..17101a745 100644 --- a/FS/FS/Setup.pm +++ b/FS/FS/Setup.pm @@ -475,6 +475,14 @@ sub msgcat_messages { 'en_US' => 'Title', }, + 'stateid' => { + 'en_US' => 'Driver\'s License', + }, + + 'stateid_state' => { + 'en_US' => 'Driver\'s License State', + }, + ); } diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index d437db694..80111da0e 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -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 diff --git a/httemplate/edit/cust_main/contact.html b/httemplate/edit/cust_main/contact.html index e813986cd..6efad4405 100644 --- a/httemplate/edit/cust_main/contact.html +++ b/httemplate/edit/cust_main/contact.html @@ -9,10 +9,10 @@ % if ( $conf->exists('show_ss') && !$pre ) { SS# - + % } elsif ( !$pre ) { - + % } @@ -84,14 +84,36 @@ +% if ( $conf->exists('show_stateid') && !$pre ) { + + + <% $stateid_label %> + > + <% $stateid_state_label %> + <% include('select-state.html', 'state' => $cust_main->stateid_state, + 'country' => $cust_main->country, + 'prefix' => 'stateid_', + 'onchange' => $onchange, + 'disabled' => $disabled) %> + +% } elsif ( !$pre ) { + + + +% } + <%$r%>required fields
<%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’s License'; +my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') || 'Driver’s License State'; my $r = qq!* !; diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi index a4a70ca22..b270fc661 100755 --- a/httemplate/edit/process/cust_main.cgi +++ b/httemplate/edit/process/cust_main.cgi @@ -161,6 +161,12 @@ % && $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); % } diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index d5788c9a4..22594c5e2 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -14,7 +14,7 @@ % if ( $which eq '' && $conf->exists('show_ss') ) { SS# - <% $cust_main->ss || ' ' %> + <% $cust_main->masked('ss') || ' ' %> % } @@ -75,6 +75,14 @@ <% $cust_main->get("${pre}fax") || ' ' %> +% if ( $which eq '' && $conf->exists('show_stateid') ) { + + <% $stateid_label %> + <% $cust_main->masked('stateid') || ' ' %> + <% $stateid_state_label %> + <% $cust_main->stateid_state || ' ' %> + +% } % if ( $which ne 'ship_' ) {
@@ -89,6 +97,12 @@ my $daytime_label = FS::Msgcat::_gettext('daytime') =~ /^(daytime)?$/ my $night_label = FS::Msgcat::_gettext('night') =~ /^(night)?$/ ? 'Night Phone' : FS::Msgcat::_gettext('night'); +my $stateid_label = FS::Msgcat::_gettext('stateid') =~ /^(stateid)?$/ + ? 'Driver’s License' + : FS::Msgcat::_gettext('stateid'); +my $stateid_state_label = FS::Msgcat::_gettext('stateid_state') =~ /^(stateid_state)?$/ + ? 'Driver’s License State' + : FS::Msgcat::_gettext('stateid_state'); <%init> -- 2.20.1