diff options
author | Etienne Massip <etienne.massip@gmail.com> | 2011-12-14 20:31:34 +0000 |
---|---|---|
committer | Etienne Massip <etienne.massip@gmail.com> | 2011-12-14 20:31:34 +0000 |
commit | 7d2298f39c609ec79dd16f27ef69885a7c390d00 (patch) | |
tree | 004e381702dcfd4cf63dee1c40ed2222692e9d25 /app/models/issue.rb | |
parent | 840ef94b4694cbb99b1c7d6bb184a9a1a8654485 (diff) | |
download | redmine-7d2298f39c609ec79dd16f27ef69885a7c390d00.tar.gz redmine-7d2298f39c609ec79dd16f27ef69885a7c390d00.zip |
Save an @Issue#save@.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8212 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/issue.rb')
-rw-r--r-- | app/models/issue.rb | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 5ccd40ee9..dcafade15 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -152,7 +152,13 @@ class Issue < ActiveRecord::Base def move_to_project_without_transaction(new_project, new_tracker = nil, options = {}) options ||= {} - issue = options[:copy] ? self.class.new.copy_from(self) : self + + if options[:copy] + issue = self.class.new.copy_from(self) + else + issue = self + issue.init_journal(User.current, options[:notes]) + end if new_project && issue.project_id != new_project.id # delete issue relations @@ -190,14 +196,12 @@ class Issue < ActiveRecord::Base if options[:attributes] issue.attributes = options[:attributes] end + if options[:copy] && options[:notes].present? + issue.init_journal(User.current, options[:notes]) + issue.current_journal.notify = false + end if issue.save - if options[:copy] - if current_journal && current_journal.notes.present? - issue.init_journal(current_journal.user, current_journal.notes) - issue.current_journal.notify = false - issue.save - end - else + unless options[:copy] # Manually update project_id on related time entries TimeEntry.update_all("project_id = #{new_project.id}", {:issue_id => id}) |