mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Update qbo_invoice.rb
This commit is contained in:
@@ -20,7 +20,14 @@ class QboInvoice < ActiveRecord::Base
|
|||||||
|
|
||||||
def self.sync
|
def self.sync
|
||||||
#Pull the invoices from the quickbooks server
|
#Pull the invoices from the quickbooks server
|
||||||
invoices = get_base.service.all
|
#invoices = get_base.service.all
|
||||||
|
|
||||||
|
last = Qbo.first.last_sync
|
||||||
|
|
||||||
|
query = "SELECT Id, DocNumber FROM Invoice"
|
||||||
|
query << " WHERE Metadata.LastUpdatedTime>'#{last}' " if last
|
||||||
|
|
||||||
|
customers = get_base.service.query()
|
||||||
|
|
||||||
# Update the invoice table
|
# Update the invoice table
|
||||||
transaction do
|
transaction do
|
||||||
@@ -33,7 +40,7 @@ class QboInvoice < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
#remove deleted invoices
|
#remove deleted invoices
|
||||||
where.not(invoices.map(&:id)).destroy_all
|
#where.not(invoices.map(&:id)).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.update(id)
|
def self.update(id)
|
||||||
|
|||||||
Reference in New Issue
Block a user