[Rt-commit] r8681 - rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Interface

ruz at bestpractical.com ruz at bestpractical.com
Tue Aug 21 18:51:44 EDT 2007


Author: ruz
Date: Tue Aug 21 18:51:44 2007
New Revision: 8681

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Interface/Email.pm

Log:
* when forwarding a transaction try to get content from 'Forward'
  template. if the template doesn't exist then fallback to old
  solution we had.

Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Interface/Email.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Interface/Email.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Interface/Email.pm	Tue Aug 21 18:51:44 2007
@@ -570,16 +570,27 @@
         $entity->add_part( $a->ContentAsMIME );
     }
 
-    my $description = 'This is forward of transaction #'
-        . $txn->id ." of a ticket #". $txn->ObjectId;
-
-    my $mail = MIME::Entity->build(
-        To => $args{'To'},
-        Cc => $args{'Cc'},
-        Bcc => $args{'Bcc'},
-        Type => 'text/plain',
-        Data => $description,
+    my $mail = PrepareEmailUsingTemplate(
+        Template  => 'Forward',
+        Arguments => {
+            Transaction => $txn,
+            Ticket      => $txn->Object,
+        },
     );
+    unless ( $mail ) {
+        $RT::Logger->warning("Couldn't generate email using template 'Forward'");
+
+        my $description = 'This is forward of transaction #'
+            . $txn->id ." of a ticket #". $txn->ObjectId;
+        $mail = MIME::Entity->build(
+            Type => 'text/plain',
+            Data => $description,
+        );
+    }
+
+    $mail->head->set( $_ => $args{ $_ } )
+        foreach grep defined $args{$_}, qw(To Cc Bcc);
+
     $mail->attach(
         Type => 'message/rfc822',
         Disposition => 'attachment',


More information about the Rt-commit mailing list