From 269014ced887bbbe96dc9d07a4885e7d1005da6b Mon Sep 17 00:00:00 2001 From: Etienne Massip Date: Sat, 5 Nov 2011 18:40:33 +0000 Subject: [PATCH] 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 --- app/controllers/issues_controller.rb | 2 +- app/views/settings/_issues.html.erb | 2 + config/locales/bg.yml | 1 + config/locales/bs.yml | 1 + config/locales/ca.yml | 1 + config/locales/cs.yml | 1 + config/locales/da.yml | 1 + config/locales/de.yml | 1 + config/locales/el.yml | 1 + config/locales/en-GB.yml | 5 ++- config/locales/en.yml | 1 + config/locales/es.yml | 1 + config/locales/eu.yml | 1 + config/locales/fa.yml | 1 + config/locales/fi.yml | 1 + config/locales/fr.yml | 1 + config/locales/gl.yml | 1 + config/locales/he.yml | 1 + config/locales/hr.yml | 1 + config/locales/hu.yml | 1 + config/locales/id.yml | 1 + config/locales/it.yml | 1 + config/locales/ja.yml | 1 + config/locales/ko.yml | 1 + config/locales/lt.yml | 1 + config/locales/lv.yml | 1 + config/locales/mk.yml | 1 + config/locales/mn.yml | 1 + config/locales/nl.yml | 1 + config/locales/no.yml | 1 + config/locales/pl.yml | 1 + config/locales/pt-BR.yml | 1 + config/locales/pt.yml | 1 + config/locales/ro.yml | 1 + config/locales/ru.yml | 1 + config/locales/sk.yml | 1 + config/locales/sl.yml | 1 + config/locales/sr-YU.yml | 1 + config/locales/sr.yml | 1 + config/locales/sv.yml | 1 + config/locales/th.yml | 1 + config/locales/tr.yml | 1 + config/locales/uk.yml | 1 + config/locales/vi.yml | 1 + config/locales/zh-TW.yml | 1 + config/locales/zh.yml | 1 + config/settings.yml | 2 + test/functional/issues_controller_test.rb | 50 ++++++++++++++++++++++- 48 files changed, 99 insertions(+), 5 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index af44e3c19..d782a7965 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -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? diff --git a/app/views/settings/_issues.html.erb b/app/views/settings/_issues.html.erb index c33e78dc5..2ffa21113 100644 --- a/app/views/settings/_issues.html.erb +++ b/app/views/settings/_issues.html.erb @@ -5,6 +5,8 @@

<%= setting_check_box :issue_group_assignment %>

+

<%= setting_check_box :default_issue_start_date_to_creation_date %>

+

<%= setting_check_box :display_subprojects_issues %>

<%= setting_select :issue_done_ratio, Issue::DONE_RATIO_OPTIONS.collect {|i| [l("setting_issue_done_ratio_#{i}"), i]} %>

diff --git a/config/locales/bg.yml b/config/locales/bg.yml index dc620db64..29b8eb54b 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -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 diff --git a/config/locales/bs.yml b/config/locales/bs.yml index 72fb0f701..84683369e 100644 --- a/config/locales/bs.yml +++ b/config/locales/bs.yml @@ -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 diff --git a/config/locales/ca.yml b/config/locales/ca.yml index 26c8dcc7e..d74ca3086 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -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 diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 7ba9e8181..6cb349f65 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -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 diff --git a/config/locales/da.yml b/config/locales/da.yml index 98b6d31c5..67306bfe8 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -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 diff --git a/config/locales/de.yml b/config/locales/de.yml index 69ec4dae6..f883a5a9c 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -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 diff --git a/config/locales/el.yml b/config/locales/el.yml index 9eab6b5b3..45074c631 100644 --- a/config/locales/el.yml +++ b/config/locales/el.yml @@ -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 diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index 19ea883a0..4bf79e27a 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -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 diff --git a/config/locales/en.yml b/config/locales/en.yml index ee4492550..6509763a0 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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 diff --git a/config/locales/es.yml b/config/locales/es.yml index b5d8d2c7a..58062bde4 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -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 diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 8068be1d9..75e46d7b6 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -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 diff --git a/config/locales/fa.yml b/config/locales/fa.yml index e7ce0db39..71130dd37 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -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 diff --git a/config/locales/fi.yml b/config/locales/fi.yml index da0a62678..9c0a7a441 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -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 diff --git a/config/locales/fr.yml b/config/locales/fr.yml index 326363cb3..b119c1afe 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -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 diff --git a/config/locales/gl.yml b/config/locales/gl.yml index bd015c721..4aae8d003 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -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 diff --git a/config/locales/he.yml b/config/locales/he.yml index 69613439a..dd6072d47 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -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 diff --git a/config/locales/hr.yml b/config/locales/hr.yml index 6cd1df802..2d038d98b 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -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 diff --git a/config/locales/hu.yml b/config/locales/hu.yml index e87368966..894d936d1 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -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 diff --git a/config/locales/id.yml b/config/locales/id.yml index 9874fee92..083f83a7c 100644 --- a/config/locales/id.yml +++ b/config/locales/id.yml @@ -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 diff --git a/config/locales/it.yml b/config/locales/it.yml index 4ea67ee49..77c40c8d2 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -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 diff --git a/config/locales/ja.yml b/config/locales/ja.yml index bd88af6cb..ffbc56b16 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -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 diff --git a/config/locales/ko.yml b/config/locales/ko.yml index b2704f0e8..fea784067 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -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 diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 5ed8c8759..6ccb662c1 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -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 diff --git a/config/locales/lv.yml b/config/locales/lv.yml index d74247e63..6c9345fd0 100644 --- a/config/locales/lv.yml +++ b/config/locales/lv.yml @@ -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 diff --git a/config/locales/mk.yml b/config/locales/mk.yml index 1c3aece53..3a435b7c9 100644 --- a/config/locales/mk.yml +++ b/config/locales/mk.yml @@ -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 diff --git a/config/locales/mn.yml b/config/locales/mn.yml index ec0bf047c..7567facb8 100644 --- a/config/locales/mn.yml +++ b/config/locales/mn.yml @@ -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 diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 9fe62756e..54a3a52e3 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -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 diff --git a/config/locales/no.yml b/config/locales/no.yml index 3cd28cd5d..836532dcc 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -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 diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 10c564482..5c910f886 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -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 diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 720cdd1a1..5e6d7d214 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -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 diff --git a/config/locales/pt.yml b/config/locales/pt.yml index a4f2aef14..0fd358dee 100644 --- a/config/locales/pt.yml +++ b/config/locales/pt.yml @@ -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 diff --git a/config/locales/ro.yml b/config/locales/ro.yml index b0f30562d..67ddbd1d8 100644 --- a/config/locales/ro.yml +++ b/config/locales/ro.yml @@ -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 diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 91e97c1a0..e317fe62c 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -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 diff --git a/config/locales/sk.yml b/config/locales/sk.yml index ef58d5083..d5280d013 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -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 diff --git a/config/locales/sl.yml b/config/locales/sl.yml index a386ab69d..163dff1f0 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -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 diff --git a/config/locales/sr-YU.yml b/config/locales/sr-YU.yml index 2fc5bea80..033cb1060 100644 --- a/config/locales/sr-YU.yml +++ b/config/locales/sr-YU.yml @@ -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 diff --git a/config/locales/sr.yml b/config/locales/sr.yml index fa48b437a..1f39d9324 100644 --- a/config/locales/sr.yml +++ b/config/locales/sr.yml @@ -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 diff --git a/config/locales/sv.yml b/config/locales/sv.yml index 9ff21607c..782907408 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -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 diff --git a/config/locales/th.yml b/config/locales/th.yml index 79086fca7..5a2b5081b 100644 --- a/config/locales/th.yml +++ b/config/locales/th.yml @@ -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 diff --git a/config/locales/tr.yml b/config/locales/tr.yml index 4f2bcb331..b71d398d4 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -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 diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 2344599c5..68f0d4452 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -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 diff --git a/config/locales/vi.yml b/config/locales/vi.yml index 6f033a735..40a1cd81b 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -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 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 010929ebf..ef6f74a28 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -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 diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 0d45c7ca6..e6a51d532 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -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 diff --git a/config/settings.yml b/config/settings.yml index c81ddc853..d46f8f792 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -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: diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index a0ce7914c..88bd77d44 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -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 -- 2.39.5