  def create_workflow
    Log.add_info(request, params.inspect)

    return unless request.post?

    @tmpl_folder, @tmpl_workflows_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_WORKFLOWS)

    @group_id = params[:group_id]
    SqlHelper.validate_token([@group_id])

    if @group_id.blank?
      @group_id = '0'   # '0' for ROOT
    elsif @group_id == '0'
      ;
    else
      group = nil
      begin
        group = Group.find(@group_id)
      rescue
      end
      if group.nil?
        render(:text => 'ERROR:' + t('msg.already_deleted', :name => Group.model_name.human))
        return
      end
    end

    unless @tmpl_workflows_folder.nil?
      item = Item.new_workflow(@tmpl_workflows_folder.id)
      item.title = t('workflow.new')
      item.user_id = 0
      item.save!

      workflow = Workflow.new
      workflow.item_id = item.id
      workflow.user_id = 0
      workflow.status = Workflow::STATUS_NOT_APPLIED
      if @group_id == '0'
        workflow.groups = nil
      else
        workflow.groups = '|' + @group_id + '|'
      end
      workflow.save!
    else
      Log.add_error(request, nil, '/'+TemplatesHelper::TMPL_ROOT+'/'+TemplatesHelper::TMPL_WORKFLOWS+' NOT found!')
    end

    render(:partial => 'groups/ajax_group_workflows', :layout => false)
  end
The software constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component.