This commit was generated by cvs2svn to compensate for changes in r11022,
[freeside.git] / FS / FS / TicketSystem / RT_Internal.pm
index 6fc2bb6..6ae8881 100644 (file)
@@ -255,6 +255,7 @@ sub get_ticket {
     my $t = { created => $transaction->Created,
        content => $transaction->Content,
        description => $transaction->Description,
+       type => $transaction->Type,
     };
     push @txns, $t;
   }
@@ -300,6 +301,35 @@ sub correspond_ticket {
   $Ticket->Correspond( Content => $param{'content'} );
 }
 
+=item queues SESSION_HASHREF [, ACL ]
+
+Retrieve a list of queues.  Pass the name of an RT access control right, 
+such as 'CreateTicket', to return only queues on which the current user 
+has that right.  Otherwise this will return all queues with the 'SeeQueue' 
+right.
+
+=cut
+
+sub queues {
+  my( $self, $session, $acl ) = @_;
+  $session = $self->session($session);
+
+  my $showall = $acl ? 0 : 1;
+  my @result = ();
+  my $q = new RT::Queues($session->{'CurrentUser'});
+  $q->UnLimit;
+  while (my $queue = $q->Next) {
+    if ($showall || $queue->CurrentUserHasRight($acl)) {
+      push @result, {
+        Id          => $queue->Id,
+        Name        => $queue->Name,
+        Description => $queue->Description,
+      };
+    }
+  }
+  return map { $_->{Id} => $_->{Name} } @result;
+}
+
 #shameless false laziness w/RT::Interface::Web::AttemptExternalAuth
 # to get logged into RT from afar
 sub _web_external_auth {