The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
<%ARGS>
$Ticket
$actions
</%ARGS>

<%INIT>
return unless $Ticket;
if ( my $right = $RT::Ticket::CheckRightOnLock{'Hard'} ) {
    return unless $Ticket->CurrentUserHasRight( $right );
}

if (my $Lock = $Ticket->Locked()) {
    if ( $Lock->Content->{'User'} == $session{'CurrentUser'}->id ) {
        $actions->{'Lock'} = {
            path  => "Ticket/Display.html?Lock=remove&id=" . $Ticket->Id,
            title => loc('Unlock') 
        };
    } else {
        $actions->{'Lock'} = {
            path  => "Ticket/Display.html?Lock=break&id=" . $Ticket->Id,
            title => loc('Break lock') 
        };
    }
} else {
    $actions->{'Lock'} = {
        path  => "Ticket/Display.html?Lock=add&id=". $Ticket->Id,
        title => loc('Lock') 
    };
}
</%INIT>