TransactionAttach

From Request Tracker Wiki
Jump to navigation Jump to search

Patch for Transaction_Overlay.pm

Function: _Attach

The original function always returns an RT::Attachment object, which passes for an id in the calling function. The effect is that when the (often inexplicable) "mysql server has gone away" clobbers RT::Transaction::Create, and a subsequent RT::Attachment::Create fails, the calling RT::Transaction object merrily marches ahead and processes scrips (probably sending autoreplies) for a ticket that will never make it into the database. The patch replaces the RT::Attachement object with the $id of the attachment (or zero when RT::Attachement::Create fails) as expected by the calling function. So, instead of a phantom ticket, the requestor gets a message telling him that the ticket did not materialize, and he can proceed accordingly.

  1. cat /opt/rt3/patches/Transaction_Overlay.patch
*** /lib/RT/Transaction_Overlay.pm      Tue Apr  1 16:36:01 2008
 --- /lib/RTTransaction_Overlay.pm       Tue Apr  1 22:47:18 2008
 ***************
 *** 507,513 ****
           TransactionId => $self->Id,
           Attachment    => $MIMEObject
       );
 !     return ( $Attachment, $msg || $self->loc("Attachment created") );
 
   }
 
 --- 507,513 ----
           TransactionId => $self->Id,
           Attachment    => $MIMEObject
       );
 !     return ($id || 0,  $msg || $self->loc("Attachment created") );
 
   }