[Rt-devel] PATCH: Web.pm doesn't handle FreeformMultiple CF correctly

Todd Chapman rt at chaka.net
Wed Oct 6 21:58:56 EDT 2004


FreeformMultiple is created using HTML textarea, so only one
value is returned from the browser. RT 3.x currently treats
as a single value and stores all values in one CF with embedded
newlines. This patch fixes it so they are treated as
separate CF values.

-Todd

Index: Interface/Web.pm
===================================================================
--- Interface/Web.pm    (revision 1634)
+++ Interface/Web.pm    (working copy)
@@ -294,8 +294,18 @@
     );
     foreach my $arg (%ARGS) {
         if ($arg =~ /^CustomField-(\d+)(.*?)$/) {
+            my $cfid = $1;
+
             next if ($arg =~ /-Magic$/);
-            $create_args{"CustomField-".$1} = $ARGS{"$arg"};
+            my $cf = new RT::CustomField( $RT::SystemUser );
+            $cf->Load($cfid);
+
+            if ($cf->Type eq 'FreeformMultiple') {
+                $ARGS{$arg} =~ s/\r\n/\n/g;
+                $ARGS{$arg} = [split('\n', $ARGS{$arg})];
+            }
+
+            $create_args{"CustomField-".$cfid} = $ARGS{"$arg"};
         }
     }



More information about the Rt-devel mailing list