Sha256: eb4103a413f0cbfb2048c7d10be84edd742604efc34ca433c94dc517f693b6f5

Contents?: true

Size: 595 Bytes

Versions: 2

Compression:

Stored size: 595 Bytes

Contents

Spree::Admin::OrdersController.class_eval do
  respond_to :pdf

  def show
    load_order
    respond_with(@order) do |format|
      format.pdf do
        template = params[:template] || 'invoice'
        if (template == 'invoice') && Spree::PrintInvoice::Config.use_sequential_number? && !@order.invoice_number.present?
          @order.invoice_number = Spree::PrintInvoice::Config.increase_invoice_number
          @order.invoice_date = Date.today
          @order.save!
        end
        render layout: false, template: "spree/admin/orders/#{template}.pdf.prawn"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree-print-invoice-2.2.0 app/controllers/spree/admin/orders_controller_decorator.rb
spree-print-invoice-2.1.0 app/controllers/spree/admin/orders_controller_decorator.rb