プラグインが正しく)テンプレート名が欠落している(設定でデフォルト値をインスタンス化しないplzは私を助けて(
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
ルビーを知らいけないんです。 チェックボックス(トラッカーの[印刷]ボタンを有効にする)をオンにしても、テンプレート名が格納されず、エラーが発生します。
これを回避する簡単な方法:ボタンのテキストを変更して(後で元に戻すことができます)、「適用」を押します。テンプレート名の保存がトリガーされます。
例テンプレートは例のテンプレートと同じです:例: