Critical error after upgrading to RT 4.4.0

Hi,

Here is an update with an additional check that LastUpdater exists to keep from filling the log with noise.

Regards,
Ken


<%INIT>

Show status in colour using inline style.

sub statusInColor {
my $Ticket = shift;
my $status = $Ticket->Status;
my %style = (
new => ‘color: #bb0000; text-align: left; font-weight: bold;’,
open => ‘color: #0000bb; text-align: left; font-weight: bold;’,
reply => ‘color: #009900; text-align: left; font-weight: bold;’,
resolved => ‘color: #737373; text-align: left; font-weight: bold;’,
rejected => ‘color: #884444; text-align: left; font-weight: bold;’,
stalled => ‘color: #884444; text-align: left; font-weight: bold;’
);

  	my $LastUpdater = $Ticket->LastUpdatedByObj->EmailAddress;
  	my $TicketRequestors = $Ticket->Requestors->MemberEmailAddressesAsString;
  	my $TicketCC = $Ticket->Cc->MemberEmailAddressesAsString;
  	my $CurrentUser = $session{'CurrentUser'}->EmailAddress;
  
  # Added $CurentUser ne $LastUpdater to prevent showing New Reply tag when the last updater is the current user.
  	if ( defined $LastUpdater )
    {
  	    if (($CurrentUser ne $LastUpdater) && ($TicketRequestors =~ "\Q$LastUpdater\E") || ($TicketCC =~ "\Q$LastUpdater\E"))
  	    {
  		my $txn = $Ticket->SeenUpTo or return \"<div style=\"$style{$status}\">$status</div>";
  #         my $TicketLink = RT->Config->Get('WebPath') ."/Ticket/Display.html?id=". $Ticket->id. "#txn-".$txn->id;
  # Comment out the line above and uncomment the following line to mark posts as seen when following link.
	my $TicketLink = RT->Config->Get('WebPath') ."/Ticket/Display.html?id=". $Ticket->id ."&MarkAsSeen=1&Anchor=txn-" . $txn->id;
  		$status = "<div style=\"$style{$status}\">$status <a href=\"$TicketLink\"><span style=\"$style{'reply'}\">New Reply</span></a></div>";
        }
        else {
  		$status = "<div style=\"$style{$status}\">$status</div>";
        }
  	}
  	else {
  		$status = "<div style=\"$style{$status}\">$status</div>";
  	}
  
  	return \"$status";

}

Show extended status in colour. This will change the front page and other search pages where the ExtendedStatus is displayed.

sub extStatusInColor {
my $Ticket = shift;
if ( my $count = $Ticket->HasUnresolvedDependencies ) {
my $status;

  		if ( $Ticket->HasUnresolvedDependencies( Type => 'approval' )
  				or $Ticket->HasUnresolvedDependencies( Type => 'code' ) ) {
  			$status = "<em>" . loc('(pending approval)') . "</em>";
  		} else {
  			$status = "<em>" . loc('(pending [quant,_1,other ticket])',$count) . "</em>";
  			}
  		return \$status;
  	} else {
  		return statusInColor($Ticket);
  
  	}

}

Set the priority numbers to a colour.

sub PriorityInColor {
my $Ticket = shift;

  	my $priority = $Ticket->Priority;
  	my $colors = undef;
  
  # Change priority numbers to reflect your priority system.
  	if ($priority >= '50') {
  		$colors = "#FF0000";
  	} elsif ($priority >= '45') {
  		$colors = "#FF2000";
  	} elsif ($priority >= '40') {
  		$colors = "#FF4000";
  	} elsif ($priority >= '35') {
  		$colors = "#FF6A00";
  	} elsif ($priority >= '30') {
  		$colors = "#FF6600";
  	} elsif ($priority >= '25') {
  		$colors = "#FFA000";
  	} elsif ($priority >= '20') {
  		$colors = "#0033CC";
  	} elsif ($priority >= '15') {
  		$colors = "#809FFE";
  	} elsif ($priority >= '10') {
  		$colors = "#004600";
  	} elsif ($priority >= '5') {
  		$colors = "#006400";
  	} elsif ($priority >= '0') {
  		$colors = "#009000";
  	}
  
  	if ($colors) {
  		$priority = "<div style=\"color: $colors;\">$priority</div>"
  	}
  
  		return \"<b>$priority</b>";

}

Comment out any line to disable colour change.

$COLUMN_MAP->{Priority}->{value} = &PriorityInColor;
$COLUMN_MAP->{Status}->{value} = &statusInColor;
$COLUMN_MAP->{ExtendedStatus}->{value} = &extStatusInColor;

</%INIT>
<%ARGS>
$COLUMN_MAP => undef
</%ARGS>