500 Error when doing Approval Workflow related actions #1260

This commit is contained in:
karel.picman@lbcfree.net 2021-06-02 07:18:53 +02:00
parent 8c30cb4046
commit 86059bab52
3 changed files with 9 additions and 9 deletions

View File

@ -640,7 +640,7 @@ class DmsfController < ApplicationController
recipients = DmsfMailer.deliver_files_deleted(@project, deleted_files) recipients = DmsfMailer.deliver_files_deleted(@project, deleted_files)
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients']
if recipients.any? if recipients.any?
to = recipients.collect{ |r| h(r.name) }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
flash[:warning] = l(:warning_email_notifications, to: to) flash[:warning] = l(:warning_email_notifications, to: to)
end end
@ -650,7 +650,7 @@ class DmsfController < ApplicationController
end end
end end
unless not_deleted_files.empty? unless not_deleted_files.empty?
flash[:warning] = l(:warning_some_entries_were_not_deleted, entries: not_deleted_files.map{ |f| h(f.title) }. flash[:warning] = l(:warning_some_entries_were_not_deleted, entries: not_deleted_files.map{ |f| f.title }.
join(', ')) join(', '))
end end
# Links # Links

View File

@ -150,7 +150,7 @@ class DmsfFilesController < ApplicationController
@file.name = revision.name @file.name = revision.name
if revision.save if revision.save
revision.assign_workflow(params[:dmsf_workflow_id]) revision.assign_workflow params[:dmsf_workflow_id]
if upload if upload
begin begin
FileUtils.mv upload.tempfile_path, revision.disk_file(false) FileUtils.mv upload.tempfile_path, revision.disk_file(false)
@ -178,7 +178,7 @@ class DmsfFilesController < ApplicationController
recipients = DmsfMailer.deliver_files_updated(@project, [@file]) recipients = DmsfMailer.deliver_files_updated(@project, [@file])
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients']
if recipients.any? if recipients.any?
to = recipients.collect{ |r| h(r.name) }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
flash[:warning] = l(:warning_email_notifications, to: to) flash[:warning] = l(:warning_email_notifications, to: to)
end end
@ -208,7 +208,7 @@ class DmsfFilesController < ApplicationController
recipients = DmsfMailer.deliver_files_deleted(@project, [@file]) recipients = DmsfMailer.deliver_files_deleted(@project, [@file])
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients']
if recipients.any? if recipients.any?
to = recipients.collect{ |r| h(r.name) }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
flash[:warning] = l(:warning_email_notifications, to: to) flash[:warning] = l(:warning_email_notifications, to: to)
end end

View File

@ -84,7 +84,7 @@ class DmsfWorkflowsController < ApplicationController
:text_email_to_see_history) :text_email_to_see_history)
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients']
unless recipients.blank? unless recipients.blank?
to = recipients.collect{ |r| h(r.name) }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
flash[:warning] = l(:warning_email_notifications, to: to) flash[:warning] = l(:warning_email_notifications, to: to)
end end
@ -105,7 +105,7 @@ class DmsfWorkflowsController < ApplicationController
action.note) action.note)
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients']
unless recipients.blank? unless recipients.blank?
to = recipients.collect{ |r| h(r.name) }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
flash[:warning] = l(:warning_email_notifications, to: to) flash[:warning] = l(:warning_email_notifications, to: to)
end end
@ -126,7 +126,7 @@ class DmsfWorkflowsController < ApplicationController
action.note, action.note,
action.dmsf_workflow_step_assignment.dmsf_workflow_step) action.dmsf_workflow_step_assignment.dmsf_workflow_step)
if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients'] if Setting.plugin_redmine_dmsf['dmsf_display_notified_recipients']
flash[:warning] = l(:warning_email_notifications, to: h(delegate.name)) flash[:warning] = l(:warning_email_notifications, to: delegate.name)
end end
end end
else else
@ -164,7 +164,7 @@ class DmsfWorkflowsController < ApplicationController
recipients.uniq! recipients.uniq!
recipients = recipients & DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true) recipients = recipients & DmsfMailer.get_notify_users(@project, [revision.dmsf_file], true)
unless recipients.empty? unless recipients.empty?
to = recipients.collect{ |r| h(r.name) }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ') to = recipients.collect{ |r| r.name }.first(DMSF_MAX_NOTIFICATION_RECEIVERS_INFO).join(', ')
to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.') to << ((recipients.count > DMSF_MAX_NOTIFICATION_RECEIVERS_INFO) ? ',...' : '.')
flash[:warning] = l(:warning_email_notifications, to: to) flash[:warning] = l(:warning_email_notifications, to: to)
end end