【问题标题】:Plugin crash with Ruby in redmine_print_issue pluginredmine_print_issue 插件中的 Ruby 插件崩溃
【发布时间】:2017-12-26 08:54:29
【问题描述】:

我在 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/patches/ 问题_控制器_pa tch.rb:24:in show_with_print' lib/redmine/sudo_mode.rb:63:insudo_mode' 在

我不认识鲁比(

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

请帮帮我

【问题讨论】:

    标签: debian redmine


    【解决方案1】:

    插件在设置中没有正确实例化其默认值(模板名称丢失)。 仅选中复选框(这将为您的跟踪器启用“打印”按钮)不会触发存储模板名称,这会导致您遇到错误。

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

    顺便说一句,您当然应该选择自己的模板,因为示例模板就是这样:一个示例

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-21
      • 2013-10-18
      • 1970-01-01
      • 1970-01-01
      • 2017-09-03
      • 2010-09-23
      • 2012-07-12
      • 1970-01-01
      相关资源
      最近更新 更多