<% # Redmine plugin for Document Management System "Features" # # Karel Pičman # # This file is part of Redmine DMSF plugin. # # Redmine DMSF plugin 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 3 of the License, or (at your option) any # later version. # # Redmine DMSF plugin 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 Redmine DMSF plugin. If not, see # . %>

<%= l(:title_dmsf_workflow_log) %>

<% if revision %>

<%= label_tag 'workflow_name', l(:field_label_dmsf_workflow_name) %> <% if User.current.allowed_to?(:manage_workflows, @dmsf_workflow.project) %> <%= link_to @dmsf_workflow.name, dmsf_workflow_path(@dmsf_workflow) %> <% else %> <%= @dmsf_workflow.name %> <% end %>
<%= label_tag 'workflow_status', l(:field_status) %> <%= revision.workflow_str false %>
<%# SQLite3::SQLException: RIGHT and FULL OUTER JOINs are not currently supported %> <%# sql = "SELECT c.action, c.note, c.created_at, c.author_id, a.user_id, s.step, s.name 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, s.id, c.action DESC, c.created_at" %> <% sql = "SELECT c.action, c.note, c.created_at, c.author_id, a.user_id, s.step, s.name FROM dmsf_workflow_steps s LEFT OUTER JOIN dmsf_workflow_step_assignments a ON s.id = a.dmsf_workflow_step_id LEFT OUTER JOIN dmsf_workflow_step_actions c ON a.id = c.dmsf_workflow_step_assignment_id WHERE a.dmsf_file_revision_id = #{revision.id} ORDER BY s.step, s.id, c.action DESC, c.created_at" %> <% result = DmsfWorkflowStep.connection.exec_query sql %> <% last_step = 0 %> <% result.each_with_index do |row, i| %> <% last_step = row['step'] %> <% 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 revision.dmsf_workflow_assigned_by_user if revision.dmsf_workflow_assigned_by_user %> <%= 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 revision.dmsf_workflow_started_by_user if revision.dmsf_workflow_started_by_user %> <%= DmsfWorkflowStepAction.action_str(DmsfWorkflowStepAction::ACTION_START) %> <%= DmsfWorkflowStepAction.workflow_str(DmsfWorkflowStepAction::ACTION_START) if revision.dmsf_workflow_started_by_user %> <%= format_time(revision.dmsf_workflow_started_at) if revision.dmsf_workflow_started_at %>
<%= row['step'] unless row['step'] == last_step %><%= row['name'] %> <%= 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 == @dmsf_workflow.dmsf_workflow_steps.last&.step) && (revision.workflow == DmsfWorkflow::STATE_APPROVED) && (row['action'] != DmsfWorkflowStepAction::ACTION_DELEGATE) %> <%= l(:title_approved) if row['created_at'].present? %> <% else %> <%= DmsfWorkflowStepAction.workflow_str(row['action']) %> <% end %> <%= row['note'] %> <%= format_time(row['created_at']) if row['created_at'].present? %>
<% end %>