maxrossello / redmine_app_timesheets

A true timesheet plugin using orders, not bound to timelogs over issues
GNU General Public License v2.0
32 stars 10 forks source link

500 Internal error (Redmine 3.2) #73

Closed morganseznec closed 8 years ago

morganseznec commented 8 years ago

Hi,

After installing redmine_app_timesheets I got a Internal error message when I try to create a new project.

Environment: Redmine version 3.2.0.stable Ruby version 2.0.0-p598 (2014-11-13) [x86_64-linux] Rails version 4.2.5

And the logs:

Started GET "/projects/new" for 46.105.39.151 at 2015-12-23 16:05:44 +0100 Processing by ProjectsController#new as HTML Current user: admin (id=1) Rendered projects/new.html.erb within layouts/base (28.7ms) Completed 500 Internal Server Error in 457ms (ActiveRecord: 31.7ms)

ActionView::Template::Error (private method open' called for nil:NilClass): 21: <% end %> 22: 23: <% if Redmine::VERSION.to_s >= '3.2' %> 24: <% if @project.safe_attribute?('default_version_id') && (default_version_options = project_default_version_options(@project)).present? %> 25: <p><%= f.select :default_version_id, project_default_version_options(@project), :include_blank => true %></p> 26: <% end %> 27: <% end %> app/helpers/projects_helper.rb:91:inproject_default_version_options' app/views/projects/new.html.erb:4:in block in _b4233c4b7a95ffddc7b15d2acb52a042' app/helpers/application_helper.rb:1030:inlabelled_form_for' app/views/projects/new.html.erb:3:in _b4233c4b7a95ffddc7b15d2acb52a042' lib/redmine/sudo_mode.rb:63:insudo_mode'

After some research this issue appears just after having installed this plugin.

This issue can be easily reproduce by following these steps :

maxrossello commented 8 years ago

Hi, still haven't had time to run Redmine 3.2. Sudo mode is something recent in Redmine. Please stick to 3.0 for the moment.

greyman888 commented 8 years ago

Hi Max,

I don't know if this helps but I think that the problem is related to this commit in Redmine 3.2:

https://github.com/redmine/redmine/commit/9178d4748f19adee08e5b9d58ea1176836249eb6

skibinstein commented 8 years ago

Hi,

Any update on this issue?

pbaldassarre commented 8 years ago

HI, news on version 3.2 ?

maxrossello commented 8 years ago

I'm sorry guys, my company is sticking to older Redmine and I have no effort to spend right now. I would welcome any code contribution. Thanks

sammcj commented 8 years ago

totally understand @maxrossello, to put it out there - if anyone is able to help maintain, cleanup and keep this plugin up to date I might be able to donate a small amount of $$ towards the effort, I'd have to clear it pass my manager first - we use it every day but we are a non-profit, charitible organisation so I just have to check first. Let me know if anyone is interested.

greyman888 commented 8 years ago

Hi. Sorry it took me so long to come back to this. I have submitted a PR to fix it.

The challenge was making sure that the PR fixes it without causing other problems. This time I used the Redmine test suite with some small hacks.

My test setup is a little out-of-date but OK I think: Redmine version: 3.2.0 Ruby version: 2.2.1 Rails version: 4.2.5

if Rails.env = "test"
    ts_project = 7
else
    ts_project = Setting.plugin_redmine_app_timesheets['project'].to_i
end

I then ran the Redmine test suite. All the tests that involve custom fields threw errors because TS_FIELD_NAME isn't defined but pretty much everything else passed. Considering this shouldn't even really work at all, I was pretty happy with the outcome.

I followed this up with manual testing in a running version of Redmine and I couldn't find any problems.

When I can make the time, I'll set up a Redmine 3.3 instance and test it again.

greyman888 commented 8 years ago

I should clarify that the additional code I used to make the Redmine test suite pass was only temporary and it is not part of the PR.

maxrossello commented 8 years ago

yeah, of course :-) thank you Adam for the contribution! I will spin my set of manual tests and merge it asap