Estimate PDF is now dowloaded and served

TODO: The routes are somehow messed up and need to be fixed.

example: example.com/redmine/redmine/qbo/estimate/1
in lieu: example.com/redmine/qbo/estimate/1
This commit is contained in:
2016-01-17 10:40:37 -05:00
parent 2365fc2cf8
commit 98cd3d51e9
4 changed files with 12 additions and 9 deletions

View File

@@ -10,6 +10,8 @@
class QboController < ApplicationController
unloadable
require 'open-uri'
#
# Called when the QBO Top Menu us shown
@@ -75,9 +77,13 @@ class QboController < ApplicationController
redirect_to qbo_path(:redmine_qbo), :flash => { :notice => "Successfully synced to Quickbooks" }
end
def pdf
@pdf = "#{base.url_for_resource('estimate')}/#{params['qbo_estimate_id']}/pdf"
send_data @pdf, filename: "estimate.pdf", type: :pdf
#
# Downloads and forwards the estimate pdf
#
def estimate_pdf
base = QboEstimate.get_base.service
@pdf = base.pdf(base.fetch_by_id(params[:id]))
send_data @pdf, filename: "estimate.pdf", :disposition => 'inline', :type => "application/pdf"
end
end