]> source.dussan.org Git - redmine.git/commitdiff
Fix missing project_id in redirect after clicking "Create and add another" button...
authorGo MAEDA <maeda@farend.jp>
Sun, 5 Feb 2023 23:30:46 +0000 (23:30 +0000)
committerGo MAEDA <maeda@farend.jp>
Sun, 5 Feb 2023 23:30:46 +0000 (23:30 +0000)
Patch by Jérôme BATAILLE.

git-svn-id: https://svn.redmine.org/redmine/trunk@22096 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/timelog_controller.rb
test/functional/timelog_controller_test.rb

index d4caca0f6a64ce03f0f5aeee8950fa67e567cc35..f6859597afc200faab8d514faff64df7495ab954 100644 (file)
@@ -131,6 +131,7 @@ class TimelogController < ApplicationController
               :back_url => params[:back_url]
             }
             if params[:project_id] && @time_entry.project
+              options[:time_entry][:project_id] ||= @time_entry.project.id
               redirect_to new_project_time_entry_path(@time_entry.project, options)
             elsif params[:issue_id] && @time_entry.issue
               redirect_to new_issue_time_entry_path(@time_entry.issue, options)
index c0c923377aeca7c0e19e53a586cfe6a399c740ff..5aa5eec7c369a0e789bd8fb0bb35f845c7c177c1 100644 (file)
@@ -471,7 +471,7 @@ class TimelogControllerTest < Redmine::ControllerTest
         },
         :continue => '1'
       }
-      assert_redirected_to '/projects/ecookbook/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D=&time_entry%5Bspent_on%5D=2008-03-14'
+      assert_redirected_to '/projects/ecookbook/time_entries/new?time_entry%5Bactivity_id%5D=11&time_entry%5Bissue_id%5D=&time_entry%5Bproject_id%5D=1&time_entry%5Bspent_on%5D=2008-03-14'
     end
   end