A wrong parametrs order in the validation
This commit is contained in:
parent
6f582a498c
commit
ab52e6ae09
@ -39,7 +39,7 @@ class DmsfController < ApplicationController
|
||||
@file_delete_allowed = User.current.allowed_to?(:file_delete, @project)
|
||||
@file_view_allowed = User.current.allowed_to?(:view_dmsf_files, @project)
|
||||
@force_file_unlock_allowed = User.current.allowed_to?(:force_file_unlock, @project)
|
||||
@workflows_available = DmsfWorkflow.where(['project_id = ? OR project_id IS NULL', @project.id]).count > 0
|
||||
@workflows_available = DmsfWorkflow.where(['project_id = ? OR project_id IS NULL', @project.id]).exists?
|
||||
@file_approval_allowed = User.current.allowed_to?(:file_approval, @project)
|
||||
tag = params[:custom_field_id].present? && params[:custom_value].present?
|
||||
@folder = nil if tag
|
||||
|
||||
@ -36,22 +36,22 @@ class DmsfWorkflow < ActiveRecord::Base
|
||||
if self.project_id
|
||||
if self.id
|
||||
if (DmsfWorkflow.where(['(project_id IS NULL OR (project_id = ? AND id != ?)) AND name = ?',
|
||||
self.project_id, self.id, self.name]).count > 0)
|
||||
self.project_id, self.id, self.name]).exists?)
|
||||
errors.add(:name, l('activerecord.errors.messages.taken'))
|
||||
end
|
||||
else
|
||||
if (DmsfWorkflow.where(['(project_id IS NULL OR project_id = ?) AND name = ?',
|
||||
self.project_id, self.name]).count > 0)
|
||||
self.project_id, self.name]).exists?)
|
||||
errors.add(:name, l('activerecord.errors.messages.taken'))
|
||||
end
|
||||
end
|
||||
else
|
||||
if self.id
|
||||
if DmsfWorkflow.where(['name = ? AND id != ?', self.name, self.id]).count > 0
|
||||
if DmsfWorkflow.where(['name = ? AND id != ?', self.name, self.id]).exists?
|
||||
errors.add(:name, l('activerecord.errors.messages.taken'))
|
||||
end
|
||||
else
|
||||
if DmsfWorkflow.where(:name => self.name).count > 0
|
||||
if DmsfWorkflow.where(:name => self.name).exists?
|
||||
errors.add(:name, l('activerecord.errors.messages.taken'))
|
||||
end
|
||||
end
|
||||
|
||||
@ -24,7 +24,7 @@ class ApprovalWorkflowStdFields < ActiveRecord::Migration
|
||||
add_column :dmsf_workflows, :created_on, :datetime
|
||||
add_column :dmsf_workflows, :author_id, :integer
|
||||
# Set updated_on
|
||||
DmsfWorkflow.all.each(&:save)
|
||||
DmsfWorkflow.all.each(&:touch)
|
||||
# Set created_on and author_id
|
||||
DmsfWorkflow.update_all 'created_on = updated_on, author_id = (select id from users where admin = 1 limit 1)'
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user