Address various lint related bugs, typos, and hints

Also includes changes for the ticket advanced search to make use of a dynamic pivot table rather than multiple joins to nested subqueries for each searched custom field