More unit tests for TicketNotFlag search

also fix a whitespace SQL generation bug when more than one NotTicketFlag
search option is given