[rt-users] patch to avoid error when transactions refer to URIs of *purged* tickets

Dirk Pape pape-rt at inf.fu-berlin.de
Mon Sep 1 12:02:41 EDT 2003


Situation:

if you use the purgedead script to purge deleted tickets entirely from the 
database, links and all other stuff related to the ticket are purged also.

BUT:
if some other ticket refers to the purged ticket - even if the link has 
been deleted - showing history fails a hard error page, which is resolved 
by my attached patch.


EXPLANATION:

the recorded transactions for adding or deleting links to the purged 
tickets are not purged (and should not).

When trying to display the Description of the transaction, RT tries to load 
the Object, which does not reside in database any more, failing with the 
error below. The patch avoids asking the object for its URI, when it is not 
found in the database.

error:  Can't call method "Id" on an undefined value at 
/export/rt3/lib/RT/URI/fsck_com_rt.pm line 234.

context:  ...  

229:  =cut
230:  
231:  sub AsString {
232:  my $self = shift;
233:  if ($self->IsLocal) {
234:  return $self->loc("ticket #[_1]", $self->Object->Id);
235:  
236:  }
237:  else {

...  

code stack:  
/export/rt3/lib/RT/URI/fsck_com_rt.pm:233
/export/rt3/lib/RT/Transaction_Overlay.pm:655
/export/rt3/local/html/Ticket/Elements/ShowTransaction:28
/export/rt3/local/html/Ticket/Elements/ShowHistory:79
/export/rt3/local/html/Ticket/Display.html:37
/export/rt3/share/html/autohandler:163
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rt_uri.patch
Type: application/octet-stream
Size: 688 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20030901/b0aa7240/attachment.obj>


More information about the rt-users mailing list