mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-10-04 09:10:43 -04:00
Update qbo_item.rb
This commit is contained in:
1 parent
a715434f42
commit
b771199e3d
1 file changed
+5
-3
@@ -21,6 +21,8 @@ class QboItem < ActiveRecord::Base
|
|||||||
def self.sync
|
def self.sync
|
||||||
last = Qbo.first.last_sync
|
last = Qbo.first.last_sync
|
||||||
|
|
||||||
|
QboItem.delete_all
|
||||||
|
|
||||||
query = "SELECT Id, Name FROM Item "
|
query = "SELECT Id, Name FROM Item "
|
||||||
query << " WHERE Type = 'Service' "
|
query << " WHERE Type = 'Service' "
|
||||||
#query << " AND Metadata.LastUpdatedTime > '#{last}' " if last
|
#query << " AND Metadata.LastUpdatedTime > '#{last}' " if last
|
||||||
@@ -34,9 +36,9 @@ class QboItem < ActiveRecord::Base
|
|||||||
qbo_item.id = item.id
|
qbo_item.id = item.id
|
||||||
qbo_item.save
|
qbo_item.save
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QboItem.where.not(items.map(&:id)).destroy_all
|
||||||
end
|
end
|
||||||
|
|
||||||
#remove deleted items
|
|
||||||
QboItem.where.not(items.map(&:id)).destroy_all
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
Reference in new issue
Block a user