[Rt-commit] rt branch, 4.2/rest-user-cf, created. rt-4.0.1-233-g4b8571b

? sunnavy sunnavy at bestpractical.com
Wed Jul 6 06:36:38 EDT 2011


The branch, 4.2/rest-user-cf has been created
        at  4b8571bf1bb4edb03ef54230b06598f95a420055 (commit)

- Log -----------------------------------------------------------------
commit 4b8571bf1bb4edb03ef54230b06598f95a420055
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Jul 6 18:25:48 2011 +0800

    restful user cf support

diff --git a/share/html/REST/1.0/Forms/user/default b/share/html/REST/1.0/Forms/user/default
index 997555a..89e83e2 100755
--- a/share/html/REST/1.0/Forms/user/default
+++ b/share/html/REST/1.0/Forms/user/default
@@ -51,6 +51,7 @@
 $id
 $format => 's'
 $changes => {}
+$fields => undef
 </%ARGS>
 <%perl>
 my @comments;
@@ -130,6 +131,21 @@ if (keys %data == 0) {
         }
     }
 
+    # Custom fields
+    my $CustomFields = $user->CustomFields;
+    while ( my $CustomField = $CustomFields->Next() ) {
+        next
+            unless ( !%$fields
+            || exists $fields->{ lc "CF-" . $CustomField->Name } );
+        next unless $CustomField->CurrentUserHasRight('SeeCustomField');
+        my $CFvalues = $user->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