made it work in redmine 2.3.1

* made use of new queries model
* reduced redmine patching
* using ActiveSupport::Concern style patching