fix work package duplication when not copying any tasks

pull/6827/head
jwollert 11 years ago
parent 6c858e3834
commit 30e6d871ac
  1. 37
      features/edit_story.feature
  2. 8
      lib/open_project/backlogs/hooks.rb

@ -62,6 +62,7 @@ Feature: Edit story on backlogs view
| update_stories |
| view_work_packages |
| edit_work_packages |
| add_work_packages |
| manage_subtasks |
And the user "mathias" is a "team member"
And the project has the following sprints:
@ -160,3 +161,39 @@ Feature: Edit story on backlogs view
And I follow "New Story" of the "Sprint 001" menu
And I close the "Sprint 001" menu
Then I should not see "Epic" within_hidden ".type_id.helper"
@javascript
Scenario: Story duplication without copying tasks
Given the project has the following tasks:
| subject | parent |
| Task 1 | Story A |
And I am on the work package index page for the project called "ecookbook"
And I follow "Story A"
And I select "Duplicate" from the action menu
And I choose "copy_tasks_none" within "#backlogs-attributes"
And I press "Create"
Then I should not see "Task 1"
@javascript
Scenario: Story duplication with copying all tasks
Given the project has the following tasks:
| subject | parent |
| Task 1 | Story A |
And I am on the work package index page for the project called "ecookbook"
And I follow "Story A"
And I select "Duplicate" from the action menu
And I choose "copy_tasks_all" within "#backlogs-attributes"
And I press "Create"
Then I should see "Task 1"
@javascript
Scenario: Story duplication with copying open tasks
Given the project has the following tasks:
| subject | parent |
| Task 1 | Story A |
And I am on the work package index page for the project called "ecookbook"
And I follow "Story A"
And I select "Duplicate" from the action menu
And I choose "copy_tasks_open" within "#backlogs-attributes"
And I press "Create"
Then I should see "Task 1"

@ -137,9 +137,9 @@ module OpenProject::Backlogs::Hooks
snippet << "#{check_box_tag('link_to_original', params[:copy_from], true)}</p>"
snippet << "<p><label>#{l(:rb_label_copy_tasks)}</label>"
snippet << "#{radio_button_tag('copy_tasks', 'open:' + params[:copy_from], true)} #{l(:rb_label_copy_tasks_open)}<br />"
snippet << "#{radio_button_tag('copy_tasks', 'none', false)} #{l(:rb_label_copy_tasks_none)}<br />"
snippet << "#{radio_button_tag('copy_tasks', 'all:' + params[:copy_from], false)} #{l(:rb_label_copy_tasks_all)}</p>"
snippet << "#{radio_button_tag('copy_tasks', 'open:' + params[:copy_from], true, { id: 'copy_tasks_open'})} #{l(:rb_label_copy_tasks_open)}<br />"
snippet << "#{radio_button_tag('copy_tasks', 'none', false, {id: 'copy_tasks_none'})} #{l(:rb_label_copy_tasks_none)}<br />"
snippet << "#{radio_button_tag('copy_tasks', 'all:' + params[:copy_from], false, {id: 'copy_tasks_all'})} #{l(:rb_label_copy_tasks_all)}</p>"
end
snippet << %(</div>) * 2
@ -200,7 +200,7 @@ module OpenProject::Backlogs::Hooks
params[:copy_tasks] += ':' if params[:copy_tasks] !~ /:/
action, id = *(params[:copy_tasks].split(/:/))
story = (id == '' ? nil : Story.find(Integer(id)))
story = (id.nil? ? nil : Story.find(Integer(id)))
if ! story.nil? && action != 'none'
tasks = story.tasks

Loading…
Cancel
Save