[Rt-commit] r2929 - in rt/branches/PLATANO-EXPERIMENTAL-CSS: . lib/RT/Interface

jesse at bestpractical.com jesse at bestpractical.com
Sun May 22 18:40:12 EDT 2005


Author: jesse
Date: Sun May 22 18:40:11 2005
New Revision: 2929

Modified:
   rt/branches/PLATANO-EXPERIMENTAL-CSS/   (props changed)
   rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Web.pm
Log:
 r17005 at hualien:  jesse | 2005-05-22 17:15:48 -0400
  r16996 at hualien:  jesse | 2005-05-22 17:01:22 -0400
   r16989 at hualien:  jesse | 2005-05-22 16:58:45 -0400
    r16893 at hualien:  jesse | 2005-05-16 18:04:08 -0400
    * Better creation of in-reply-to/references headers on web-ased reply
   
  
 


Modified: rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Web.pm	(original)
+++ rt/branches/PLATANO-EXPERIMENTAL-CSS/lib/RT/Interface/Web.pm	Sun May 22 18:40:11 2005
@@ -444,9 +444,10 @@
     );
 
     #Make the update content have no 'weird' newlines in it
-    if ( $args{ARGSRef}->{'UpdateTimeWorked'} ||
-	 $args{ARGSRef}->{'UpdateContent'} ||
-	 $args{ARGSRef}->{'UpdateAttachments'}) {
+    if (   $args{ARGSRef}->{'UpdateTimeWorked'}
+        || $args{ARGSRef}->{'UpdateContent'}
+        || $args{ARGSRef}->{'UpdateAttachments'} )
+    {
 
         if (
             $args{ARGSRef}->{'UpdateSubject'} eq $args{'TicketObj'}->Subject() )
@@ -455,57 +456,62 @@
         }
 
         my $Message = MakeMIMEEntity(
-            Subject             => $args{ARGSRef}->{'UpdateSubject'},
-            Body                => $args{ARGSRef}->{'UpdateContent'},
+            Subject => $args{ARGSRef}->{'UpdateSubject'},
+            Body    => $args{ARGSRef}->{'UpdateContent'},
         );
 
-        if ($args{ARGSRef}->{'QuoteTransaction'} ) {
-            my $old_txn = RT::Transaction->new($session{'CurrentUser'}); 
-            $old_txn->Load($args{ARGSRef}->{'QuoteTransaction'} );
-            if ($old_txn->Message->First) {
-                $Message->head->replace('In-Reply-To',$old_txn->Message->First->GetHeader('Message-Id')); 
-                $Message->head->replace('References',
-                            $old_txn->Message->First->GetHeader('References')
-                            . " ".
-                            $old_txn->Message->First->GetHeader('Message-Id')
-                        ); 
-            }
-
-        }
-        if ($args{ARGSRef}->{'UpdateAttachments'}) {
-            $Message->make_multipart;
-            $Message->add_part($_) foreach values %{$args{ARGSRef}->{'UpdateAttachments'}};
-        }
-
-        ## TODO: Implement public comments
-        if ( $args{ARGSRef}->{'UpdateType'} =~ /^(private|public)$/ ) {
-            my ( $Transaction, $Description, $Object ) = $args{TicketObj}->Comment(
-                CcMessageTo  => $args{ARGSRef}->{'UpdateCc'},
-                BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
-                MIMEObj      => $Message,
-                TimeTaken    => $args{ARGSRef}->{'UpdateTimeWorked'}
-            );
-            push ( @{ $args{Actions} }, $Description );
-	    $Object->UpdateCustomFields( ARGSRef => $args{ARGSRef} ) if $Object;
-        }
-        elsif ( $args{ARGSRef}->{'UpdateType'} eq 'response' ) {
-            my ( $Transaction, $Description, $Object ) = $args{TicketObj}->Correspond(
-                CcMessageTo  => $args{ARGSRef}->{'UpdateCc'},
-                BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
-                MIMEObj      => $Message,
-                TimeTaken    => $args{ARGSRef}->{'UpdateTimeWorked'}
-            );
-            push ( @{ $args{Actions} }, $Description );
-	    $Object->UpdateCustomFields( ARGSRef => $args{ARGSRef} ) if $Object;
+        my $old_txn = RT::Transaction->new( $session{'CurrentUser'} );
+        if ( $args{ARGSRef}->{'QuoteTransaction'} ) {
+            $old_txn->Load( $args{ARGSRef}->{'QuoteTransaction'} );
         }
         else {
-            push ( @{ $args{'Actions'} },
-                loc("Update type was neither correspondence nor comment.").
-                " ".
-                loc("Update not recorded.")
-            );
+            $old_txn = $args{TicketObj}->Transactions->First();
         }
+
+        if ( $old_txn->Message && $old_txn->Message->First ) {
+            $Message->head->replace( 'In-Reply-To',
+                $old_txn->Message->First->GetHeader('Message-Id') );
+            $Message->head->replace( 'References',
+                    $old_txn->Message->First->GetHeader('References') . " "
+                  . $old_txn->Message->First->GetHeader('Message-Id') );
+        }
+
+    if ( $args{ARGSRef}->{'UpdateAttachments'} ) {
+        $Message->make_multipart;
+        $Message->add_part($_)
+          foreach values %{ $args{ARGSRef}->{'UpdateAttachments'} };
+    }
+
+    ## TODO: Implement public comments
+    if ( $args{ARGSRef}->{'UpdateType'} =~ /^(private|public)$/ ) {
+        my ( $Transaction, $Description, $Object ) = $args{TicketObj}->Comment(
+            CcMessageTo  => $args{ARGSRef}->{'UpdateCc'},
+            BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
+            MIMEObj      => $Message,
+            TimeTaken    => $args{ARGSRef}->{'UpdateTimeWorked'}
+        );
+        push( @{ $args{Actions} }, $Description );
+        $Object->UpdateCustomFields( ARGSRef => $args{ARGSRef} ) if $Object;
+    }
+    elsif ( $args{ARGSRef}->{'UpdateType'} eq 'response' ) {
+        my ( $Transaction, $Description, $Object ) =
+          $args{TicketObj}->Correspond(
+            CcMessageTo  => $args{ARGSRef}->{'UpdateCc'},
+            BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
+            MIMEObj      => $Message,
+            TimeTaken    => $args{ARGSRef}->{'UpdateTimeWorked'}
+          );
+        push( @{ $args{Actions} }, $Description );
+        $Object->UpdateCustomFields( ARGSRef => $args{ARGSRef} ) if $Object;
     }
+    else {
+        push(
+            @{ $args{'Actions'} },
+            loc("Update type was neither correspondence nor comment.") . " "
+              . loc("Update not recorded.")
+        );
+    }
+}
 }
 
 # }}}


More information about the Rt-commit mailing list