oops: Fix numerous, small issues introduced in merges

oops: Fix crash upgrading to c7c82835

oops: Fix crash rendering ticket view

oops: Fix crash posting response to ticket

oops: Fix refresh url after ticket reply post

orm: Locate annotations after the root model's fields

orm: Add PK field check for DISTINCT aggregate expressions

When using the DISTINCT option for aggregate expressions, ensure that when a
relationship is used in the aggregate, that a single field of the remote
model's primary key is used — rather than the foreign key, since it would
never have more than one unique value.

search: Re-implement basic ticket search

oops: Couple trivial changes

oops: Fix date formatting for PDF output

oops: Fix staff profile view and update

oops: Fix canned response listing

orm: Fix crash compiling WHERE IN (nested select)

nav: Move settings/email to email/settings

i18n: Make field visibility config translatable

oops: Fix crash adding field to custom form

forms: Fix `required` flag transfer to FormField

oops: Fix bad merge on new ticket by staff

forms: Show uneditable fields on new ticket by staff

oops: Fix bad merge on client ticket view
oops: Bug fixes

Conflicts:

	include/i18n/en_US/form.yaml
	include/staff/templates/dynamic-field-config.tmpl.php
	include/staff/ticket-view.inc.php
	include/staff/tickets.inc.php
	scp/js/scp.js
orm: Convert staff directory to ORM
orm: Make client ticket list ORM based