summaryrefslogtreecommitdiff
path: root/rt/lib/RT/Ticket_Overlay.pm
diff options
context:
space:
mode:
authorivan <ivan>2008-03-24 03:08:11 +0000
committerivan <ivan>2008-03-24 03:08:11 +0000
commit2e6530efbcd472ebbb2c47346f0c08fbf80e7a6c (patch)
tree6778737ff98d292ec04724e127a7a775979f1d1b /rt/lib/RT/Ticket_Overlay.pm
parentf7696f45691c414aaa3c6fe48ce6e374588009f4 (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.pm37
1 files changed, 37 insertions, 0 deletions
diff --git a/rt/lib/RT/Ticket_Overlay.pm b/rt/lib/RT/Ticket_Overlay.pm
index a294dcafd..e280b09fc 100644
--- a/rt/lib/RT/Ticket_Overlay.pm
+++ b/rt/lib/RT/Ticket_Overlay.pm
@@ -690,6 +690,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 ) {