Guest User

Untitled

a guest
Feb 11th, 2019
84
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. RT-Attach-Message: yes
  2. Content-Type: text/html
  3.  
  4. <b>{$Transaction->CreatedAsString}: Request <a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">{$Ticket->id}</a> was acted upon by {$Transaction->CreatorObj->Name}.</b>
  5. <br>
  6. <table border="0">
  7. <tr><td align="right"><b>Transaction:</b></td><td>{$Transaction->Description}</td></tr>
  8. <tr><td align="right"><b>Queue:</b></td><td>{$Ticket->QueueObj->Name}</td></tr>
  9. <tr><td align="right"><b>Subject:</b></td><td>{$Transaction->Subject || $Ticket->Subject || "(No subject given)"} </td></tr>
  10. <tr><td align="right"><b>Owner:</b></td><td>{$Ticket->OwnerObj->Name}</td></tr>
  11. <tr><td align="right"><b>Requestors:</b></td><td>{$Ticket->RequestorAddresses}</td></tr>
  12. <tr><td align="right"><b>Status:</b></td><td>{$Ticket->Status}</td></tr>
  13. <tr><td align="right"><b>Ticket URL:</b></td><td><a href="{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}">{RT->Config->Get("WebURL")}Ticket/Display.html?id={$Ticket->id}</a></td></tr>
  14. </table>
  15. <br/>
  16. <br/>
  17. {
  18. ### BEGIN MULTLINE PERL BLOCK
  19. my $out = '';
  20. my $finalout = '';
  21. my $transactions = $Ticket->Transactions;
  22. while (my $transaction = $transactions->Next) {
  23.     my $type = $transaction->Type;
  24.     if ($transaction->Type eq 'Correspond') {
  25.         my $attachments = $transaction->Attachments;
  26.         while (my $message = $attachments->Next) {
  27.             next unless $message->Creator != 1;
  28.             my $content = $message->Content;
  29.             next unless $content;
  30.             next unless $message->ContentType =~ m!^(text/plain)!i;
  31.             $out .= '<tr style="background-color: #fcc">';
  32.             $out .= '<td>From:</td>';
  33.             $out .= '<td>'.($message->CreatorObj->RealName || $message->CreatorObj->EmailAddress).'</th>';
  34.             $out .= '</tr>';
  35.             $out .= '<tr style="background-color: #fcc">';
  36.             $out .= '<td>Time:</th>';
  37.             $out .= '<td>'.$message->Created.'</th>';
  38.             $out .= '</tr>';
  39.             $out .= '<tr style="background-color: #fcc">';
  40.             $out .= '<td style="border:1pt solid black;">Reply:</th>';
  41.             $out .= '<td style="border:1pt solid black;"><pre>'.$content.'</pre></th>';
  42.             $out .= '</tr>';
  43.         }
  44.     }
  45.     if ($transaction->Type eq 'Comment') {
  46.         my $attachments = $transaction->Attachments;
  47.         while (my $message = $attachments->Next) {
  48.             next unless $message->Creator != 1;
  49.             my $content = $message->Content;
  50.             next unless $content;
  51.             next unless $message->ContentType =~ m!^(text/plain)!i;
  52.             $out .= '<tr style="background-color: #FFFFDD">';
  53.             $out .= '<td>From:</td>';
  54.             $out .= '<td>'.($message->CreatorObj->RealName || $message->CreatorObj->EmailAddress).'</th>';
  55.             $out .= '</tr>';
  56.             $out .= '<tr style="background-color: #FFFFDD">';
  57.             $out .= '<td>Time:</th>';
  58.             $out .= '<td>'.$message->Created.'</th>';
  59.             $out .= '</tr>';
  60.             $out .= '<tr style="background-color: #FFFFDD">';
  61.             $out .= '<td style="border:1pt solid black;">Comment:</th>';
  62.             $out .= '<td style="border:1pt solid black;"><pre>'.$content.'</pre></th>';
  63.             $out .= '</tr>';
  64.         }
  65.     }
  66. }
  67.  
  68. if ($out ne '') {
  69.     $finalout .= '<table style="text-align:left;border-collapse: collapse;border:1pt solid black;">';
  70.     $finalout .= $out;
  71.     $finalout;
  72. }
  73. ### END MULTLINE PERL BLOCK
  74. }
RAW Paste Data