Merge pull request #6414 from opf/fix/27975/update-parents-bulk

[27975] Call update_ancestors in bulk controller
pull/6425/head
ulferts 6 years ago committed by GitHub
commit 916709e2c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 13
      app/controllers/work_packages/bulk_controller.rb

@ -36,6 +36,7 @@ class WorkPackages::BulkController < ApplicationController
include RelationsHelper
include QueriesHelper
include IssuesHelper
include ::WorkPackages::Shared::UpdateAncestors
def edit
@available_statuses = @projects.map { |p| Workflow.available_statuses(p) }.inject { |memo, w| memo & w }
@ -47,6 +48,8 @@ class WorkPackages::BulkController < ApplicationController
def update
unsaved_work_package_ids = []
saved_work_packages = []
@work_packages.each do |work_package|
work_package.reload
@ -58,10 +61,14 @@ class WorkPackages::BulkController < ApplicationController
call_hook(:controller_work_packages_bulk_edit_before_save, params: params, work_package: work_package)
JournalManager.send_notification = params[:send_notification] == '0' ? false : true
unless work_package.save
if work_package.save
saved_work_packages << work_package
else
unsaved_work_package_ids << work_package.id
end
end
update_ancestors(saved_work_packages)
set_flash_from_bulk_save(@work_packages, unsaved_work_package_ids)
redirect_back_or_default(controller: '/work_packages', action: :index, project_id: @project)
end
@ -135,6 +142,10 @@ class WorkPackages::BulkController < ApplicationController
end
end
def user
current_user
end
def default_breadcrumb
l(:label_work_package_plural)
end

Loading…
Cancel
Save