OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Allow passing in a cause of update for UpdateService
Klaus Zandersdd1a8a02c33b
diff --git a/app/services/work_packages/update_service.rb b/app/services/work_packages/update_service.rbindex 02d7a7190e6..e361a08528f 100644--- a/app/services/work_packages/update_service.rb+++ b/app/services/work_packages/update_service.rb@@ -30,6 +30,13 @@ class WorkPackages::UpdateService < BaseServices::Updateinclude ::WorkPackages::Shared::UpdateAncestorsinclude Attachments::ReplaceAttachments+ attr_accessor :cause_of_update++ def initialize(user:, model:, contract_class: nil, contract_options: {}, cause_of_update: nil)+ super(user:, model:, contract_class:, contract_options:)+ self.cause_of_update = cause_of_update || self+ end+privatedef after_perform(service_call)@@ -121,7 +128,7 @@ class WorkPackages::UpdateService < BaseServices::Updatedef reschedule(work_package, work_packages)WorkPackages::SetScheduleService- .new(user:, work_package: work_packages, initiated_by: work_package)+ .new(user:, work_package: work_packages, initiated_by: cause_of_update).call(work_package.saved_changes.keys.map(&:to_sym))enddiff --git a/app/workers/work_packages/apply_working_days_change_job.rb b/app/workers/work_packages/apply_working_days_change_job.rbindex fe700cc8152..7f503c1398a 100644--- a/app/workers/work_packages/apply_working_days_change_job.rb+++ b/app/workers/work_packages/apply_working_days_change_job.rb@@ -59,7 +59,7 @@ class WorkPackages::ApplyWorkingDaysChangeJob < ApplicationJob}WorkPackages::UpdateService- .new(user:, model: work_package, contract_class: EmptyContract)+ .new(user:, model: work_package, contract_class: EmptyContract, cause_of_update: changed_working_days).call(duration: work_package.duration, journal_cause: cause) # trigger a recomputation of start and due date.all_resultsend