[Rt-commit] rt branch, 4.4/crontool-reload-template, created. rt-4.4.0-20-g7c34299

Jim Brandt jbrandt at bestpractical.com
Mon Feb 8 09:11:01 EST 2016


The branch, 4.4/crontool-reload-template has been created
        at  7c34299a9a0ed2db5729503610c1e57e80ec95a6 (commit)

- Log -----------------------------------------------------------------
commit 7c34299a9a0ed2db5729503610c1e57e80ec95a6
Author: Jim Brandt <jbrandt at bestpractical.com>
Date:   Mon Feb 8 09:03:42 2016 -0500

    In rt-crontool reload the template object for each action executed
    
    Commit a02495fea added support for multiple actions in an
    rt-crontool run. Previously each action would get the same
    template object resulting in re-used headers like To, Cc,
    and Bcc. This could result in unexpected behavior like incorrect
    recipients or the appearance that the first action provided
    was being executed multiple times.
    
    Reload the template object each time to provide the action with
    an empty template.

diff --git a/bin/rt-crontool.in b/bin/rt-crontool.in
index 045c8ad..21a0d2c 100644
--- a/bin/rt-crontool.in
+++ b/bin/rt-crontool.in
@@ -209,11 +209,15 @@ sub process {
         my $action_argument = ($i <= $#$actions_arg) ? $actions_arg->[$i] : undef;
         $i++;
 
+        # When running multiple actions, reload the template object each time
+        # to avoid re-using previous values for To, Cc, Bcc, etc.
+        my $action_template_obj = get_template( $ticket );
+
         # prepare our action
         my $action_obj = $action->new(
             TicketObj      => $ticket,
             TransactionObj => $transaction,
-            TemplateObj    => $template_obj,
+            TemplateObj    => $action_template_obj,
             Argument       => $action_argument,
             ScripObj       => $void_scrip,
             ScripActionObj => $void_scrip_action,

-----------------------------------------------------------------------


More information about the rt-commit mailing list