mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Added sanity checks for QBO info
This commit is contained in:
@@ -15,6 +15,9 @@ class IssuesSaveHookListener < Redmine::Hook::ViewListener
|
|||||||
issue = context[:issue]
|
issue = context[:issue]
|
||||||
cf_estimate = CustomField.find_by_name("Estimate")
|
cf_estimate = CustomField.find_by_name("Estimate")
|
||||||
|
|
||||||
|
# Check to see if we have registered with QBO
|
||||||
|
unless Qbo.first.nil? and issue.qbo_customer_id.nil? and issue.qbo_item_id.nil? and employee_id.nil? then
|
||||||
|
|
||||||
# if this is a quote, lets create a new estimate based off estimated hours
|
# if this is a quote, lets create a new estimate based off estimated hours
|
||||||
if issue.tracker.name = "Quote" and issue.status.name = "New" and cf_estimate.nil? then
|
if issue.tracker.name = "Quote" and issue.status.name = "New" and cf_estimate.nil? then
|
||||||
|
|
||||||
@@ -43,7 +46,7 @@ class IssuesSaveHookListener < Redmine::Hook::ViewListener
|
|||||||
issue.custom_field_values = {CustomField.find_by_name("Estimate").id => created_estimate.doc_number}
|
issue.custom_field_values = {CustomField.find_by_name("Estimate").id => created_estimate.doc_number}
|
||||||
issue.save!
|
issue.save!
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# After Issue Saved
|
# After Issue Saved
|
||||||
|
|||||||
Reference in New Issue
Block a user