Fixes missing journal notes on copy

pull/835/head
Hagen Schink 11 years ago committed by Johannes Wollert
parent 24ad6d03af
commit cecb5ad887
  1. 11
      app/models/work_package.rb

@ -669,7 +669,9 @@ class WorkPackage < ActiveRecord::Base
end end
if work_package.save 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 # Manually update project_id on related time entries
TimeEntry.update_all("project_id = #{new_project.id}", {:work_package_id => id}) 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}" errors.messages[:attachments].first << " - #{invalid_attachment.errors.full_messages.first}"
end end
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 end

Loading…
Cancel
Save