From 15a0c89eb48db6419c189972b3b2ce127bb94436 Mon Sep 17 00:00:00 2001 From: Karel Picman Date: Thu, 9 Feb 2017 12:38:39 +0100 Subject: [PATCH] Incomplete copy of a file to another project #651 --- CHANGELOG.md | 1 + app/models/dmsf_file.rb | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d62b14c..f2071bd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ Changelog for Redmine DMSF Global title format for downloading New columns in the main DMSF view; columns are configurable from the plugin settings +* Bug: #651 - Incomplete copy of a file to another project * New: #641 - Documents export * New: #635 - Edit approval workflow steps * Bug: #632 - database migration error (from ver 0.9.1 to ver 1.5.8) diff --git a/app/models/dmsf_file.rb b/app/models/dmsf_file.rb index 2f4fa648..88380845 100644 --- a/app/models/dmsf_file.rb +++ b/app/models/dmsf_file.rb @@ -277,10 +277,8 @@ class DmsfFile < ActiveRecord::Base project = container.is_a?(Project) ? container : container.project # If the target project differs from the source project we must physically move the disk files if self.project != project - self.dmsf_file_revisions.all.each do |rev| - if File.exist? rev.disk_file(self.project) - FileUtils.cp rev.disk_file(self.project), rev.disk_file(project) - end + if File.exist? self.last_revision.disk_file(self.project) + FileUtils.cp self.last_revision.disk_file(self.project), self.last_revision.disk_file(project) end end file = DmsfFile.new