Added nil check

This commit is contained in:
2018-10-15 19:42:41 -04:00
parent 102309600e
commit 1b5e185087

View File

@@ -23,8 +23,10 @@ class IssuesFormHookListener < Redmine::Hook::ViewListener
f = context[:form]
#check project level customer/vehicle ownership first
selected_customer = context[:project].customer ? context[:project].customer.id : nil
selected_vehicle = context[:project].vehicle ? context[:project].vehicle.id : nil
if context[:project]
selected_customer = context[:project].customer ? context[:project].customer.id : nil
selected_vehicle = context[:project].vehicle ? context[:project].vehicle.id : nil
end
# Check to see if there is a quickbooks user attached to the issue
selected_customer = context[:issue].customer ? context[:issue].customer.id : nil