[Rt-commit] r9026 - rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements

ruz at bestpractical.com ruz at bestpractical.com
Wed Sep 12 18:25:01 EDT 2007


Author: ruz
Date: Wed Sep 12 18:25:01 2007
New Revision: 9026

Modified:
   rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/PreviewScrips

Log:
* add a method that returns list of recipients on create operation

Modified: rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/PreviewScrips
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/PreviewScrips	(original)
+++ rt/branches/3.7-EXPERIMENTAL/html/Ticket/Elements/PreviewScrips	Wed Sep 12 18:25:01 2007
@@ -188,3 +188,48 @@
 return @recipients;
 </%INIT>
 </%METHOD>
+
+<%METHOD GetRecipientsOnCreate>
+<%INIT>
+my $action;
+my $Message = MakeMIMEEntity(
+    Subject => $ARGS{'Subject'},
+    Cc => $ARGS{'Cc'},
+    Body    => $ARGS{'Content'},
+);
+
+my $TicketObj = RT::Ticket->new( $session{'CurrentUser'} );
+my ( $id, $txn, $msg ) = $TicketObj->Create(
+    Type            => $ARGS{'Type'} || 'ticket',
+    Queue           => $ARGS{'Queue'},
+    Owner           => $ARGS{'Owner'},
+    Requestor       => $ARGS{'Requestors'},
+    Cc              => $ARGS{'Cc'},
+    AdminCc         => $ARGS{'AdminCc'},
+    InitialPriority => $ARGS{'InitialPriority'},
+    FinalPriority   => $ARGS{'FinalPriority'},
+    TimeLeft        => $ARGS{'TimeLeft'},
+    TimeEstimated   => $ARGS{'TimeEstimated'},
+    TimeWorked      => $ARGS{'TimeWorked'},
+    Subject         => $ARGS{'Subject'},
+    Status          => $ARGS{'Status'},
+    MIMEObj      => $Message,
+    DryRun       => 1
+);
+unless ( $id && $txn ) {
+    $RT::Logger->error("Couldn't fire '$action' action: $msg");
+    return ();
+}
+
+my @recipients;
+foreach my $scrip ( @{ $txn->Scrips->Prepared } ) {
+    my $action = $scrip->ActionObj->Action;
+    next unless $action->isa('RT::Action::SendEmail');
+
+    foreach my $type qw(To Cc Bcc) {
+        push @recipients, $action->$type();
+    }
+}
+return @recipients;
+</%INIT>
+</%METHOD>


More information about the Rt-commit mailing list