diff --git a/app/models/work_package.rb b/app/models/work_package.rb index ec2c2c2d7c..10a42114fe 100644 --- a/app/models/work_package.rb +++ b/app/models/work_package.rb @@ -669,7 +669,9 @@ class WorkPackage < ActiveRecord::Base end if work_package.save - unless options[:copy] + if options[:copy] + create_and_save_journal_note work_package, options[:journal_note] + else # Manually update project_id on related time entries TimeEntry.update_all("project_id = #{new_project.id}", {:work_package_id => id}) @@ -1009,4 +1011,11 @@ class WorkPackage < ActiveRecord::Base errors.messages[:attachments].first << " - #{invalid_attachment.errors.full_messages.first}" end end + + def create_and_save_journal_note(work_package, journal_note) + if work_package && journal_note + work_package.add_journal User.current, journal_note + work_package.save! + end + end end