From 8b78e113f946bfcd1c1976e003761851008e0dce Mon Sep 17 00:00:00 2001 From: Rick Barrette Date: Sun, 10 Jan 2016 10:11:15 -0500 Subject: [PATCH] Only pull QBO Service Items & Auto sync QBO Items --- app/models/qbo_item.rb | 2 +- app/views/qbo/index.html.erb | 3 +-- lib/issues_form_hook_listener.rb | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/models/qbo_item.rb b/app/models/qbo_item.rb index d4263bc..e5b2406 100644 --- a/app/models/qbo_item.rb +++ b/app/models/qbo_item.rb @@ -19,7 +19,7 @@ class QboItem < ActiveRecord::Base service = Quickbooks::Service::Item.new(:company_id => qbo.realmId, :access_token => Qbo.get_auth_token) # Update the item table - service.all.each { |item| + service.find_by(:type, "Service").each { |item| qbo_item = QboItem.find_or_create_by(id: item.id) qbo_item.name = item.name qbo_item.id = item.id diff --git a/app/views/qbo/index.html.erb b/app/views/qbo/index.html.erb index 120e5de..4970578 100644 --- a/app/views/qbo/index.html.erb +++ b/app/views/qbo/index.html.erb @@ -39,5 +39,4 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI

<%= link_to "Sync", qbo_sync_path %> - -t \ No newline at end of file + \ No newline at end of file diff --git a/lib/issues_form_hook_listener.rb b/lib/issues_form_hook_listener.rb index ae35516..be13913 100644 --- a/lib/issues_form_hook_listener.rb +++ b/lib/issues_form_hook_listener.rb @@ -16,7 +16,7 @@ class IssuesFormHookListener < Redmine::Hook::ViewListener selected = "" QboCustomers.update_all - #QboItem.update_all + QboItem.update_all # Check to see if there is a quickbooks user attached to the issue if not context[:issue].qbo_customer_id.nil? then