Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown column projects.status in where clause on redmine 3.0.3 for non-admin users #60

Open
ppoektos opened this issue May 28, 2015 · 1 comment

Comments

@ppoektos
Copy link

If I sort by User I got Internal error.

Environment:
  Redmine version                3.0.3.stable.14266
  Ruby version                   1.9.3-p327 (2012-11-10) [i686-linux]
  Rails version                  4.2.1
  Environment                    production
  Database adapter               Mysql2
Started POST "/timesheet/report" for 127.0.0.1 at 2015-05-28 14:28:03 +0200
Processing by TimesheetController#report as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"t4a/779Fa6rMu+2Dn5BQXRlXvllwQeucwjUIv/8e/X6P6CDK5upqDUVyCUD0zTUEa3Dt1/2NetKCIMaDeCtWvg==", "timesheet"=>{"period_type"=>"1", "period"=>"last_week", "date_from"=>"2015-05-28", "date_to"=>"2015-05-28", "sort"=>"user", "projects"=>["78", "404", "429", "430", "92", "93", "296", "295", "351", "356", "412", "388", "516", "472", "475", "512", "518", "523", "528", "544", "195", "9", "470", "411", "86"], "activities"=>["8", "9", "11", "12", "17", "19", "20", "30", "31", "37", "54", "56", "60", "62", "21", "64", "65", "66", "67", "75", "102", "161", "162", "165"], "users"=>["31"]}, "commit"=>"Apply"}
  Current user: jenkins (id=44)
Mysql2::Error: Unknown column 'projects.status' in 'where clause': SELECT COUNT(*) FROM `time_entries` WHERE (spent_on >= ('2015-05-18') AND spent_on <= ('2015-05-24') AND time_entries.project_id IN (92,93,295,296,351,412,356,388,404,429,430,516,472,475,512,518,523,528,544,195,9,470,411,78,86) AND user_id IN (31) AND activity_id IN (8,13,16,42,71,79,114,129,149,176,184,192,205,222,243,256,267,276,289,299,312,328,9,18,43,72,80,115,130,145,150,177,185,193,206,223,244,257,268,277,290,300,313,11,14,40,68,76,112,124,151,194,207,224,245,258,269,278,291,301,314,329,12,15,41,69,77,113,126,146,152,178,186,195,208,225,246,259,270,279,292,302,315,330,17,45,83,108,118,133,153,196,209,226,237,247,260,271,280,303,316,342,19,47,86,136,154,175,197,210,227,238,248,281,293,304,317,20,48,87,121,137,147,155,167,198,211,228,239,249,261,272,282,305,318,30,38,39,46,85,110,120,135,156,168,179,187,212,229,240,250,262,273,283,294,306,319,331,31,49,88,111,138,169,180,188,199,213,230,241,263,284,320,37,44,81,106,116,131,148,170,181,189,200,214,231,242,251,264,274,285,295,307,321,54,59,74,89,122,142,157,171,182,190,201,215,232,252,265,275,286,296,308,322,56,58,70,78,127,158,172,183,202,216,233,253,287,309,323,332,60,73,82,104,107,117,132,159,173,203,217,234,254,266,288,297,310,324,62,84,97,105,109,119,134,160,191,204,218,235,255,298,311,325,333,343,21,50,100,143,219,64,98,139,220,65,101,144,221,66,95,125,174,327,67,96,128,75,90,99,140,236,326,334,102,103,141,335,161,163,336,162,164,337,165,166,338) AND ((projects.status = 1) AND (projects.id IN (78) OR projects.id IN (518))))
Completed 500 Internal Server Error in 184ms (ActiveRecord: 56.6ms)

ActiveRecord::StatementInvalid (Mysql2::Error: Unknown column 'projects.status' in 'where clause': SELECT COUNT(*) FROM `time_entries` WHERE (spent_on >= ('2015-05-18') AND spent_on <= ('2015-05-24') AND time_entries.project_id IN (92,93,295,296,351,412,356,388,404,429,430,516,472,475,512,518,523,528,544,195,9,470,411,78,86) AND user_id IN (31) AND activity_id IN (8,13,16,42,71,79,114,129,149,176,184,192,205,222,243,256,267,276,289,299,312,328,9,18,43,72,80,115,130,145,150,177,185,193,206,223,244,257,268,277,290,300,313,11,14,40,68,76,112,124,151,194,207,224,245,258,269,278,291,301,314,329,12,15,41,69,77,113,126,146,152,178,186,195,208,225,246,259,270,279,292,302,315,330,17,45,83,108,118,133,153,196,209,226,237,247,260,271,280,303,316,342,19,47,86,136,154,175,197,210,227,238,248,281,293,304,317,20,48,87,121,137,147,155,167,198,211,228,239,249,261,272,282,305,318,30,38,39,46,85,110,120,135,156,168,179,187,212,229,240,250,262,273,283,294,306,319,331,31,49,88,111,138,169,180,188,199,213,230,241,263,284,320,37,44,81,106,116,131,148,170,181,189,200,214,231,242,251,264,274,285,295,307,321,54,59,74,89,122,142,157,171,182,190,201,215,232,252,265,275,286,296,308,322,56,58,70,78,127,158,172,183,202,216,233,253,287,309,323,332,60,73,82,104,107,117,132,159,173,203,217,234,254,266,288,297,310,324,62,84,97,105,109,119,134,160,191,204,218,235,255,298,311,325,333,343,21,50,100,143,219,64,98,139,220,65,101,144,221,66,95,125,174,327,67,96,128,75,90,99,140,236,326,334,102,103,141,335,161,163,336,162,164,337,165,166,338) AND ((projects.status = 1) AND (projects.id IN (78) OR projects.id IN (518))))):
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `query'
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `block in execute'
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
  activesupport (4.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract_mysql_adapter.rb:299:in `execute'
  activerecord (4.2.1) lib/active_record/connection_adapters/mysql2_adapter.rb:231:in `execute'
  activerecord (4.2.1) lib/active_record/connection_adapters/mysql2_adapter.rb:235:in `exec_query'
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract/database_statements.rb:347:in `select'
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract/database_statements.rb:32:in `select_all'
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `block in select_all'
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract/query_cache.rb:83:in `cache_sql'
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract/query_cache.rb:68:in `select_all'
  activerecord (4.2.1) lib/active_record/relation/calculations.rb:264:in `execute_simple_calculation'
  activerecord (4.2.1) lib/active_record/relation/calculations.rb:221:in `perform_calculation'
  activerecord (4.2.1) lib/active_record/relation/calculations.rb:127:in `calculate'
  activerecord (4.2.1) lib/active_record/relation/calculations.rb:42:in `count'
  activerecord (4.2.1) lib/active_record/relation.rb:268:in `empty?'
  plugins/redmine_timesheet_plugin/app/models/timesheet.rb:393:in `block in fetch_time_entries_by_user'
  plugins/redmine_timesheet_plugin/app/models/timesheet.rb:377:in `each'
  plugins/redmine_timesheet_plugin/app/models/timesheet.rb:377:in `fetch_time_entries_by_user'
  plugins/redmine_timesheet_plugin/app/models/timesheet.rb:93:in `fetch_time_entries'
  plugins/redmine_timesheet_plugin/app/controllers/timesheet_controller.rb:59:in `report'
  actionpack (4.2.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (4.2.1) lib/abstract_controller/base.rb:198:in `process_action'
  actionpack (4.2.1) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (4.2.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
  activesupport (4.2.1) lib/active_support/callbacks.rb:117:in `call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:117:in `call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
  activesupport (4.2.1) lib/active_support/callbacks.rb:505:in `call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:505:in `call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:92:in `_run_callbacks'
  activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_process_action_callbacks'
  activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (4.2.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
  actionpack (4.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
  activesupport (4.2.1) lib/active_support/notifications.rb:164:in `block in instrument'
  activesupport (4.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.2.1) lib/active_support/notifications.rb:164:in `instrument'
  actionpack (4.2.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  actionpack (4.2.1) lib/action_controller/metal/params_wrapper.rb:250:in `process_action'
  activerecord (4.2.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (4.2.1) lib/abstract_controller/base.rb:137:in `process'
  actionview (4.2.1) lib/action_view/rendering.rb:30:in `process'
  actionpack (4.2.1) lib/action_controller/metal.rb:196:in `dispatch'
  actionpack (4.2.1) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
  actionpack (4.2.1) lib/action_controller/metal.rb:237:in `block in action'
  actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `call'
  actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:74:in `dispatch'
  actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:43:in `serve'
  actionpack (4.2.1) lib/action_dispatch/journey/router.rb:43:in `block in serve'
  actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `each'
  actionpack (4.2.1) lib/action_dispatch/journey/router.rb:30:in `serve'
  actionpack (4.2.1) lib/action_dispatch/routing/route_set.rb:819:in `call'
  rack-openid (1.4.2) lib/rack/openid.rb:98:in `call'
  request_store (1.0.5) lib/request_store/middleware.rb:9:in `call'
  rack (1.6.1) lib/rack/etag.rb:24:in `call'
  rack (1.6.1) lib/rack/conditionalget.rb:38:in `call'
  rack (1.6.1) lib/rack/head.rb:13:in `call'
  actionpack-xml_parser (1.0.2) lib/action_dispatch/xml_params_parser.rb:16:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/flash.rb:260:in `call'
  rack (1.6.1) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.6.1) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/cookies.rb:560:in `call'
  activerecord (4.2.1) lib/active_record/query_cache.rb:36:in `call'
  activerecord (4.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:649:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `call'
  activesupport (4.2.1) lib/active_support/callbacks.rb:88:in `_run_callbacks'
  activesupport (4.2.1) lib/active_support/callbacks.rb:776:in `_run_call_callbacks'
  activesupport (4.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (4.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.2.1) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.2.1) lib/rails/rack/logger.rb:20:in `block in call'
  activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `block in tagged'
  activesupport (4.2.1) lib/active_support/tagged_logging.rb:26:in `tagged'
  activesupport (4.2.1) lib/active_support/tagged_logging.rb:68:in `tagged'
  railties (4.2.1) lib/rails/rack/logger.rb:20:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.6.1) lib/rack/methodoverride.rb:22:in `call'
  rack (1.6.1) lib/rack/runtime.rb:18:in `call'
  activesupport (4.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
  actionpack (4.2.1) lib/action_dispatch/middleware/static.rb:113:in `call'
  rack (1.6.1) lib/rack/sendfile.rb:113:in `call'
  railties (4.2.1) lib/rails/engine.rb:518:in `call'
  railties (4.2.1) lib/rails/application.rb:164:in `call'
  railties (4.2.1) lib/rails/railtie.rb:194:in `public_send'
  railties (4.2.1) lib/rails/railtie.rb:194:in `method_missing'
  unicorn (4.5.0) lib/unicorn/http_server.rb:552:in `process_client'
  unicorn (4.5.0) lib/unicorn/http_server.rb:628:in `worker_loop'
  unicorn (4.5.0) lib/unicorn/http_server.rb:500:in `spawn_missing_workers'
  unicorn (4.5.0) lib/unicorn/http_server.rb:142:in `start'
  unicorn (4.5.0) bin/unicorn_rails:209:in `<top (required)>'
  /usr/local/rvm/gems/ruby-1.9.3-p327/bin/unicorn_rails:19:in `load'
  /usr/local/rvm/gems/ruby-1.9.3-p327/bin/unicorn_rails:19:in `<main>'
  /usr/local/rvm/gems/ruby-1.9.3-p327/bin/ruby_executable_hooks:15:in `eval'
  /usr/local/rvm/gems/ruby-1.9.3-p327/bin/ruby_executable_hooks:15:in `<main>'
@haritonov
Copy link

There is a problem with ActiveRecord chain.

Solution #62

SashaH added a commit to speedandfunction/redmine_timesheet_plugin that referenced this issue Jan 21, 2016
SashaH added a commit to speedandfunction/redmine_timesheet_plugin that referenced this issue Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants