[freeside-commits] freeside/rt/lib/RT Ticket_Overlay.pm,1.2,1.3
Ivan,,,
ivan at wavetail.420.am
Tue Apr 1 01:43:35 PDT 2008
Update of /home/cvs/cvsroot/freeside/rt/lib/RT
In directory wavetail.420.am:/tmp/cvs-serv16811/rt/lib/RT
Modified Files:
Ticket_Overlay.pm
Log Message:
last bit of magic for RT ticket customer auto-association: look for requestor email addresses in cust_main_invoice and svc_acct, closes; RT#1160
Index: Ticket_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Ticket_Overlay.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- Ticket_Overlay.pm 24 Mar 2008 03:08:00 -0000 1.2
+++ Ticket_Overlay.pm 1 Apr 2008 08:43:32 -0000 1.3
@@ -721,6 +721,31 @@
#unless we already have (a) customer(s)...
unless ( $self->Customers->Count ) {
+ #first find any requestors with emails but *without* customer targets
+ my @NoCust_Requestors =
+ grep { $_->EmailAddress && ! $_->Customers->Count }
+ @{ $self->Requestors->UserMembersObj->ItemsArrayRef };
+
+ for my $Requestor (@NoCust_Requestors) {
+
+ #perhaps the stuff in here should be in a User method??
+ my @Customers =
+ &RT::URI::freeside::email_search( email=>$Requestor->EmailAddress );
+
+ foreach my $custnum ( map $_->{'custnum'}, @Customers ) {
+
+ ## false laziness w/RT/Interface/Web_Vendor.pm
+ my @link = ( 'Type' => 'MemberOf',
+ 'Target' => "freeside://freeside/cust_main/$custnum",
+ );
+
+ my( $val, $msg ) = $Requestor->AddLink(@link);
+ #XXX should do something with $msg# push @non_fatal_errors, $msg;
+
+ }
+
+ }
+
#find any requestors with customer targets
my %cust_target = ();
More information about the freeside-commits
mailing list