diff --git a/app/controllers/dmsf_workflows_controller.rb b/app/controllers/dmsf_workflows_controller.rb index fbf10529..414f5c83 100644 --- a/app/controllers/dmsf_workflows_controller.rb +++ b/app/controllers/dmsf_workflows_controller.rb @@ -64,7 +64,7 @@ class DmsfWorkflowsController < ApplicationController revision, l(:text_email_subject_approved, :name => @workflow.name), l(:text_email_finished_approved, :name => @workflow.name, :filename => revision.file.name), - l(:text_email_to_see_history)).deliver + l(:text_email_to_see_history)).deliver if member.user end else # Just rejected @@ -77,22 +77,20 @@ class DmsfWorkflowsController < ApplicationController revision, l(:text_email_subject_rejected, :name => @workflow.name), l(:text_email_finished_rejected, :name => @workflow.name, :filename => revision.file.name, :notice => action.note), - l(:text_email_to_see_history)).deliver + l(:text_email_to_see_history)).deliver if user end end else if action.action == DmsfWorkflowStepAction::ACTION_DELEGATE # Delegation - delegate = User.find_by_id params[:step_action].to_i / 10 - if delegate - DmsfMailer.workflow_notification( - delegate, - @workflow, - revision, - l(:text_email_subject_delegated, :name => @workflow.name), - l(:text_email_finished_delegated, :name => @workflow.name, :filename => revision.file.name, :notice => action.note), - l(:text_email_to_proceed)).deliver - end + delegate = User.find_by_id params[:step_action].to_i / 10 + DmsfMailer.workflow_notification( + delegate, + @workflow, + revision, + l(:text_email_subject_delegated, :name => @workflow.name), + l(:text_email_finished_delegated, :name => @workflow.name, :filename => revision.file.name, :notice => action.note), + l(:text_email_to_proceed)).deliver if delegate else # Next step assignments = @workflow.next_assignments revision.id @@ -106,15 +104,16 @@ class DmsfWorkflowsController < ApplicationController revision, l(:text_email_subject_reequires_approval, :name => @workflow.name), l(:text_email_finished_step, :name => @workflow.name, :filename => revision.file.name), - l(:text_email_to_proceed)).deliver - end + l(:text_email_to_proceed)).deliver if assignment.user + end + to = User.find_by_id revision.dmsf_workflow_assigned_by DmsfMailer.workflow_notification( - User.find_by_id revision.dmsf_workflow_assigned_by, + to, @workflow, revision, l(:text_email_subject_updated, :name => @workflow.name), l(:text_email_finished_step_short, :name => @workflow.name, :filename => revision.file.name), - l(:text_email_to_see_status)).deliver + l(:text_email_to_see_status)).deliver if to end end end @@ -282,7 +281,7 @@ class DmsfWorkflowsController < ApplicationController revision, l(:text_email_subject_started, :name => @workflow.name), l(:text_email_started, :name => @workflow.name, :filename => revision.file.name), - l(:text_email_to_proceed)).deliver + l(:text_email_to_proceed)).deliver if assignment.user end flash[:notice] = l(:notice_workflow_started) else diff --git a/app/models/dmsf_permission.rb b/test/functional/dmsf_files_controller_test.rb similarity index 74% rename from app/models/dmsf_permission.rb rename to test/functional/dmsf_files_controller_test.rb index 42f351ea..547376d5 100644 --- a/app/models/dmsf_permission.rb +++ b/test/functional/dmsf_files_controller_test.rb @@ -1,22 +1,26 @@ -# Redmine plugin for Document Management System "Features" -# -# Copyright (C) 2011 Vít Jonáš -# Copyright (C) 2012 Daniel Munn -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -class DmsfPermission < ActiveRecord::Base - as_enum :scope, [:SCOPE_WRITE, :SCOPE_READ, :SCOPE_MODIFY, :SCOPE_LOCK, :SCOPE] -end +# Redmine plugin for Document Management System "Features" +# +# Copyright (C) 2012 Daniel Munn +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +require File.dirname(__FILE__) + '/../test_helper' + +class DmsfControllerTest < ActionController::TestCase + # Replace this with your real tests. + def test_truth + assert true + end +end diff --git a/test/unit/dmsf_permission_test.rb b/test/unit/dmsf_permission_test.rb deleted file mode 100644 index edaf4497..00000000 --- a/test/unit/dmsf_permission_test.rb +++ /dev/null @@ -1,44 +0,0 @@ -# Redmine plugin for Document Management System "Features" -# -# Copyright (C) 2012 Daniel Munn -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -require File.expand_path('../../test_helper.rb', __FILE__) - -class DmsfPermissionTest < RedmineDmsf::Test::UnitTest - attr_reader :perm - fixtures :projects, :users, :dmsf_folders, :dmsf_files, :dmsf_file_revisions, - :roles, :members, :member_roles, :enabled_modules, :enumerations - - def setup - end - - test "Static values compute" do - assert_equal 1, DmsfPermission::READ #Read / Browse - assert_equal 2, DmsfPermission::WRITE #Write (new file / owned file) - assert_equal 4, DmsfPermission::MODIFY #Modify existing file/folder - create revision - assert_equal 8, DmsfPermission::LOCK #Ability to lock/unlock - - assert_equal 7, DmsfPermission::MODIFY | DmsfPermission::WRITE | DmsfPermission::READ - end - - test "create" do - -# DmsfPermission - end - -end -