[Rt-commit] r10420 - rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Investigation/Elements

ruz at bestpractical.com ruz at bestpractical.com
Tue Jan 22 08:13:01 EST 2008


Author: ruz
Date: Tue Jan 22 08:13:01 2008
New Revision: 10420

Modified:
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Investigation/Elements/Create

Log:
* fix CF inheritance when we create inc with inv at once

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Investigation/Elements/Create
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Investigation/Elements/Create	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Investigation/Elements/Create	Tue Jan 22 08:13:01 2008
@@ -193,44 +193,35 @@
     my %cf_map;
     foreach my $k( keys %ARGS ) {
         next unless $k =~ /^\Q$prefix\E(\d+)(.*?)$/;
-
         my ($cf_id, $rest) = ($1, $2);
-        if ( exists $cf_map{ $cf_id } ) {
-            if ( !$cf_map{ $cf_id } ||
-                (    defined $ARGS{ $prefix . $cf_map{ $cf_id } . $rest }
-                  && length $ARGS{ $prefix . $cf_map{ $cf_id } . $rest } ) )
-            {
+
+        unless ( exists $cf_map{ $cf_id } ) {
+            my $src_cf = $queue->LoadCustomFieldByIdentifier($cf_id);
+            unless ( $src_cf->id ) {
+                $cf_map{ $cf_id } = 0;
                 delete $ARGS{ $k };
-            } else {
-                $ARGS{ $prefix . $cf_map{ $cf_id } . $rest } = delete $ARGS{ $k };
+                $RT::Logger->error("Couldn't load CF #$cf_id");
+                next;
             }
-            next;
-        }
 
-        my $src_cf = $queue->LoadCustomFieldByIdentifier($cf_id);
-        unless ( $src_cf->id ) {
-            $cf_map{ $cf_id } = 0;
-            delete $ARGS{ $k };
-            $RT::Logger->error("Couldn't load CF #$cf_id");
-            next;
-        }
+            my $dst_cf = do {
+                my $cfs = $queue->TicketCustomFields;
+                $cfs->Limit( FIELD => 'Name', VALUE => $src_cf->Name );
+                $cfs->RowsPerPage(1);
+                $cfs->First;
+            };
 
-        my $dst_cf = do {
-            my $cfs = $queue->TicketCustomFields;
-            $cfs->Limit( FIELD => 'Name', VALUE => $src_cf->Name );
-            $cfs->RowsPerPage(1);
-            $cfs->First;
-        };
-
-        unless ( $dst_cf && $dst_cf->id ) {
-            $cf_map{ $cf_id } = 0;
-            delete $ARGS{ $k };
-            $RT::Logger->debug( $src_cf->Name .' is not applied. skipping.' );
-            next;
+            unless ( $dst_cf && $dst_cf->id ) {
+                $cf_map{ $cf_id } = 0;
+                delete $ARGS{ $k };
+                $RT::Logger->debug( $src_cf->Name .' is not applied. skipping.' );
+                next;
+            }
+            $cf_map{ $cf_id } = $dst_cf->id;
         }
-        $cf_map{ $cf_id } = $dst_cf->id;
 
-        if ( defined $ARGS{ $prefix . $cf_map{ $cf_id } . $rest } 
+        if ( $cf_map{ $cf_id }
+            && defined $ARGS{ $prefix . $cf_map{ $cf_id } . $rest } 
             && length $ARGS{ $prefix . $cf_map{ $cf_id } . $rest } )
         {
             $ARGS{ $prefix. $cf_map{ $cf_id } . $rest } =


More information about the Rt-commit mailing list