package: request-tracker3
severity: normal
tags: patch


The patch mentioned in the previous message is attached...


[]s
Tiago Alves Macambira
--- /root/rt-crontool	2006-06-28 00:18:22.151969344 -0300
+++ rt-crontool	2006-06-28 17:13:06.204943997 -0300
@@ -63,7 +63,7 @@
 use strict;
 use Carp;
 
-use lib ("/usr/share/request-tracker3/lib", "/usr/local/share/request-tracker3/lib");
+use lib ("/usr/share/perl5", "/usr/local/share/request-tracker3/lib");
 
 package RT;
 
@@ -73,6 +73,8 @@
 use RT::Tickets;
 use RT::Template;
 
+
+
 #Clean out all the nasties from the environment
 CleanEnv();
 
@@ -105,7 +107,7 @@
             "help"            => \$help,
             "verbose|v"       => \$verbose );
 
-help() if $help or not $search or not $action;
+help() if $help;
 
 # We _must_ have a search object
 load_module($search);
@@ -115,10 +117,13 @@
 # load template if specified
 my $template_obj;
 if ($template_id) {
-    $template_obj = RT::Template->new($RT::Nobody);
+    # Nobody is not allowed to read templates, set to current user
+    # $template_obj = RT::Template->new(RT::Nobody);
+    $template_obj = RT::Template->new($CurrentUser);
     $template_obj->LoadById($template_id);
 }
 
+
 #At the appointed time:
 
 #find a bunch of tickets
@@ -129,34 +134,43 @@
 
 # TicketsFound is an RT::Tickets object
 my $tickets = $search->TicketsObj;
-
+my $ticket;
 #for each ticket we've found
-while ( my $ticket = $tickets->Next() ) {
+while ( $ticket = $tickets->Next() ) {
     print "\n" . $ticket->Id() . ": " if ($verbose);
-
+   
     # perform some more advanced check
     if ($condition) {
+
+	
         my $condition_obj = $condition->new( TicketObj => $ticket,
                                              Argument  => $condition_arg );
-
+	
         # if the condition doesn't apply, get out of here
 
         next unless ( $condition_obj->IsApplicable );
         print loc("Condition matches...") if ($verbose);
     }
 
+  
+    
+
+
     #prepare our action
     my $action_obj = $action->new( TicketObj => $ticket,
 				   TemplateObj => $template_obj,
                                    Argument  => $action_arg );
 
+  
     #if our preparation, move onto the next ticket
     next unless ( $action_obj->Prepare );
     print loc("Action prepared...") if ($verbose);
-
+     
     #commit our action.
     next unless ( $action_obj->Commit );
     print loc("Action committed.") if ($verbose);
+    
+
 }
 
 # {{{ load_module 

Reply via email to