[Rt-commit] [svn] r861 - in rt/branches/rt-3.1: html/Tools lib/RT/Action

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Mon May 10 18:17:04 EDT 2004


Author: leira
Date: Mon May 10 18:17:03 2004
New Revision: 861

Modified:
   rt/branches/rt-3.1/html/Tools/Offline.html
   rt/branches/rt-3.1/lib/RT/Action/CreateTickets.pm
Log:
Set default queue more robustly.


Modified: rt/branches/rt-3.1/html/Tools/Offline.html
==============================================================================
--- rt/branches/rt-3.1/html/Tools/Offline.html	(original)
+++ rt/branches/rt-3.1/html/Tools/Offline.html	Mon May 10 18:17:03 2004
@@ -32,7 +32,7 @@
 	METHOD=POST enctype="multipart/form-data">
 <table>
 <tr>
-<td>
+<td class=label>
 <&|/l&>Default Queue</&>:
 </td>
 <td>
@@ -89,7 +89,7 @@
 
     $ARGS{'string'} = $string;
 } elsif ($ARGS{'UpdateTickets'}) {
-    $action->Parse($ARGS{string});
+    $action->Parse($ARGS{string}, $ARGS{'qname'});
     push @results, $action->CreateByTemplate();
     push @results, $action->UpdateByTemplate();
     $string = $ARGS{string};

Modified: rt/branches/rt-3.1/lib/RT/Action/CreateTickets.pm
==============================================================================
--- rt/branches/rt-3.1/lib/RT/Action/CreateTickets.pm	(original)
+++ rt/branches/rt-3.1/lib/RT/Action/CreateTickets.pm	Mon May 10 18:17:03 2004
@@ -604,11 +604,18 @@
 
     my @template_order;
     my $template_id;
+    my $queue;
     if (substr($content, 0, 3) eq '===') {
 	$RT::Logger->debug("Line: ===");
 	foreach my $line (split(/\n/, $content)) {
 	    $line =~ s/\r$//;
 	    $RT::Logger->debug("Line: $line");
+	    if ($line =~ /^===$/) {
+		if ($template_id && !$queue) {
+		    $self->{'templates'}->{$template_id} .= "Queue: $qname\n";
+		}
+		$queue = 0;
+	    }
 	    if ($line =~ /^===Create-Ticket: (.*)$/) {
 		$template_id = "create-$1";
 		$RT::Logger->debug("****  Create ticket: $template_id");
@@ -623,9 +630,19 @@
 		push @{$self->{'base_tickets'}},$template_id;
 	    } elsif ($line =~ /^===#.*$/) { # a comment
 		     next;
-		 } else {
-		     $self->{'templates'}->{$template_id} .= $line."\n";
-		 }
+	    } else {
+		if ( $line =~ /^Queue:(.*)/i) {
+		    $queue = 1;
+		    my $value = $1;
+		    $value =~ s/^\s//;
+		    $value =~ s/\s$//;
+		    if (!$value) {
+			$value = $qname;
+			$line = "Queue: $value";
+		    }
+		}
+		$self->{'templates'}->{$template_id} .= $line."\n";
+	    }
 	}
     } elsif (substr($content, 0, 2) =~ /^id$/i) {
 	$RT::Logger->debug("Line: id");
@@ -647,7 +664,6 @@
 	$content = substr($content, index($content, "\n") + 1);
 	$RT::Logger->debug("First: $first");
 	
-	my $queue;
 	foreach my $line (split(/\n/, $content)) {
 	    next unless $line;
 	    $RT::Logger->debug("Line: $line");


More information about the Rt-commit mailing list