software-project / scrum-pm

Scrum PM is a plugin for Redmine ticket management system. It adds Scrum items like backlog, dashboard and others.
www.software-project.eu/EN/scrumpm
126 stars 47 forks source link

Patch for exception after issue creation #63

Open mateuszdraco opened 13 years ago

mateuszdraco commented 13 years ago

Creating issue on Dashboard site lead to exception. Solution:

/lib/hooks.rb
@@ -6,8 +6,13 @@ module RedmineSprints
     def controller_issues_new_before_save(context = {})
       context[:issue].user_story_id = context[:params][:issue][:user_story_id]
       if context[:issue].user_story_id && context[:issue].fixed_version_id
-        context[:issue].redirect_to = url_for(:controller => :sprints, :action => "show", :id => context[:issue].fixed_version_id, :project_id => context[:issue].project.identifier)+"/"+context[:issue].id
+       if context[:issue].id
+          context[:issue].redirect_to = url_for(:controller => :sprints, :action => "show", :id => context[:issue].fixed_version_id, :project_id => context[:issue].project.identifier)+"/"+context[:issue].id
+        else
+          context[:issue].redirect_to = url_for(:controller => :sprints, :action => "show", :id => context[:issue].fixed_version_id, :project_id => context[:issue].project.identifier)
+        end
+        puts ":controller_issues_new_before_save 99"
       end
     end
pabloalba commented 13 years ago

Thank you! This error was becoming me nuts!

cleocir commented 13 years ago

this path solved same problem with redmine 1.1.3