[rt-users] Forwarding of tickets.

Simon Cozens rt at netthink.co.uk
Mon Apr 15 07:41:23 EDT 2002


Jan Okrouhly:
> I've implemented this 2 years ago (Jesse saw it), but only for our
> internal purposes. I use an own branch of RT 2.0.9 so I don't have "patch"
> for the most actual version. But if I'll be asked for it be Jesse, I would
> prepare it.

Here's a patch which does it, and corrects the quoting style for forwarded
messages.

Change 14965 by simon at simon-squash on 2002/03/18 13:05:58

	 I believe this gives us forward-to-third-party.

Affected files ...

... //systems/src/rt/lib/RT/Action/SendToThirdParty.pm#1 add
... //systems/src/rt/lib/RT/Interface/Web.pm#3 edit
... //systems/src/rt/lib/RT/Ticket.pm#13 edit
... //systems/src/rt/lib/RT/Transaction.pm#3 edit
... //systems/src/rt/webrt/Elements/MessageBox#3 edit
... //systems/src/rt/webrt/Ticket/Elements/ShowTransaction#15 edit
... //systems/src/rt/webrt/Ticket/Update.html#3 edit

Differences ...

==== //systems/src/rt/lib/RT/Interface/Web.pm#3 (text) ====
Index: src/rt/lib/RT/Interface/Web.pm
--- src/rt/lib/RT/Interface/Web.pm.~1~	Mon Mar 18 14:07:51 2002
+++ src/rt/lib/RT/Interface/Web.pm	Mon Mar 18 14:07:51 2002
@@ -249,8 +249,14 @@
 		  MIMEObj => $Message,
 		  TimeTaken => $args{ARGSRef}->{'UpdateTimeWorked'});
 	    push(@{$args{Actions}}, $Description);
-	} 
-	else {
+	} elsif ($args{ARGSRef}->{'UpdateType'} eq 'forward') {
+	    my ($Transaction, $Description) = $args{TicketObj}->Forward
+		( ForwardTo => $args{ARGSRef}->{'ForwardTo'},
+		  BccMessageTo => $args{ARGSRef}->{'UpdateBcc'},
+		  MIMEObj => $Message,
+		  TimeTaken => $args{ARGSRef}->{'UpdateTimeWorked'});
+	    push(@{$args{Actions}}, $Description);
+	} else {
 	    push(@{$args{'Actions'}}, "Update type was neither correspondence nor comment. Update not recorded");
 	}
     }

==== //systems/src/rt/lib/RT/Ticket.pm#13 (xtext) ====
Index: src/rt/lib/RT/Ticket.pm
--- src/rt/lib/RT/Ticket.pm.~1~	Mon Mar 18 14:07:51 2002
+++ src/rt/lib/RT/Ticket.pm	Mon Mar 18 14:07:51 2002
@@ -1758,6 +1758,48 @@
 
 # }}}
 
+# {{{ sub Forward
+
+=head2 Forward
+
+Forward this ticket onto a third party.
+Takes a hashref with the follwoing attributes:
+
+MIMEObj, TimeTaken, ForwardTo
+
+=cut
+
+sub Forward {
+  my $self = shift;
+  
+  my %args = (
+	      
+	      MIMEObj => undef,
+          ForwardTo => undef,
+	      TimeTaken => 0,
+	      @_ );
+
+  unless (($self->CurrentUserHasRight('ReplyToTicket')) or
+	  ($self->CurrentUserHasRight('ModifyTicket'))) {
+      return (0, "Permission Denied");
+  }
+
+  unless ($args{ForwardTo}) {
+      return (0, "No Forwarding Address Given");
+  }
+  
+  
+  #Record the correspondence (write the transaction)
+  my ($Trans, $Msg, $TransObj) = $self->_NewTransaction( Type => 'Forward',
+				      Data =>$args{'ForwardTo'},
+				      TimeTaken => $args{'TimeTaken'},
+				      MIMEObj => $args{'MIMEObj'}
+				    );
+  
+  
+  return ($Trans, "Message Forwarded");
+}
+
 # }}}
 
 # {{{ Routines dealing with Links and Relations between tickets

==== //systems/src/rt/lib/RT/Transaction.pm#3 (xtext) ====
Index: src/rt/lib/RT/Transaction.pm
--- src/rt/lib/RT/Transaction.pm.~1~	Mon Mar 18 14:07:51 2002
+++ src/rt/lib/RT/Transaction.pm	Mon Mar 18 14:07:51 2002
@@ -332,7 +332,7 @@
 	    $content=$wrapper->wrap($content);
 	}
 
-	$content =~ s/^/> /gm;
+	$content =~ s/^/> /gm unless $args{'Quote'} == 2; # Secondary quoting style
 	$content = '[' . $self->CreatorObj->Name() . ' - ' . $self->CreatedAsString()
 	            . "]:\n\n"
    	        . $content . "\n\n";

==== //systems/src/rt/webrt/Elements/MessageBox#3 (text) ====
Index: src/rt/webrt/Elements/MessageBox
--- src/rt/webrt/Elements/MessageBox.~1~	Mon Mar 18 14:07:51 2002
+++ src/rt/webrt/Elements/MessageBox	Mon Mar 18 14:07:51 2002
@@ -10,11 +10,11 @@
 if ($QuoteTransaction) {
     my $transaction=RT::Transaction->new($session{'CurrentUser'});
     $transaction->Load($QuoteTransaction);
-    $message=$transaction->Content(Quote => 1);
+    $message=$transaction->Content(Quote => $Style+1);
 }
 
 my $signature = '';
-if ($session{'CurrentUser'}->UserObj->Signature) {
+if ($session{'CurrentUser'}->UserObj->Signature and $Style != 1) {
 	$signature = "-- \n".$session{'CurrentUser'}->UserObj->Signature;
 }
 
@@ -26,5 +26,6 @@
 $DefaultURI => undef
 $Width => 72
 $MessageURI => undef
+$Style => 0 # Style 0 is ordinary replying, style 1 is forwarding
 </%ARGS>
 

==== //systems/src/rt/webrt/Ticket/Elements/ShowTransaction#15 (xtext) ====
Index: src/rt/webrt/Ticket/Elements/ShowTransaction
--- src/rt/webrt/Ticket/Elements/ShowTransaction.~1~	Mon Mar 18 14:07:51 2002
+++ src/rt/webrt/Ticket/Elements/ShowTransaction	Mon Mar 18 14:07:51 2002
@@ -126,6 +126,10 @@
 	  	  "[<a class='inverse' href=\"Update.html?id=".
 		  $Transaction->Ticket . "&DefaultStatus=resolved&QuoteTransaction=".$Transaction->Id.
 		  "&Action=Respond\">Resolve</a>] ";
+		$titlebar_commands .= 
+	  	  "[<a class='inverse' href=\"Update.html?id=".
+		  $Transaction->Ticket . "&QuoteTransaction=".$Transaction->Id.
+		  "&Action=Forward\">Forward</a>] ";
 	}
 }
 

==== //systems/src/rt/webrt/Ticket/Update.html#3 (xtext) ====
Index: src/rt/webrt/Ticket/Update.html
--- src/rt/webrt/Ticket/Update.html.~1~	Mon Mar 18 14:07:51 2002
+++ src/rt/webrt/Ticket/Update.html	Mon Mar 18 14:07:51 2002
@@ -34,8 +34,6 @@
 </TD>
 </TR>
 </TABLE>
-
-
 <hr>
 
 Update Type: <select name="UpdateType">
@@ -44,9 +42,14 @@
 % }
 % if ($CanRespond) {
    <option value="response" <%$ResponseDefault%>>Response to requestors</option>
+   <option value="forward" <%$ForwardDefault%>>Forward to 3rd Party</option>
 % }
 	  </select> 
 	  <br>
+% if ($Action eq "Forward") {
+Forwarding address:
+<input name="ForwardTo" size=60><br>
+% }
 
 Status:
 <& /Elements/SelectStatus, Name=>"Status", Default => $DefaultStatus &>
@@ -56,7 +59,7 @@
 <input size=4 name="UpdateTimeWorked"> minutes<BR>
 Subject: <input name="UpdateSubject" size=60 value="<%$Ticket->Subject()%>"> <br>
 Attach: <input name="UpdateAttachment" type="file"> <br>
-<& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &>
+<& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction}, Style => $Action eq "Forward" &>
 		<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>"><br>
 
 
@@ -79,6 +82,8 @@
 
 if ($DefaultStatus eq 'resolved') {
 	$title = "Resolve";
+} elsif ($Action eq 'Forward') {
+	$title = "Forward";
 } else {
 	$title = "Update";
 }
@@ -89,6 +94,7 @@
 # for the convinience:
 my $CommentDefault=$Action eq "Comment" ? "SELECTED" : "";
 my $ResponseDefault=$Action eq "Respond" ? "SELECTED" : "";
+my $ForwardDefault=$Action eq "Forward" ? "SELECTED" : "";
 
 $DefaultStatus = $Ticket->Status() unless ($DefaultStatus);
 

==== //systems/src/rt/lib/RT/Action/SendToThirdParty.pm#1 (xtext) ====
Index: src/rt/lib/RT/Action/SendToThirdParty.pm
--- src/rt/lib/RT/Action/SendToThirdParty.pm.~1~	Mon Mar 18 14:07:51 2002
+++ src/rt/lib/RT/Action/SendToThirdParty.pm	Mon Mar 18 14:07:51 2002
@@ -0,0 +1,28 @@
+#$Header: /raid/cvsroot/rt/lib/RT/Action/Notify.pm,v 1.2 2001/11/06 23:04:17 jesse Exp $
+
+package RT::Action::SendToThirdParty;
+require RT::Action::SendEmail;
+ at ISA = qw(RT::Action::SendEmail);
+
+
+# {{{ sub SetRecipients
+
+=head2 SetRecipients
+
+Sets the recipients of this message to the user specified in the
+transaction.
+
+=cut
+
+
+sub SetRecipients {
+    my $self=shift;
+
+    $arg=$self->Argument;
+	@{$self->{'To'}} = @{$self->TransactionObj->Data};
+    return(1);
+}
+
+# }}}
+
+1;
End of Patch.

-- 
About the use of language: it is impossible to sharpen a pencil with a blunt
ax.  It is equally vain to try to do it with ten blunt axes instead.
		-- Edsger Dijkstra




More information about the rt-users mailing list