hicknhack-software / redmine_time_tracker

A time tracker plugin for Redmine
Other
106 stars 32 forks source link

Remove Project fail because TimeTracker "check_bookable" #212

Closed xstable closed 7 years ago

xstable commented 7 years ago

I try to remove an old Project out of my Redmine. If I start the delete-process, it abort, and give me this in the Logfile:

Started DELETE "/projects/schnuff-und-co" for 127.8.174.1 at 2016-10-19 12:11:25 -0400
Processing by ProjectsController#destroy as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"yBxxxxxxTwvxGMnyUoxxxxxxxxxxxxxx8w=", "confirm"=>"1", "commit"=>"Löschen", "id"=>"schnuff-und-co"}
  Current user: admin (id=1)
Completed 500 Internal Server Error in 5822.1ms

NoMethodError (undefined method `check_bookable' for nil:NilClass):
  app/models/issue.rb:179:in `destroy'
  lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb:455:in `block (2 levels) in destroy_descendants'
  lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb:453:in `block in destroy_descendants'
  lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb:426:in `in_tenacious_transaction'
  lib/plugins/awesome_nested_set/lib/awesome_nested_set/awesome_nested_set.rb:443:in `destroy_descendants'
  app/models/issue.rb:179:in `destroy'
  app/controllers/projects_controller.rb:236:in `destroy'

Please can you help me to fix this?

jume-dev commented 7 years ago

Change the line 65 of app/models/time_booking.rb from self.time_log.check_bookable to self.time_log.check_bookable if self.time_log

This is only a quick fix for the case you mentioned, i need to take a closer look first, before i can make a proper bugfix release.

xstable commented 7 years ago

Nothing changed, same error.

What if i only comment this line out?

jume-dev commented 7 years ago

Strange, that should have worked. But yeah, sure, try that. But make sure to comment it back in, if you are done deleting projects.

xstable commented 7 years ago

Same error. Have I to do some rake-commands or something else ?

jume-dev commented 7 years ago

Did you restart your server after you changed the code?

xstable commented 7 years ago

Ok, now it works. Didn't know I have to reboot the server. Thanks a lot.