[Rt-commit] rt branch, 4.2/multi-value-cf-in-rest, updated. rt-4.2.9-98-g40e3932

? sunnavy sunnavy at bestpractical.com
Tue Feb 3 10:30:59 EST 2015


The branch, 4.2/multi-value-cf-in-rest has been updated
       via  40e39325f0fa1dcb1befdb69b9bee16458b4e95f (commit)
      from  82a0d98af204af4062d0d7118035f09a0d27c6a7 (commit)

Summary of changes:
 share/html/REST/1.0/Forms/ticket/default | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

- Log -----------------------------------------------------------------
commit 40e39325f0fa1dcb1befdb69b9bee16458b4e95f
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Feb 3 22:29:20 2015 +0800

    cf multi values support on restful ticket creation
    
    interestingly that we kina supported it on server side, and it requires the
    format like this(i.e. multiple rows, see also t/web/rest.t:172):
    
        CF.{foo}: bar
        CF.{foo}: baz
    
    but before submitting to server, bin/rt automatically converts the format
    above to:
    
        CF.{foo}: bar,baz
    
    so it actually doesn't work with bin/rt
    
    now we support the same comma seprated format like what we do on edit

diff --git a/share/html/REST/1.0/Forms/ticket/default b/share/html/REST/1.0/Forms/ticket/default
index 27989cd..e60b6a6 100644
--- a/share/html/REST/1.0/Forms/ticket/default
+++ b/share/html/REST/1.0/Forms/ticket/default
@@ -169,7 +169,9 @@ else {
                     delete $data{$k};
                     next;
                 }
-                $v{"CustomField-".$cf->Id()} = delete $data{$k};
+                my $val = delete $data{$k};
+                next unless defined $val && length $val;
+                $v{"CustomField-".$cf->Id()} = $cf->SingleValue ? $val : vsplit($val,1);
             }
             elsif (lc $k eq 'text') {
                 $text = delete $data{$k};

-----------------------------------------------------------------------


More information about the rt-commit mailing list