mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Update customer.rb
This commit is contained in:
@@ -109,13 +109,17 @@ class Customer < ActiveRecord::Base
|
|||||||
# Update the customer table
|
# Update the customer table
|
||||||
customers.each { |customer|
|
customers.each { |customer|
|
||||||
|
|
||||||
background do
|
background do
|
||||||
qbo_customer = Customer.find_or_create_by(id: customer.id)
|
Customer.without_callback(:initialize, :after, :pull) do
|
||||||
# only update if diffrent
|
Customer.without_callback(:save, :before, :push) do
|
||||||
if qbo_customer.new_record?
|
qbo_customer = Customer.find_or_create_by(id: customer.id)
|
||||||
qbo_customer.name = customer.display_name
|
# only update if diffrent
|
||||||
qbo_customer.id = customer.id
|
if qbo_customer.new_record?
|
||||||
qbo_customer.save!
|
qbo_customer.name = customer.display_name
|
||||||
|
qbo_customer.id = customer.id
|
||||||
|
qbo_customer.save!
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user