Prevent webhook loops

This commit is contained in:
2022-02-21 07:54:24 -05:00
parent 51cd830710
commit 9dfb27f0a4

View File

@@ -115,6 +115,10 @@ class QboInvoice < ActiveRecord::Base
# TODO create hook for seperate plugin
begin
if cf.name.eql? "VIN"
# Only update if blank to prevent infite loops
# TODO check cf_sync_confict flag once implemented
if cf.string_value.to_s.blank?
vin = Vehicle.find(issue.vehicles_id).vin
break if vin.nil?
if not cf.string_value.to_s.eql? vin
@@ -122,6 +126,8 @@ class QboInvoice < ActiveRecord::Base
logger.debug "VIN has changed"
is_changed = true
end
end
end
rescue
#do nothing