Bug in Ticket History

I have been struggling to narrow down and fix a bug we have in our
Ticket Histories. Every once in a while the function $self->OldValue
will return a random value when in fact it should be NULL. I have no
idea why it does this, but it seems if it fails once, the rest of the
CustomField elements that have been “Added” will show that they changed
from the random value to the current “NewValue”. Also it has been
reported to me that random $self->NewValue will happen as well,
resulting in corrupt History data. Any known bugs associated with
CustomFields and the ticket history display? So far I’ve narrowed the
issue down to Transaction_Overlay.pm and $self->OldValue and/or
$self->NewValue.

We are using:

Apache2

Mod_Perl2.2

RT 3.4.5

Joshua Speicher
Web Developer
TekSecure Labs (sm)
(a division of Tekmark Global Solutions)

This message is for the designated recipient only and it, as well as any attachments, may contain privileged, proprietary or confidential information. If you are not the intended recipient, do not read, copy or distribute it. Please notify the sender immediately and delete the original at once. Any other use of the email by you is prohibited. Thank you.

Example of Bug:

What is Seen:

Fri Aug 18 13:25:46 2006 jps - Report

Source (n/a) changed to (LN Customer Support)

Fri Aug 18 13:25:46 2006 jps -

Investigation Summary (n/a) changed to (234566)

Fri Aug 18 13:25:46 2006 jps - Public

Records Access (n/a) changed to (Yes)

Fri Aug 18 13:25:46 2006 jps -

Customer Company (n/a) changed to (she)

Fri Aug 18 13:25:46 2006 jps -

Exception Number (n/a) changed to (it)

What it Should be:

Fri Aug 18 13:25:46 2006 jps - Report

Source (LN Customer Support) Added

Fri Aug 18 13:25:46 2006 jps -

Investigation Summary (234566) Added

Fri Aug 18 13:25:46 2006 jps - Public

Records Access (Yes) Added

Fri Aug 18 13:25:46 2006 jps -

Customer Company (she) Added

Fri Aug 18 13:25:46 2006 jps -

Exception Number (it) Added

Narrowed bug down to something with $self->OldValue

Joshua Speicher

This message is for the designated recipient only and it, as well as any attachments, may contain privileged, proprietary or confidential information. If you are not the intended recipient, do not read, copy or distribute it. Please notify the sender immediately and delete the original at once. Any other use of the email by you is prohibited. Thank you.

Think I might have found the problem. Seem sub OldValue and sub
NewValue in Transaction_Overlay.pm was trying to load a
ObjectCustomFieldValue of NULL. Modified it to the following and we are
testing so far shows it has fixed our issue.

sub OldValue {

my $self = shift;

if (my $type = $self->__Value('ReferenceType')) {

    my $Object = $type->new($self->CurrentUser);

    if($self->__Value('OldReference') eq ''){

            return undef;

    }

    else{

            $Object->Load($self->__Value('OldReference'));

            return $Object->Content;

    }

}

else {

    return $self->__Value('OldValue');

}

}

sub NewValue {

my $self = shift;

if (my $type = $self->__Value('ReferenceType')) {

    my $Object = $type->new($self->CurrentUser);

    if($self->__Value('NewReference') eq ''){

        return undef;

    }

    else{

        $Object->Load($self->__Value('NewReference'));

        return $Object->Content;

    }

}

else {

    return $self->__Value('NewValue');

}

}

Joshua Speicher
Web Developer
TekSecure Labs (sm)
(a division of Tekmark Global Solutions)From: rt-devel-bounces@lists.bestpractical.com
[mailto:rt-devel-bounces@lists.bestpractical.com] On Behalf Of Speicher,
Joshua (TekSecure Labs)
Sent: Monday, August 21, 2006 1:42 PM
To: rt-devel@lists.bestpractical.com
Subject: RE: [Rt-devel] Bug in Ticket History

Example of Bug:

What is Seen:

Fri Aug 18 13:25:46 2006 jps - Report

Source (n/a) changed to (LN Customer Support)

Fri Aug 18 13:25:46 2006 jps -

Investigation Summary (n/a) changed to (234566)

Fri Aug 18 13:25:46 2006 jps - Public

Records Access (n/a) changed to (Yes)

Fri Aug 18 13:25:46 2006 jps -

Customer Company (n/a) changed to (she)

Fri Aug 18 13:25:46 2006 jps -

Exception Number (n/a) changed to (it)

What it Should be:

Fri Aug 18 13:25:46 2006 jps - Report

Source (LN Customer Support) Added

Fri Aug 18 13:25:46 2006 jps -

Investigation Summary (234566) Added

Fri Aug 18 13:25:46 2006 jps - Public

Records Access (Yes) Added

Fri Aug 18 13:25:46 2006 jps -

Customer Company (she) Added

Fri Aug 18 13:25:46 2006 jps -

Exception Number (it) Added

Narrowed bug down to something with $self->OldValue

Joshua Speicher

This message is for the designated recipient only and it, as well as any attachments, may contain privileged, proprietary or confidential information. If you are not the intended recipient, do not read, copy or distribute it. Please notify the sender immediately and delete the original at once. Any other use of the email by you is prohibited. Thank you.

Thanks, similar patch has been applied to 3.4.HEAD would be part of 3.4.6.On 8/22/06, Speicher, Joshua (TekSecure Labs) JSpeicher@teksecurelabs.com wrote:

Think I might have found the problem. Seem sub OldValue and sub NewValue in
Transaction_Overlay.pm was trying to load a ObjectCustomFieldValue of NULL.
Modified it to the following and we are testing so far shows it has fixed
our issue.

sub OldValue {

my $self = shift;

if (my $type = $self->__Value('ReferenceType')) {

    my $Object = $type->new($self->CurrentUser);

    if($self->__Value('OldReference') eq ''){

            return undef;

    }

    else{

$Object->Load($self->__Value(‘OldReference’));

            return $Object->Content;

    }

}

else {

    return $self->__Value('OldValue');

}

}

sub NewValue {

my $self = shift;

if (my $type = $self->__Value('ReferenceType')) {

    my $Object = $type->new($self->CurrentUser);

    if($self->__Value('NewReference') eq ''){

        return undef;

    }

    else{

        $Object->Load($self->__Value('NewReference'));

        return $Object->Content;

    }

}

else {

    return $self->__Value('NewValue');

}

}

Joshua Speicher
Web Developer
TekSecure Labs (sm)
(a division of Tekmark Global Solutions)


From: rt-devel-bounces@lists.bestpractical.com
[mailto:rt-devel-bounces@lists.bestpractical.com] On Behalf
Of Speicher, Joshua (TekSecure Labs)
Sent: Monday, August 21, 2006 1:42 PM
To: rt-devel@lists.bestpractical.com
Subject: RE: [Rt-devel] Bug in Ticket History

Example of Bug:

What is Seen:

Fri Aug 18 13:25:46 2006 jps - Report

Source (n/a) changed to (LN Customer Support)

Fri Aug 18 13:25:46 2006 jps -

Investigation Summary (n/a) changed to (234566)

Fri Aug 18 13:25:46 2006 jps - Public

Records Access (n/a) changed to (Yes)

Fri Aug 18 13:25:46 2006 jps - Customer

Company (n/a) changed to (she)

Fri Aug 18 13:25:46 2006 jps - Exception

Number (n/a) changed to (it)

What it Should be:

Fri Aug 18 13:25:46 2006 jps - Report

Source (LN Customer Support) Added

Fri Aug 18 13:25:46 2006 jps -

Investigation Summary (234566) Added

Fri Aug 18 13:25:46 2006 jps - Public

Records Access (Yes) Added

Fri Aug 18 13:25:46 2006 jps - Customer

Company (she) Added

Fri Aug 18 13:25:46 2006 jps - Exception

Number (it) Added

Narrowed bug down to something with $self->OldValue

Joshua Speicher


This message is for the designated recipient only and it, as well as any
attachments, may contain privileged, proprietary or confidential
information. If you are not the intended recipient, do not read, copy or
distribute it. Please notify the sender immediately and delete the original
at once. Any other use of the email by you is prohibited. Thank you.


List info:
The rt-devel Archives

Best regards, Ruslan.