mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Update qbo_purchase.rb
WIP Fixing Purchase Sync Methods
This commit is contained in:
@@ -26,22 +26,24 @@ class QboPurchase < ActiveRecord::Base
|
||||
def self.update_all
|
||||
QboPurchase.get_base.service.all.each { |purchase|
|
||||
|
||||
purchase.line_items.all.each { |line_item|
|
||||
purchase.line_items.all? { |line_item|
|
||||
|
||||
detail = line_item.account_based_expense_line_detail if line_item.detail_type = :account_based_expense_line_detail
|
||||
detail = line_item.item_based_expense_line_detail if line_item.detail_type = :item_based_expense_line_detail
|
||||
|
||||
if detail.billable_status = "Billable"
|
||||
qbo_purchase = find_or_create_by(id: purchase.id)
|
||||
qbo_purchase.line_id = line_item.id
|
||||
qbo_purchase.description = line_item.description
|
||||
qbo_purchase.customer_id = detail.customer_ref
|
||||
if detail
|
||||
if detail.billable_status = "Billable"
|
||||
qbo_purchase = find_or_create_by(id: purchase.id)
|
||||
qbo_purchase.line_id = line_item.id
|
||||
qbo_purchase.description = line_item.description
|
||||
qbo_purchase.customer_id = detail.customer_ref
|
||||
|
||||
#TODO attach to issues
|
||||
#qbo_purchase.issue_id = Issue.find_by_invoice()
|
||||
#TODO attach to issues
|
||||
#qbo_purchase.issue_id = Issue.find_by_invoice()
|
||||
|
||||
qbo_purchase.save!
|
||||
end
|
||||
qbo_purchase.save!
|
||||
end
|
||||
end
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user