Ported move-script from 3.8 (no api-changes)
authorMikal Kolbein Gule <m.k.gule@usit.uio.no>
Fri, 14 Jun 2013 08:15:43 +0000 (10:15 +0200)
committerMikal Kolbein Gule <m.k.gule@usit.uio.no>
Fri, 14 Jun 2013 08:15:43 +0000 (10:15 +0200)
local/bin/rt-move-nomail [new file with mode: 0755]

diff --git a/local/bin/rt-move-nomail b/local/bin/rt-move-nomail
new file mode 100755 (executable)
index 0000000..93a5111
--- /dev/null
@@ -0,0 +1,31 @@
+#!/usr/bin/perl
+
+use lib '/www/data/rt/rt-perl/current-perl10/share/perl5';
+use lib '/www/data/rt/rt-perl/current-perl10/lib/perl5';
+use lib '/www/data/rt/rt-perl/current-perl10/lib64/perl5';
+
+use lib ("/www/var/rt/local/lib", "/www/var/rt/lib");
+use warnings;
+use strict;
+
+package RT;
+use RT;
+
+RT::LoadConfig();
+RT::Init();
+
+#my $sql = "queue = 'aaa-rt-test' AND Created > '2009-06-01'";
+my $sql = "queue = 'generl'";
+my $to_queue = "request-tracker";
+my $do_it = 0;
+
+my $tickets = new RT::Tickets($RT::SystemUser);
+my $queue = RT::Queue->new($RT::SystemUser);
+$queue->Load($to_queue);
+$tickets->FromSQL($sql);
+while (my $ticket = $tickets->Next) {
+print "Moving ticket \"".$ticket->Subject."\" (".$ticket->id.") to ".$queue->Name()." (".$queue->id().") " if $ticket->id;
+my ($status, $msg) = ("0","Not moving.");
+($status, $msg) = $ticket->__Set( Field => 'Queue', Value => $queue->id()) if ($do_it && $ticket->id);
+print  "Status: $status - $msg\n";
+}