Readded nil checks

This commit is contained in:
2016-01-14 21:49:26 -05:00
parent e19688a525
commit 6556197dd0
2 changed files with 15 additions and 5 deletions

View File

@@ -74,4 +74,10 @@ class QboController < ApplicationController
redirect_to qbo_path(:redmine_qbo), :flash => { :notice => "Successfully synced to Quickbooks" } redirect_to qbo_path(:redmine_qbo), :flash => { :notice => "Successfully synced to Quickbooks" }
end end
def pdf
@pdf = "#{base.url_for_resource('estimate')}/#{params['qbo_estimate_id']}/pdf"
send_data @pdf, filename: "estimate.pdf", type: :pdf
end
end end

View File

@@ -21,18 +21,22 @@ class IssuesShowHookListener < Redmine::Hook::ViewListener
issue = context[:issue] issue = context[:issue]
# Check to see if there is a quickbooks user attached to the issue # Check to see if there is a quickbooks user attached to the issue
#unless context[:issue].qbo_customer_id.nil? unless issue.qbo_customer.nil?
@customer = issue.qbo_customer.name @customer = issue.qbo_customer.name
#end end
# Check to see if there is a quickbooks item attached to the issue # Check to see if there is a quickbooks item attached to the issue
@item = issue.qbo_item.name unless issue.qbo_item.nil?
@item = issue.qbo_item.name
end
# Estimate Number # Estimate Number
unless (issue.qbo_estimate.nil?) unless (issue.qbo_estimate.nil?)
QboEstimate.update(issue.qbo_estimate.id) QboEstimate.update(issue.qbo_estimate.id)
@estimate = issue.qbo_estimate.doc_number @estimate = issue.qbo_estimate.doc_number
end end
base = QboEstimate.get_base.service
#base.initialize
return "<div class=\"attributes\"> return "<div class=\"attributes\">
<div class=\"qbo_customer_id attribute\"> <div class=\"qbo_customer_id attribute\">
@@ -47,9 +51,9 @@ class IssuesShowHookListener < Redmine::Hook::ViewListener
<div class=\"qbo_estimate_id attribute\"> <div class=\"qbo_estimate_id attribute\">
<div class=\"label\"><span>Estimate</span>:</div> <div class=\"label\"><span>Estimate</span>:</div>
<div class=\"value\">#{@estimate}</div> <div class=\"value\"><a href=\"</div>
</div> </div>
</div>" </div>"
end end
end end