Fixed filter for StateType in OpenProblem Cronk

Thanks David Mikulski

(fixes #4317)
Fixed ConsoleCommandModel to escape single quotes correctly

(fixes #4455)
Fixed DISTINCT error on PostgreSQL when using customvar filters

Occured in host status grids.

(fixes #4564)