[freeside-commits] branch master updated. dc9d1bf1200065b9c34fd2aca4ebbfc642e22b52

Christopher Burger burgerc at 420.am
Thu Jul 20 06:30:24 PDT 2017


The branch, master has been updated
       via  dc9d1bf1200065b9c34fd2aca4ebbfc642e22b52 (commit)
      from  d10a3e73a1c3e46f2c784d2aa4e7b3e621c336e2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dc9d1bf1200065b9c34fd2aca4ebbfc642e22b52
Author: Christopher Burger <burgerc at freeside.biz>
Date:   Thu Jul 20 09:29:45 2017 -0400

    RT# 38517 - added auto create of customer contact, if requestor is not a contact yet when adding a company to ticket.

diff --git a/rt/lib/RT/Interface/Web_Vendor.pm b/rt/lib/RT/Interface/Web_Vendor.pm
index ea3a498..da0b189 100644
--- a/rt/lib/RT/Interface/Web_Vendor.pm
+++ b/rt/lib/RT/Interface/Web_Vendor.pm
@@ -164,6 +164,33 @@ sub ProcessTicketCustomers {
         push @results, $msg;
         warn "$me: linking requestor to custnum $custnum: $msg\n"
           if $Debug > 1;
+
+        ## check if FS contact email exists, if not create it.
+        if ( !qsearchs( {
+            'table'     => 'contact_email',
+            'hashref'   => { 'emailaddress' => $Requestor->{'values'}->{'emailaddress'}, },
+           } ) ) {
+             use FS::contact;
+
+             my $lname = $Requestor->{'values'}->{'realname'} ?
+                (split (/ /, $Requestor->{'values'}->{'realname'}))[-1] :
+                'Requestor';
+
+            my $fname = $Requestor->{'values'}->{'realname'} ?
+                (split (/ /, $Requestor->{'values'}->{'realname'}))[0] :
+                'RT';
+
+             my $contact = new FS::contact {
+                'custnum'       => $custnum,
+                'first'         => $fname,
+                'last'          => $lname,
+                'emailaddress'  => $Requestor->{'values'}->{'emailaddress'},
+                'comment'       => 'Auto created from RT requestor',
+             };
+             my $error = $contact->insert;
+             push @results, 'Created Freeside contact for requestor ' . $Requestor->{'values'}->{'emailaddress'}
+             unless $error;
+        }
       }
 
     }

-----------------------------------------------------------------------

Summary of changes:
 rt/lib/RT/Interface/Web_Vendor.pm |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)




More information about the freeside-commits mailing list