mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Fixed invoice pdf
This commit is contained in:
@@ -21,15 +21,12 @@ class InvoiceController < ApplicationController
|
|||||||
def show
|
def show
|
||||||
begin
|
begin
|
||||||
qbo = Qbo.first
|
qbo = Qbo.first
|
||||||
@pdf = qbo.perform_authenticated_request do |access_token|
|
qbo.perform_authenticated_request do |access_token|
|
||||||
service = Quickbooks::Service::Invoice.new(:company_id => qbo.realm_id, :access_token => access_token)
|
service = Quickbooks::Service::Invoice.new(:company_id => qbo.realm_id, :access_token => access_token)
|
||||||
invoice = service.fetch_by_id(params[:id])
|
invoice = service.fetch_by_id(params[:id])
|
||||||
service.pdf(invoice)
|
@pdf = service.pdf(invoice)
|
||||||
|
send_data @pdf, filename: "invoice #{invoice.doc_number}.pdf", :disposition => 'inline', :type => "application/pdf"
|
||||||
end
|
end
|
||||||
|
|
||||||
return unless @pdf
|
|
||||||
|
|
||||||
send_data @pdf, filename: "invoice #{invoice.doc_number}.pdf", :disposition => 'inline', :type => "application/pdf"
|
|
||||||
rescue
|
rescue
|
||||||
redirect_to :back, :flash => { :error => "Invoice not found" }
|
redirect_to :back, :flash => { :error => "Invoice not found" }
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user