mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user