From 381992561d7b1a88e05d49d3e474a2fad25873c7 Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Wed, 13 Jun 2018 02:25:09 -0500 Subject: RT# 32234 Allow unmask of SSN/DL# --- FS/FS/AccessRight.pm | 3 +- httemplate/edit/cust_main/name.html | 19 ++++++++- httemplate/edit/cust_main/stateid.html | 7 +++- httemplate/elements/link-replace_element_text.html | 45 ++++++++++++++++++++++ httemplate/view/cust_main/contacts.html | 30 +++++++++++++-- 5 files changed, 96 insertions(+), 8 deletions(-) create mode 100644 httemplate/elements/link-replace_element_text.html diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm index 471e32aff..1b581b247 100644 --- a/FS/FS/AccessRight.pm +++ b/FS/FS/AccessRight.pm @@ -156,6 +156,8 @@ tie my %rights, 'Tie::IxHash', 'View package definition costs', #NEWNEW 'Change package start date', 'Change package contract end date', + 'Unmask customer DL', + 'Unmask customer SSN', ], ### @@ -509,4 +511,3 @@ L, L, L =cut 1; - diff --git a/httemplate/edit/cust_main/name.html b/httemplate/edit/cust_main/name.html index 713f54cdb..c1078d46a 100644 --- a/httemplate/edit/cust_main/name.html +++ b/httemplate/edit/cust_main/name.html @@ -1,7 +1,17 @@ <%def .namepart> -% my ($field, $value, $label, $extra) = @_; +% my ($field, $value, $label, $extra, $unmask_field) = @_;
> +% if ( +% ref $unmask_field +% && !$unmask_field->{unmask_ss} +% && $FS::CurrentUser::CurrentUser->access_right( $unmask_field->{access_right} ) +% ) { + <& /elements/link-replace_element_text.html, { + target_id => $unmask_field->{target_id}, + replace_text => $unmask_field->{replace_text}, + } &> +% }
<% emt($label) %>
@@ -13,7 +23,12 @@ <& .namepart, 'first', $cust_main->first, 'First' &> % if ( $conf->exists('show_ss') ) {   - <& .namepart, 'ss', $ss, 'SS#', "SIZE=11" &> + <& .namepart, 'ss', $ss, 'SS#', "SIZE=11 ID='ss'", { + target_id => 'ss', + replace_text => $cust_main->ss, + access_right => 'Unmask customer SSN', + unmask_ss => $conf->exists('unmask_ss'), + } &> % } else { % } diff --git a/httemplate/edit/cust_main/stateid.html b/httemplate/edit/cust_main/stateid.html index 3500d631c..cc0890fe1 100644 --- a/httemplate/edit/cust_main/stateid.html +++ b/httemplate/edit/cust_main/stateid.html @@ -1,7 +1,12 @@ % if ( $conf->exists('show_stateid') ) { <% $stateid_label %> - + + +% if ( $FS::CurrentUser::CurrentUser->access_right( 'Unmask customer DL' )) { + <& /elements/link-replace_element_text.html, {target_id => 'stateid', replace_text => $cust_main->stateid} &> +% } + <& /elements/select-state.html, state => $cust_main->stateid_state, country => $cust_main->country, # how does this work on new customer? diff --git a/httemplate/elements/link-replace_element_text.html b/httemplate/elements/link-replace_element_text.html new file mode 100644 index 000000000..8e611954c --- /dev/null +++ b/httemplate/elements/link-replace_element_text.html @@ -0,0 +1,45 @@ +<%doc> + +Display a link with javascript to replace text within a element. + +Usage: + +<& /elements/link-replace_element_text.html, { + target_id => 'input_id', + replace_text => 'hello', + + element_type => 'input', # Uses jquery val() method to replace text + element_type => 'div', # Uses jquery text() method to replace text + + href => ... + style => ... + class => ... + } +&> + + + +<%init> + +die "template call requires a parameter hashref" unless ref $_[0]; + +# Defaults that can be overridden in param hashref +my %param = ( + target_id => 'SPECIFY_AN_INPUT_ELEMENT_ID', + replace_text => 'REPLACEMENT_TEXT_FOR_INPUT_ELEMENT', + element_type => 'input', + + link_text => '%#x25C1;', # ◁ + href => 'javascript:void(0)', + style => 'text-decoration:none;', + class => undef, + + %{ $_[0] }, +); +$param{jmethod} = $param{element_type} eq 'input' ? 'val' : 'text'; + diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html index 1660c1c22..367659293 100644 --- a/httemplate/view/cust_main/contacts.html +++ b/httemplate/view/cust_main/contacts.html @@ -29,9 +29,20 @@ <% $cust_main->contact |h %> % if ( $conf->exists('show_ss') ) { <% mt('SS#') |h %> - <% $conf->exists('unmask_ss') - ? $cust_main->ss - : $cust_main->masked('ss') || ' ' %> + + + <% $conf->exists('unmask_ss') + ? $cust_main->ss + : $cust_main->masked('ss') || ' ' %> +% if ( !$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, + element_type => 'span' + } &> +% } + + % } % if ( $conf->exists('cust_main-enable_spouse') and @@ -172,7 +183,18 @@ <% $stateid_label %> - <% $cust_main->masked('stateid') || ' ' %> + + + <% $cust_main->masked('stateid') || ' ' %> +% if ( $FS::CurrentUser::CurrentUser->access_right('Unmask customer DL')) { + <& /elements/link-replace_element_text.html, { + target_id => 'stateid_span', + replace_text => $cust_main->stateid, + element_type => 'span' + } &> +% } + + <% $stateid_state_label %> <% $cust_main->stateid_state || ' ' %> -- cgit v1.2.1 From 965826f80175e6e09b851bdd119e955b6c3783d4 Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Thu, 14 Jun 2018 14:46:38 -0500 Subject: RT# 80543 Crash creating new quotation --- FS/FS/Template_Mixin.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index b9514fee1..578e5a192 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -3139,7 +3139,9 @@ sub _items_fee { my @cust_bill_pkg = grep { $_->feepart } $self->cust_bill_pkg; my $escape_function = $options{escape_function}; - my $locale = $self->cust_main->locale; + my $locale = $self->quotationnum + ? $self->prospect_main->locale + : $self->cust_main->locale; my @items; foreach my $cust_bill_pkg (@cust_bill_pkg) { -- cgit v1.2.1 From b4883ac11a0ddabd2b78a7451fe3634f9510f5f7 Mon Sep 17 00:00:00 2001 From: Mitch Jackson Date: Thu, 14 Jun 2018 16:31:42 -0500 Subject: RT# 31964 Display more information on prospect contacts --- httemplate/search/prospect_main.html | 1 - httemplate/view/prospect_main.html | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/httemplate/search/prospect_main.html b/httemplate/search/prospect_main.html index d65d4d19d..0eb45f338 100644 --- a/httemplate/search/prospect_main.html +++ b/httemplate/search/prospect_main.html @@ -17,7 +17,6 @@ } $pm->prospect_contact ]; - '' }, sub { my $pr = shift->part_referral; diff --git a/httemplate/view/prospect_main.html b/httemplate/view/prospect_main.html index f4dd4146f..504a5a8ec 100644 --- a/httemplate/view/prospect_main.html +++ b/httemplate/view/prospect_main.html @@ -24,8 +24,21 @@ % foreach my $prospect_contact ( $prospect_main->prospect_contact ) { % my $contact = $prospect_contact->contact; - <% $prospect_contact->contact_classname %> Contact - <% $contact->line %> + <% $prospect_contact->contact_classname %> Contact + + <% $contact->line %>
+ +% for my $row ( $contact->contact_email ) { + +% } +% for my $row ( $contact->contact_phone ) { + +% } +% if ( $prospect_contact->comment ) { + +% } +
E-Mail:<% $row->emailaddress %>
<% $row->phone_type->typename %>:<% $row->phonenum_pretty %>
Comment:<% $prospect_contact->comment %>
+ %} -- cgit v1.2.1