Implementing policies

How are people on this list dealing with ticket policies? For instance,
I would like to prevent people from closing tickets if they did not
specify how long they worked on the ticket. Or prevent any ticket from
being closed on the General queue.

Currently, I have hacked up the code in the html files to deal with
this. However it is not scaling well and feels a bit of a kluge.

Can this be handled in the library somehow? Can I fail an operation and
return a useful “Tickets must have time worked to be closed” message?