<%# Redmine plugin for Document Management System "Features" # # Copyright (C) 2014 Karel Pičman # # 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.%>

<%= l(:title_dmsf_workflow_log) %>

<% if params[:dmsf_file_revision_id].present? %> <% revision = DmsfFileRevision.find_by_id(params[:dmsf_file_revision_id]) %> <% if revision %>

<%= label_tag 'workflow_name', "#{l(:link_workflow)} #{l(:field_name).downcase}: " %> <% if User.current.allowed_to?(:manage_workflows, @workflow.project) %> <%= link_to @workflow.name, edit_dmsf_workflow_path(@workflow) %> <% else %> <%= @workflow.name %> <% end %>
<%= label_tag 'workflow_status', "#{l(:field_status)}: " %> <%= revision.workflow_str false %>
<% sql = "SELECT c.action, c.note, c.created_at, c.author_id, a.user_id, s.step FROM dmsf_workflow_step_actions c RIGHT JOIN dmsf_workflow_step_assignments a ON a.id = c.dmsf_workflow_step_assignment_id RIGHT JOIN dmsf_workflow_steps s ON s.id = a.dmsf_workflow_step_id WHERE a.dmsf_file_revision_id = #{revision.id} ORDER BY s.step, c.action DESC, c.created_at" %> <% result = DmsfWorkflowStep.connection.exec_query sql %> <% result.each_with_index do |row, i| %> <% end %>
<%= l(:label_dmsf_workflow_step) %> <%= l(:label_user) %> <%= l(:label_action) %> <%= l(:link_workflow) %> <%= l(:label_note) %> <%= l(:label_date)%>
<%= DmsfWorkflowStepAction.workflow_str(0) %>
<%= link_to_user User.find_by_id(revision.dmsf_workflow_assigned_by) if revision.dmsf_workflow_assigned_by %> <%= DmsfWorkflowStepAction.action_str(DmsfWorkflowStepAction::ACTION_ASSIGN) %> <%= DmsfWorkflowStepAction.workflow_str(DmsfWorkflowStepAction::ACTION_ASSIGN) %> <%= format_time(revision.dmsf_workflow_assigned_at) if revision.dmsf_workflow_assigned_at %>
<%= link_to_user User.find_by_id(revision.dmsf_workflow_started_by) if revision.dmsf_workflow_started_by %> <%= DmsfWorkflowStepAction.action_str(DmsfWorkflowStepAction::ACTION_START) %> <%= DmsfWorkflowStepAction.workflow_str(DmsfWorkflowStepAction::ACTION_START) if revision.dmsf_workflow_started_by %> <%= format_time(revision.dmsf_workflow_started_at) if revision.dmsf_workflow_started_at %>
<%= row['step'] %> <%= link_to_user User.find_by_id(row['author_id'].present? ? row['author_id'] : row['user_id']) %> <%= DmsfWorkflowStepAction.action_str(row['action']) %> <% if((row['step'].to_i == @workflow.dmsf_workflow_steps.last.step) && (revision.workflow == DmsfWorkflow::STATE_APPROVED) && (row['action'] != DmsfWorkflowStepAction::ACTION_DELEGATE)) %> <%= l(:title_approved) %> <% else %> <%= DmsfWorkflowStepAction.workflow_str(row['action']) %> <% end %> <%= row['note'] %> <%= format_time(row['created_at']) if row['created_at'].present? %>
<% end %> <% end %>