This commit is contained in:
2016-07-28 09:01:41 -04:00
parent fecc4956b4
commit fe97a589d9

View File

@@ -115,14 +115,14 @@ class Customer < ActiveRecord::Base
service = Qbo.get_base(:customer).service service = Qbo.get_base(:customer).service
# Sync ALL customers if the database is empty # Sync ALL customers if the database is empty
if count == 0 #if count == 0
customers = service.all customers = service.all
else #else
last = Qbo.first.last_sync # last = Qbo.first.last_sync
query = "Select Id, DisplayName From Customer" # query = "Select Id, DisplayName From Customer"
query << " Where Metadata.LastUpdatedTime >= '#{last.iso8601}' " if last # query << " Where Metadata.LastUpdatedTime >= '#{last.iso8601}' " if last
customers = service.query(query) # customers = service.query(query)
end #end
customers.each do |customer| customers.each do |customer|
qbo_customer = Customer.find_or_create_by(id: customer.id) qbo_customer = Customer.find_or_create_by(id: customer.id)