diff options
author | ivan <ivan> | 2008-03-24 03:08:00 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-03-24 03:08:00 +0000 |
commit | 6ad0603afe8119536b21f65f06c3ff13f243170f (patch) | |
tree | 6aff820e9567f426df651296624231f519c8c55d /rt/lib/RT/Ticket_Overlay.pm | |
parent | bce1161205c0f249865482972475a7e7b3f590e6 (diff) |
woo! final part of #1160! yup, auto-associating tickets with customers now. whew!
Diffstat (limited to 'rt/lib/RT/Ticket_Overlay.pm')
-rw-r--r-- | rt/lib/RT/Ticket_Overlay.pm | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/rt/lib/RT/Ticket_Overlay.pm b/rt/lib/RT/Ticket_Overlay.pm index b4e3259f1..1916bc463 100644 --- a/rt/lib/RT/Ticket_Overlay.pm +++ b/rt/lib/RT/Ticket_Overlay.pm @@ -716,6 +716,43 @@ sub Create { # }}} + # {{{ 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 ) { |