<%INIT>
$COLUMN_MAP->{'Subject'}->{'value'} = sub {
	my ($Ticket, $subject, $sth, $ref, $TicketComments, $CommentsSeen);

	$Ticket = $_[0];
	$subject = $Ticket->Subject || '(' . loc('No subject') . ')';
	return $subject if (not $session{'CurrentUser'});

	$sth = $RT::Handle->dbh->prepare ('SELECT COUNT(DISTINCT Transactions.id) AS comments FROM Transactions JOIN Attachments ON Transactions.id = Attachments.TransactionId WHERE Transactions.ObjectType="RT::Ticket" AND Transactions.Type IN ("Comment","Correspond","Create") AND Transactions.ObjectId=?');
	$sth->execute ($Ticket->id);
	$ref = $sth->fetchrow_hashref ();
	$sth->finish ();
	$TicketComments = (defined $ref ? $ref->{'comments'} : 0) || 0;

	$sth = $RT::Handle->dbh->prepare ('SELECT Comments AS comments FROM CommentsSeen WHERE UserId=? AND TicketId=?');
	$sth->execute ($session{'CurrentUser'}->id, $Ticket->id);
	$ref = $sth->fetchrow_hashref ();
	$sth->finish ();
	$CommentsSeen = (defined $ref && defined $ref->{'comments'}) ? $ref->{'comments'} : 0;

	return $subject if ($CommentsSeen == $TicketComments);

	$subject = $m->interp->apply_escapes($subject => 'h');

	$subject = '<small class="noprint"><sup>'.($CommentsSeen==0?'*':loc('UPDATED')).'</sup> </small>'.$subject;
	return \$subject;
};
</%INIT>
<%args>
$COLUMN_MAP => undef
</%args>
