diff options
| author | Christopher Burger <burgerc@freeside.biz> | 2017-09-18 13:25:39 -0400 | 
|---|---|---|
| committer | Christopher Burger <burgerc@freeside.biz> | 2018-11-20 16:23:12 -0500 | 
| commit | 203aa3dbe95397f85b02e5c626cae1419ca6c9c9 (patch) | |
| tree | 822f762e391a5345baedf3b8c3c29328c795d374 | |
| parent | 747f42e8f7279caa9c50472694dcfa6067e148b7 (diff) | |
RT# 77532 - Updated customer contact reports to display contact phone numers
Conflicts:
	httemplate/search/contact.html
| -rw-r--r-- | httemplate/search/contact.html | 59 | 
1 files changed, 37 insertions, 22 deletions
| diff --git a/httemplate/search/contact.html b/httemplate/search/contact.html index 1ddfabb8b..1f7385866 100644 --- a/httemplate/search/contact.html +++ b/httemplate/search/contact.html @@ -44,30 +44,45 @@ my $dbh = dbh;  my $DEBUG = 0; -my $format_phone_sub = sub { - -  my $pn = $_[0] || return ''; -  $pn =~ s/\D//g; -  my @pn = split //, $pn; - -  return sprintf( -    '(%s) %s-%s', -    join( '', @pn[0..2] ), -    join( '', @pn[3..5] ), -    join( '', @pn[6..9] ) -  ) if @pn == 10; - -  return sprintf( -    '+%s (%s) %s-%s', -    $pn[0], -    join( '', @pn[1..3] ), -    join( '', @pn[4..6] ), -    join( '', @pn[7..10] ) -  ) if @pn == 11 && $pn[0] == 1; - -  encode_entities $_[0]; +my $work_phone_sub = sub { +  my $contact = shift; +  #can't because contactnum is in the wrong field +  my @contact_workphone = qsearch('contact_phone', { 'contactnum' => $contact->contact_contactnum, 'phonetypenum' => '1' } ); +  join(', ', map $_->phonenum, @contact_workphone);  }; +my $mobile_phone_sub = sub { +  my $contact = shift; +  #can't because contactnum is in the wrong field +  my @contact_mobilephone = qsearch('contact_phone', { 'contactnum' => $contact->contact_contactnum, 'phonetypenum' => '3' } ); +  join(', ', map $_->phonenum, @contact_mobilephone); +}; + +my $home_phone_sub = sub { +  my $contact = shift; +  #can't because contactnum is in the wrong field +  my @contact_homephone = qsearch('contact_phone', { 'contactnum' => $contact->contact_contactnum, 'phonetypenum' => '2' } ); +  join(', ', map $_->phonenum, @contact_homephone); +}; + +my $link; #for closure in this sub, we'll define it later +my $contact_classname_sub = sub { +  my $contact = shift; +  my %hash = ( 'contactnum' => $contact->contact_contactnum ); +  my $X_contact; +  if ( $link eq 'cust_main' ) { +    $X_contact = qsearchs('cust_contact', { %hash, 'custnum' => $contact->custnum } ); +  } elsif ( $link eq 'prospect_main' ) { +    $X_contact = qsearchs('prospect_contact', { %hash, 'prospectnum' => $contact->prospectnum } ); +  } else { +    die 'guru meditation #5555'; +  } +  $X_contact->contact_classname; +}; + +my @header = ( 'First', 'Last', 'Title', 'Email', 'Work Phone', 'Mobile Phone', 'Home Phone', 'Type' ); +my @fields = ( 'first', 'last', 'title', $email_sub, $work_phone_sub, $mobile_phone_sub, $home_phone_sub, $contact_classname_sub ); +my @links = ( '', '', '', '', '', '', '', '', );  my @report = ( | 
