Added an administration setting to allow issue start date to be defaulted to blank (nil) at issue creation (#2269).

Based on the patch of #2277 contributed by Mischa The Evil.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@7733 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Etienne Massip 2011-11-05 18:40:33 +00:00
parent 3284863904
commit 269014ced8
48 changed files with 99 additions and 5 deletions

View File

@ -314,7 +314,7 @@ private
render_error l(:error_no_tracker_in_project)
return false
end
@issue.start_date ||= Date.today
@issue.start_date ||= Date.today if Setting.default_issue_start_date_to_creation_date?
if params[:issue].is_a?(Hash)
@issue.safe_attributes = params[:issue]
if User.current.allowed_to?(:add_issue_watchers, @project) && @issue.new_record?

View File

@ -5,6 +5,8 @@
<p><%= setting_check_box :issue_group_assignment %></p>
<p><%= setting_check_box :default_issue_start_date_to_creation_date %></p>
<p><%= setting_check_box :display_subprojects_issues %></p>
<p><%= setting_select :issue_done_ratio, Issue::DONE_RATIO_OPTIONS.collect {|i| [l("setting_issue_done_ratio_#{i}"), i]} %></p>

View File

@ -998,3 +998,4 @@ bg:
description_date_range_interval: Изберете диапазон чрез задаване на начална и крайна дати
description_date_from: Въведете начална дата
description_date_to: Въведете крайна дата
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1014,3 +1014,4 @@ bs:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1003,3 +1003,4 @@ ca:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1004,3 +1004,4 @@ cs:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1017,3 +1017,4 @@ da:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1021,3 +1021,4 @@ de:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1000,3 +1000,4 @@ el:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -370,7 +370,9 @@ en-GB:
setting_commit_logtime_enabled: Enable time logging
setting_commit_logtime_activity_id: Activity for logged time
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
setting_issue_group_assignment: Allow issue assignment to groups
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value
permission_add_project: Create project
permission_add_subprojects: Create subprojects
permission_edit_project: Edit project
@ -981,7 +983,6 @@ en-GB:
text_scm_command_not_available: Scm command is not available. Please check settings on the administration panel.
notice_issue_successful_create: Issue %{id} created.
label_between: between
setting_issue_group_assignment: Allow issue assignment to groups
label_diff: diff
text_git_repository_note: Repository is bare and local (e.g. /gitrepo, c:\gitrepo)
description_query_sort_criteria_direction: Sort direction

View File

@ -375,6 +375,7 @@ en:
setting_commit_logtime_activity_id: Activity for logged time
setting_gantt_items_limit: Maximum number of items displayed on the gantt chart
setting_issue_group_assignment: Allow issue assignment to groups
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value
permission_add_project: Create project
permission_add_subprojects: Create subprojects

View File

@ -1037,3 +1037,4 @@ es:
description_selected_columns: Selected Columns
label_parent_revision: Parent
label_child_revision: Child
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1004,3 +1004,4 @@ eu:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1003,3 +1003,4 @@ fa:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1021,3 +1021,4 @@ fi:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -372,6 +372,7 @@ fr:
setting_commit_logtime_activity_id: Activité pour le temps saisi
setting_gantt_items_limit: Nombre maximum d'éléments affichés sur le gantt
setting_issue_group_assignment: Permettre l'assignement des demandes aux groupes
setting_default_issue_start_date_to_creation_date: Donner à la date de début d'une nouvelle demande la valeur de la date du jour
permission_add_project: Créer un projet
permission_add_subprojects: Créer des sous-projets

View File

@ -1012,3 +1012,4 @@ gl:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1005,3 +1005,4 @@ he:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1007,3 +1007,4 @@ hr:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1019,3 +1019,4 @@
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1008,3 +1008,4 @@ id:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1001,3 +1001,4 @@ it:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1030,3 +1030,4 @@ ja:
description_wiki_subpages_reassign: Choose new parent page
description_selected_columns: Selected Columns
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1052,3 +1052,4 @@ ko:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1060,3 +1060,4 @@ lt:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -995,3 +995,4 @@ lv:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1000,3 +1000,4 @@ mk:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1001,3 +1001,4 @@ mn:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -982,3 +982,4 @@ nl:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -990,3 +990,4 @@
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1017,3 +1017,4 @@ pl:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1021,3 +1021,4 @@ pt-BR:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1005,3 +1005,4 @@ pt:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -993,3 +993,4 @@ ro:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1113,3 +1113,4 @@ ru:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -995,3 +995,4 @@ sk:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1000,3 +1000,4 @@ sl:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1000,3 +1000,4 @@ sr-YU:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1001,3 +1001,4 @@ sr:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1041,3 +1041,4 @@ sv:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -997,3 +997,4 @@ th:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1019,3 +1019,4 @@ tr:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -996,3 +996,4 @@ uk:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1051,3 +1051,4 @@ vi:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1080,3 +1080,4 @@
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -1002,3 +1002,4 @@ zh:
label_parent_revision: Parent
label_child_revision: Child
error_scm_annotate_big_text_file: The entry cannot be annotated, as it exceeds the maximum text file size.
setting_default_issue_start_date_to_creation_date: Set new issue's start date with today's date value

View File

@ -123,6 +123,8 @@ cross_project_issue_relations:
default: 0
issue_group_assignment:
default: 0
default_issue_start_date_to_creation_date:
default: 1
notified_events:
serialized: true
default:

View File

@ -569,6 +569,30 @@ class IssuesControllerTest < ActionController::TestCase
:parent => {:tag => 'select', :attributes => {:id => 'issue_priority_id'} }
end
def test_get_new_without_default_start_date_is_creation_date
Setting.default_issue_start_date_to_creation_date = 0
@request.session[:user_id] = 2
get :new, :project_id => 1, :tracker_id => 1
assert_response :success
assert_template 'new'
assert_tag :tag => 'input', :attributes => { :name => 'issue[start_date]',
:value => nil }
end
def test_get_new_with_default_start_date_is_creation_date
Setting.default_issue_start_date_to_creation_date = 1
@request.session[:user_id] = 2
get :new, :project_id => 1, :tracker_id => 1
assert_response :success
assert_template 'new'
assert_tag :tag => 'input', :attributes => { :name => 'issue[start_date]',
:value => Date.today.to_s }
end
def test_get_new_form_should_allow_attachment_upload
@request.session[:user_id] = 2
get :new, :project_id => 1, :tracker_id => 1
@ -676,7 +700,9 @@ class IssuesControllerTest < ActionController::TestCase
assert_equal group, issue.assigned_to
end
def test_post_create_without_start_date
def test_post_create_without_start_date_and_default_start_date_is_not_creation_date
Setting.default_issue_start_date_to_creation_date = 0
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
post :create, :project_id => 1,
@ -685,7 +711,6 @@ class IssuesControllerTest < ActionController::TestCase
:subject => 'This is the test_new issue',
:description => 'This is the description',
:priority_id => 5,
:start_date => '',
:estimated_hours => '',
:custom_field_values => {'2' => 'Value for field 2'}}
end
@ -696,6 +721,27 @@ class IssuesControllerTest < ActionController::TestCase
assert_nil issue.start_date
end
def test_post_create_without_start_date_and_default_start_date_is_creation_date
Setting.default_issue_start_date_to_creation_date = 1
@request.session[:user_id] = 2
assert_difference 'Issue.count' do
post :create, :project_id => 1,
:issue => {:tracker_id => 3,
:status_id => 2,
:subject => 'This is the test_new issue',
:description => 'This is the description',
:priority_id => 5,
:estimated_hours => '',
:custom_field_values => {'2' => 'Value for field 2'}}
end
assert_redirected_to :controller => 'issues', :action => 'show', :id => Issue.last.id
issue = Issue.find_by_subject('This is the test_new issue')
assert_not_nil issue
assert_equal Date.today, issue.start_date
end
def test_post_create_and_continue
@request.session[:user_id] = 2
assert_difference 'Issue.count' do