[Rt-commit] r6107 - in rt/branches/3.7-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Fri Sep 29 00:04:09 EDT 2006


Author: ruz
Date: Fri Sep 29 00:04:08 2006
New Revision: 6107

Modified:
   rt/branches/3.7-EXPERIMENTAL/   (props changed)
   rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm

Log:
 r3907 at cubic-pc:  cubic | 2006-09-29 08:13:47 +0400
 ::Ticket::Create()
 * add links later just before transaction writing as
   new links may create txns and fire scrips on other
   tickets.
 * add TODO mark
 


Modified: rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL/lib/RT/Ticket_Overlay.pm	Fri Sep 29 00:04:08 2006
@@ -671,8 +671,44 @@
     }
 
     # }}}
+
+    # {{{ Add all the custom fields
+
+    foreach my $arg ( keys %args ) {
+        next unless ( $arg =~ /^CustomField-(\d+)$/i );
+        my $cfid = $1;
+        foreach
+          my $value ( UNIVERSAL::isa( $args{$arg} => 'ARRAY' ) ? @{ $args{$arg} } : ( $args{$arg} ) )
+        {
+            next unless ( length($value) );
+
+            # Allow passing in uploaded LargeContent etc by hash reference
+            $self->_AddCustomFieldValue(
+                (UNIVERSAL::isa( $value => 'HASH' )
+                    ? %$value
+                    : (Value => $value)
+                ),
+                Field             => $cfid,
+                RecordTransaction => 0,
+            );
+        }
+    }
+
+    # }}}
+
     # {{{ Deal with setting up links
 
+    # TODO: Adding link may fire scrips on other end and those scrips
+    # could create transactions on this ticket before 'Create' transaction.
+    #
+    # We should implement different schema: record 'Create' transaction,
+    # create links and only then fire create transaction's scrips.
+    #
+    # Ideal variant: add all links without firing scrips, record create
+    # transaction and only then fire scrips on the other ends of links.
+    #
+    # //RUZ
+
     foreach my $type ( keys %LINKTYPEMAP ) {
         next unless ( defined $args{$type} );
         foreach my $link (
@@ -706,30 +742,6 @@
 
     # }}}
 
-    # {{{ Add all the custom fields
-
-    foreach my $arg ( keys %args ) {
-        next unless ( $arg =~ /^CustomField-(\d+)$/i );
-        my $cfid = $1;
-        foreach
-          my $value ( UNIVERSAL::isa( $args{$arg} => 'ARRAY' ) ? @{ $args{$arg} } : ( $args{$arg} ) )
-        {
-            next unless ( length($value) );
-
-            # Allow passing in uploaded LargeContent etc by hash reference
-            $self->_AddCustomFieldValue(
-                (UNIVERSAL::isa( $value => 'HASH' )
-                    ? %$value
-                    : (Value => $value)
-                ),
-                Field             => $cfid,
-                RecordTransaction => 0,
-            );
-        }
-    }
-
-    # }}}
-
     if ( $args{'_RecordTransaction'} ) {
 
         # {{{ Add a transaction for the create


More information about the Rt-commit mailing list