#212 Incorrect revision information in email notification
This commit is contained in:
parent
e4194a5e73
commit
efe1ae88fb
@ -151,15 +151,12 @@ class DmsfUploadController < ApplicationController
|
||||
end
|
||||
|
||||
if new_revision.save
|
||||
new_revision.assign_workflow(commited_file[:dmsf_workflow_id])
|
||||
file.reload
|
||||
|
||||
new_revision.assign_workflow(commited_file[:dmsf_workflow_id])
|
||||
new_revision.copy_file_content(file_upload)
|
||||
file_upload.close
|
||||
File.delete(commited_disk_filepath)
|
||||
|
||||
File.delete(commited_disk_filepath)
|
||||
file.set_last_revision new_revision
|
||||
files.push(file)
|
||||
|
||||
if commited_file['dmsf_file_revision'].present?
|
||||
commited_file['dmsf_file_revision']['custom_field_values'].each do |v|
|
||||
cv = CustomValue.where(:customized_id => new_revision.id, :custom_field_id => v[0]).first
|
||||
@ -173,8 +170,8 @@ class DmsfUploadController < ApplicationController
|
||||
failed_uploads.push(commited_file)
|
||||
end
|
||||
end
|
||||
unless files.empty?
|
||||
files.each { |file| log_activity(file, 'uploaded') if file }
|
||||
unless files.empty?
|
||||
files.each { |file| log_activity(file, 'uploaded') if file }
|
||||
begin
|
||||
DmsfMailer.files_updated(User.current, files).deliver
|
||||
rescue ActionView::MissingTemplate => e
|
||||
|
||||
@ -99,6 +99,10 @@ class DmsfFile < ActiveRecord::Base
|
||||
end
|
||||
@last_revision
|
||||
end
|
||||
|
||||
def set_last_revision(new_revision)
|
||||
@last_revision = new_revision
|
||||
end
|
||||
|
||||
def delete
|
||||
if locked_for_user?
|
||||
|
||||
@ -72,19 +72,15 @@ class DmsfMailer < Mailer
|
||||
private
|
||||
|
||||
def get_notify_user_emails(user, files)
|
||||
if files.empty?
|
||||
return []
|
||||
end
|
||||
|
||||
project = files[0].project
|
||||
|
||||
return [] if files.empty?
|
||||
project = files[0].project
|
||||
notify_members = project.members
|
||||
notify_members = notify_members.select do |notify_member|
|
||||
notify_user = notify_member.user
|
||||
if notify_user.pref[:no_self_notified] && notify_user == user
|
||||
notify_user = notify_member.user
|
||||
if notify_user.pref[:no_self_notified] == '1' && notify_user == user
|
||||
false
|
||||
else
|
||||
if notify_member.dmsf_mail_notification.nil?
|
||||
unless notify_member.dmsf_mail_notification
|
||||
case notify_user.mail_notification
|
||||
when 'all'
|
||||
true
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
<%# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
# Copyright (C) 2014 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@ -17,8 +18,8 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
User <%= link_to(h(@user), {:only_path => false, :controller => 'users', :action => 'show', :id => @user }) %>
|
||||
deleted DMSF files in project <%= @project.name %>:
|
||||
<%= link_to @user, user_path(@user, :only_path => false) %> has just deleted documents of
|
||||
<%= link_to @project, project_path(@project, :only_path => false) %> as follows:
|
||||
<% @files.each do |file| %>
|
||||
<p>
|
||||
<%= h(file.dmsf_path_str) %> (<%= file.name %>)
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
<%# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
# Copyright (C) 2014 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@ -17,7 +18,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
User <%= @user %> deleted DMSF files in project <%= @project.name %>:
|
||||
<%= @user.name %> has just deleted documents of <%= @project.name %> as follows:
|
||||
<% @files.each do |file| %>
|
||||
<%= file.dmsf_path_str %> (<%= file.name %>)
|
||||
<% if file.last_revision %>
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
<%# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
# Copyright (C) 2014 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@ -17,8 +18,8 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
User <%= link_to(h(@user), {:only_path => false, :controller => 'users', :action => 'show', :id => @user }) %>
|
||||
actualized DMSF files in project <%= @project.name %>:
|
||||
<%= link_to @user, user_path(@user, :only_path => false) %> has just actualized documents of
|
||||
<%= link_to @project, project_path(@project, :only_path => false) %> as follows:
|
||||
<% @files.each do |file| %>
|
||||
<p>
|
||||
<%= link_to(h(file.dmsf_path_str),
|
||||
@ -26,11 +27,11 @@ actualized DMSF files in project <%= @project.name %>:
|
||||
:download => ''}) %> (<%= file.name %>),
|
||||
<%= number_to_human_size(file.last_revision.size) %>,
|
||||
version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>,
|
||||
<%= "#{file.last_revision.workflow_str(true)}," if file.last_revision.workflow_str(true).present? %>
|
||||
<%= "#{file.last_revision.workflow_str(true)}," if file.last_revision.workflow_str(true) != l(:title_none) %>
|
||||
<%= link_to('Details',
|
||||
{:only_path => false, :controller => 'dmsf_files', :action => 'show', :id => file}) %>
|
||||
{:only_path => false, :controller => 'dmsf_files', :action => 'show', :id => file}) %>
|
||||
<% if file.last_revision.comment.present? %>
|
||||
<br /><span style="font-size: 0.9em"> <em><%= h(file.last_revision.comment) %></em></span>
|
||||
<br/><span style="font-size: 0.9em"> <em><%= h(file.last_revision.comment) %></em></span>
|
||||
<% end %>
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
<%# Redmine plugin for Document Management System "Features"
|
||||
#
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
# Copyright (C) 2011 Vít Jonáš <vit.jonas@gmail.com>
|
||||
# Copyright (C) 2012 Daniel Munn <dan.munn@munnster.co.uk>
|
||||
# Copyright (C) 2014 Karel Pičman <karel.picman@kontron.com>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
@ -17,9 +18,14 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.%>
|
||||
|
||||
User <%= @user %> actualized DMSF files in project <%= @project.name %>:
|
||||
<%= @user.name %> has just actualized documents of <%= @project.name %> as follows:
|
||||
<% @files.each do |file| %>
|
||||
<%= file.dmsf_path_str %> (<%= file.name %>), <%= number_to_human_size(file.last_revision.size) %>, version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %><%= ", #{file.last_revision.workflow_str(true)}" unless file.last_revision.workflow_str(true).blank? %>
|
||||
<%= file.dmsf_path_str %> (<%= file.name %>),
|
||||
<%= number_to_human_size(file.last_revision.size) %>,
|
||||
version: <%= file.last_revision.major_version %>.<%= file.last_revision.minor_version %>,
|
||||
<%= "#{file.last_revision.workflow_str(true)}," if file.last_revision.workflow_str(true) != l(:title_none) %>
|
||||
<%= url_for({:only_path => false, :controller => 'dmsf_files', :action => 'show', :id => file}) %>
|
||||
<% if file.last_revision.comment.present? %> comment: <%= file.last_revision.comment %><% end %>
|
||||
<% if file.last_revision.comment.present? %>
|
||||
comment: <%= h(file.last_revision.comment) %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
Loading…
x
Reference in New Issue
Block a user