Make sure that attachments are created in the same order they were selected (#12310).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10793 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -62,7 +62,19 @@ module Redmine
|
||||
|
||||
def save_attachments(attachments, author=User.current)
|
||||
if attachments.is_a?(Hash)
|
||||
attachments = attachments.values
|
||||
attachments = attachments.stringify_keys
|
||||
attachments = attachments.to_a.sort {|a, b|
|
||||
if a.first.to_i > 0 && b.first.to_i > 0
|
||||
a.first.to_i <=> b.first.to_i
|
||||
elsif a.first.to_i > 0
|
||||
1
|
||||
elsif b.first.to_i > 0
|
||||
-1
|
||||
else
|
||||
a.first <=> b.first
|
||||
end
|
||||
}
|
||||
attachments = attachments.map(&:last)
|
||||
end
|
||||
if attachments.is_a?(Array)
|
||||
attachments.each do |attachment|
|
||||
|
||||
Reference in New Issue
Block a user