Sha256: cdeae793c5bfd8abac4be11e088b7fed697aebd646e24e5da5f5fabf6a132b28

Contents?: true

Size: 604 Bytes

Versions: 3

Compression:

Stored size: 604 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

3 entries across 3 versions & 1 rubygems

Version Path
solidus_print_invoice-1.0.2 app/controllers/spree/admin/orders_controller_decorator.rb
solidus_print_invoice-1.0.1 app/controllers/spree/admin/orders_controller_decorator.rb
solidus_print_invoice-1.0.0 app/controllers/spree/admin/orders_controller_decorator.rb