mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Prevent webhook loops
This commit is contained in:
@@ -115,12 +115,18 @@ class QboInvoice < ActiveRecord::Base
|
|||||||
# TODO create hook for seperate plugin
|
# TODO create hook for seperate plugin
|
||||||
begin
|
begin
|
||||||
if cf.name.eql? "VIN"
|
if cf.name.eql? "VIN"
|
||||||
vin = Vehicle.find(issue.vehicles_id).vin
|
# Only update if blank to prevent infite loops
|
||||||
break if vin.nil?
|
# TODO check cf_sync_confict flag once implemented
|
||||||
if not cf.string_value.to_s.eql? vin
|
if cf.string_value.to_s.blank?
|
||||||
cf.string_value = vin.to_s
|
|
||||||
logger.debug "VIN has changed"
|
vin = Vehicle.find(issue.vehicles_id).vin
|
||||||
is_changed = true
|
break if vin.nil?
|
||||||
|
if not cf.string_value.to_s.eql? vin
|
||||||
|
cf.string_value = vin.to_s
|
||||||
|
logger.debug "VIN has changed"
|
||||||
|
is_changed = true
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
|
|||||||
Reference in New Issue
Block a user