[Rt-commit] r16460 - in rt/3.8/trunk: share/html/REST/1.0/Forms/queue

alexmv at bestpractical.com alexmv at bestpractical.com
Tue Oct 21 17:58:39 EDT 2008


Author: alexmv
Date: Tue Oct 21 17:58:38 2008
New Revision: 16460

Modified:
   rt/3.8/trunk/   (props changed)
   rt/3.8/trunk/share/html/REST/1.0/Forms/queue/default

Log:
 r38461 at kohr-ah:  chmrr | 2008-10-21 17:56:57 -0400
  * List Queue CFs via REST, from Philip Kime <Philip at kime.org.uk>


Modified: rt/3.8/trunk/share/html/REST/1.0/Forms/queue/default
==============================================================================
--- rt/3.8/trunk/share/html/REST/1.0/Forms/queue/default	(original)
+++ rt/3.8/trunk/share/html/REST/1.0/Forms/queue/default	Tue Oct 21 17:58:38 2008
@@ -50,6 +50,7 @@
 <%ARGS>
 $id
 $format => 's'
+$fields => undef # these are the fields passed to the rt "-f" flag.
 $changes => {}
 </%ARGS>
 <%perl>
@@ -124,6 +125,21 @@
         push @data, [ $key => $queue->$key ];
     }
 
+    # Custom fields
+    my $CustomFields = $queue->CustomFields;
+    while ( my $CustomField = $CustomFields->Next() ) {
+        next
+            unless ( !%$fields
+            || exists $fields->{ lc "CF-" . $CustomField->Name } );
+        next unless $CustomField->CurrentUserHasRight('SeeCustomField');
+        my $CFvalues = $queue->CustomFieldValues( $CustomField->Id );
+        my @CFvalues;
+        while ( my $CFvalue = $CFvalues->Next() ) {
+            push @CFvalues, $CFvalue->Content;
+        }
+        push @data, [ "CF-" . $CustomField->Name => \@CFvalues ];
+    }
+
     my %k = map {@$_} @data;
     $o = [ map {$_->[0]} @data ];
     $k = \%k;


More information about the Rt-commit mailing list