Browse Source

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
tags/1.3.0
Etienne Massip 12 years ago
parent
commit
269014ced8
48 changed files with 99 additions and 5 deletions
  1. 1
    1
      app/controllers/issues_controller.rb
  2. 2
    0
      app/views/settings/_issues.html.erb
  3. 1
    0
      config/locales/bg.yml
  4. 1
    0
      config/locales/bs.yml
  5. 1
    0
      config/locales/ca.yml
  6. 1
    0
      config/locales/cs.yml
  7. 1
    0
      config/locales/da.yml
  8. 1
    0
      config/locales/de.yml
  9. 1
    0
      config/locales/el.yml
  10. 3
    2
      config/locales/en-GB.yml
  11. 1
    0
      config/locales/en.yml
  12. 1
    0
      config/locales/es.yml
  13. 1
    0
      config/locales/eu.yml
  14. 1
    0
      config/locales/fa.yml
  15. 1
    0
      config/locales/fi.yml
  16. 1
    0
      config/locales/fr.yml
  17. 1
    0
      config/locales/gl.yml
  18. 1
    0
      config/locales/he.yml
  19. 1
    0
      config/locales/hr.yml
  20. 1
    0
      config/locales/hu.yml
  21. 1
    0
      config/locales/id.yml
  22. 1
    0
      config/locales/it.yml
  23. 1
    0
      config/locales/ja.yml
  24. 1
    0
      config/locales/ko.yml
  25. 1
    0
      config/locales/lt.yml
  26. 1
    0
      config/locales/lv.yml
  27. 1
    0
      config/locales/mk.yml
  28. 1
    0
      config/locales/mn.yml
  29. 1
    0
      config/locales/nl.yml
  30. 1
    0
      config/locales/no.yml
  31. 1
    0
      config/locales/pl.yml
  32. 1
    0
      config/locales/pt-BR.yml
  33. 1
    0
      config/locales/pt.yml
  34. 1
    0
      config/locales/ro.yml
  35. 1
    0
      config/locales/ru.yml
  36. 1
    0
      config/locales/sk.yml
  37. 1
    0
      config/locales/sl.yml
  38. 1
    0
      config/locales/sr-YU.yml
  39. 1
    0
      config/locales/sr.yml
  40. 1
    0
      config/locales/sv.yml
  41. 1
    0
      config/locales/th.yml
  42. 1
    0
      config/locales/tr.yml
  43. 1
    0
      config/locales/uk.yml
  44. 1
    0
      config/locales/vi.yml
  45. 1
    0
      config/locales/zh-TW.yml
  46. 1
    0
      config/locales/zh.yml
  47. 2
    0
      config/settings.yml
  48. 48
    2
      test/functional/issues_controller_test.rb

+ 1
- 1
app/controllers/issues_controller.rb 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?

+ 2
- 0
app/views/settings/_issues.html.erb 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>

+ 1
- 0
config/locales/bg.yml 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

+ 1
- 0
config/locales/bs.yml 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

+ 1
- 0
config/locales/ca.yml 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

+ 1
- 0
config/locales/cs.yml 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

+ 1
- 0
config/locales/da.yml 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

+ 1
- 0
config/locales/de.yml 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

+ 1
- 0
config/locales/el.yml 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

+ 3
- 2
config/locales/en-GB.yml 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

+ 1
- 0
config/locales/en.yml 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

+ 1
- 0
config/locales/es.yml 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

+ 1
- 0
config/locales/eu.yml 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

+ 1
- 0
config/locales/fa.yml 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

+ 1
- 0
config/locales/fi.yml 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

+ 1
- 0
config/locales/fr.yml 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

+ 1
- 0
config/locales/gl.yml 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

+ 1
- 0
config/locales/he.yml 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

+ 1
- 0
config/locales/hr.yml 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

+ 1
- 0
config/locales/hu.yml 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

+ 1
- 0
config/locales/id.yml 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

+ 1
- 0
config/locales/it.yml 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

+ 1
- 0
config/locales/ja.yml 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

+ 1
- 0
config/locales/ko.yml 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

+ 1
- 0
config/locales/lt.yml 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

+ 1
- 0
config/locales/lv.yml 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

+ 1
- 0
config/locales/mk.yml 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

+ 1
- 0
config/locales/mn.yml 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

+ 1
- 0
config/locales/nl.yml 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

+ 1
- 0
config/locales/no.yml 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

+ 1
- 0
config/locales/pl.yml 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

+ 1
- 0
config/locales/pt-BR.yml 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

+ 1
- 0
config/locales/pt.yml 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

+ 1
- 0
config/locales/ro.yml 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

+ 1
- 0
config/locales/ru.yml 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

+ 1
- 0
config/locales/sk.yml 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

+ 1
- 0
config/locales/sl.yml 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

+ 1
- 0
config/locales/sr-YU.yml 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

+ 1
- 0
config/locales/sr.yml 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

+ 1
- 0
config/locales/sv.yml 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

+ 1
- 0
config/locales/th.yml 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

+ 1
- 0
config/locales/tr.yml 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

+ 1
- 0
config/locales/uk.yml 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

+ 1
- 0
config/locales/vi.yml 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

+ 1
- 0
config/locales/zh-TW.yml 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

+ 1
- 0
config/locales/zh.yml 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

+ 2
- 0
config/settings.yml 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:

+ 48
- 2
test/functional/issues_controller_test.rb 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

Loading…
Cancel
Save