插件在redmine_print_issue插件中与Ruby崩溃

时间:2017-12-26 08:54:30

标签: debian redmine

我在redmine中的配置,我是安装插件并收到错误

Environment:
Redmine version                3.3.5.stable
Ruby version                   2.3.4-p301 (2017-03-30) [x86_64-linux]
Rails version                  4.2.7.1
Environment                    production
Database adapter               Mysql2
SCM:
Subversion                     1.8.10
Git                            2.1.4
redmine_print_issue            2.0.4

插件崩溃500内部服务器错误     NoMethodError(未定义的方法`+'代表nil:NilClass):

  

插件/ redmine_print_issue / LIB / redmine_print_issue /补丁/   issues_controller_pa   tch.rb:24:in show_with_print' lib/redmine/sudo_mode.rb:63:in sudo_mode'   在

我不认识Ruby(

module RedminePrintIssue
  module Patches

    module IssuesControllerPatch
      def self.included(base) # :nodoc:
        base.send(:include, InstanceMethods)

        base.class_eval do
          Mime::Type.register "application/vnd.oasis.opendocument.text", 
:odt, [], %w(odt)
          alias_method_chain :show, :print
        end
      end

      module InstanceMethods
        def show_with_print
          if request.formats.include? :odt then
            ofile = Tempfile.new('print_template')
            begin
              qrcode = RQRCode::QRCode.new(url_for @order)
              imgfile = Tempfile.new('print_template_image')
              imgfile.write qrcode.as_svg
              @issue.class_eval('def images=(images); @images=images; end')
              @issue.images = { "qrcode" => imgfile.path }
              @issue.render_odt 
@issue.odt_path(Setting.plugin_redmine_print_issue["tracker_#
{@issue.tracker_id.to_s}_template"]+'.odt'), ofile.path
              respond_to do |format|
                format.odt { send_file ofile.path, type: "application/vnd.oasis.opendocument.text", filename: "##{@issue.id} #{@issue.subject}.odt" }
              end
            ensure
              ofile.close
              imgfile.close
            end
          else
            show_without_print
          end
        end
      end

    end
  end
end

unless IssuesController.included_modules.include?(RedminePrintIssue::Patches::IssuesControllerPatch)
  IssuesController.send(:include, RedminePrintIssue::Patches::IssuesControllerPatch)
end

帮我plz

1 个答案:

答案 0 :(得分:0)

插件无法在设置中正确实例化其默认值(缺少模板名称)。 只选中复选框(将启用跟踪器的“打印”按钮)将不会触发存储模板名称,从而导致您遇到错误。

简单解决此问题:更改按钮文本(之后可以将其更改),然后按“应用” - 这将触发存储模板名称。

当然,你应该选择自己的模板,因为示例模板只是:一个例子