From fd8a068f1607829c0bc924ab2b0020ff25b07841 Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Mon, 18 Apr 2016 12:09:41 -0400 Subject: [PATCH] Update invoice_controller.rb Added Document Number to filename --- app/controllers/invoice_controller.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/controllers/invoice_controller.rb b/app/controllers/invoice_controller.rb index d0a188e..8103113 100644 --- a/app/controllers/invoice_controller.rb +++ b/app/controllers/invoice_controller.rb @@ -10,12 +10,13 @@ class InvoiceController < ApplicationController unloadable - # + # # Downloads and forwards the invoice pdf # def show base = QboInvoice.get_base.service - @pdf = base.pdf(base.fetch_by_id(params[:id])) - send_data @pdf, filename: "invoice.pdf", :disposition => 'inline', :type => "application/pdf" + invoice = base.fetch_by_id(params[:id]) + @pdf = base.pdf(invoice) + send_data @pdf, filename: "invoice #{invoice.doc_number}.pdf", :disposition => 'inline', :type => "application/pdf" end end