[freeside-commits] freeside/rt/lib/RT Ticket_Overlay.pm, 1.1.1.6.2.1, 1.1.1.6.2.2

Ivan,,, ivan at wavetail.420.am
Sun Mar 23 20:08:15 PDT 2008


Update of /home/cvs/cvsroot/freeside/rt/lib/RT
In directory wavetail.420.am:/tmp/cvs-serv11907/lib/RT

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	Ticket_Overlay.pm 
Log Message:
woo!  final part of #1160!  yup, auto-associating tickets with customers now.  whew!

Index: Ticket_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Ticket_Overlay.pm,v
retrieving revision 1.1.1.6.2.1
retrieving revision 1.1.1.6.2.2
diff -u -d -r1.1.1.6.2.1 -r1.1.1.6.2.2
--- Ticket_Overlay.pm	3 Mar 2008 23:07:46 -0000	1.1.1.6.2.1
+++ Ticket_Overlay.pm	24 Mar 2008 03:08:11 -0000	1.1.1.6.2.2
@@ -690,6 +690,43 @@
 
     # }}}
 
+    # {{{ Deal with auto-customer association
+
+    #unless we already have (a) customer(s)...
+    unless ( $self->Customers->Count ) {
+
+      #find any requestors with customer targets
+  
+      my %cust_target = ();
+  
+      my @Requestors =
+        grep { $_->Customers->Count }
+             @{ $self->Requestors->UserMembersObj->ItemsArrayRef };
+  
+      foreach my $Requestor ( @Requestors ) {
+        foreach my $cust_link ( @{ $Requestor->Customers->ItemsArrayRef } ) {
+          $cust_target{ $cust_link->Target } = 1;
+        }
+      }
+  
+      #and then auto-associate this ticket with those customers
+  
+      foreach my $cust_target ( keys %cust_target ) {
+  
+        my @link = ( 'Type'   => 'MemberOf',
+                     #'Target' => "freeside://freeside/cust_main/$custnum",
+                     'Target' => $cust_target,
+                   );
+  
+        my( $val, $msg ) = $self->AddLink(@link);
+        push @non_fatal_errors, $msg;
+  
+      }
+
+    }
+
+    # }}}
+
     # {{{ Add all the custom fields
 
     foreach my $arg ( keys %args ) {



More information about the freeside-commits mailing list