%# Osborn's Law:
%#       Variables won't; constants aren't.
<%PERL>
if (my $obj = $m->comp("/Work/Tickets/Attachment", %ARGS, NoUI => 1)) {
    my $queue = $obj->TransactionObj->TicketObj->QueueObj;
    my $count_all = $queue->Attribute('Download');
    my $count_this = $obj->Attribute('Download');
    if ($count_all < $count_this) {
	$queue->SetAttribute('Download', $count_this + 1);
    }
    else {
	$queue->SetAttribute('Download', $count_all + 1);
    }
    $obj->SetAttribute('Download', $count_this + 1);
}
$m->abort;
</%PERL>
<%ATTR>
AutoFlush => 0
</%ATTR>
