Retrieve the list of tickets states from the database

Instead of use predefined states, get the list of states
querying the database. States are retrieved from issues_log
table