mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Added removal for deleted entery while syncing
Added Invoices & Estimates to QBO#Index
This commit is contained in:
@@ -24,12 +24,24 @@ class QboCustomer < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def self.update_all
|
||||
|
||||
service = get_base.service
|
||||
|
||||
# Update the customer table
|
||||
get_base.service.all.each { |customer|
|
||||
service.all.each { |customer|
|
||||
qbo_customer = QboCustomer.find_or_create_by(id: customer.id)
|
||||
qbo_customer.id = customer.id
|
||||
qbo_customer.name = customer.display_name
|
||||
qbo_customer.save!
|
||||
}
|
||||
|
||||
#remove deleted customers
|
||||
all.each { |customer|
|
||||
begin
|
||||
service.fetch_by_id(customer.id)
|
||||
rescue
|
||||
delete_all(id: customer.id)
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user