mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Update qbo_controller.rb
This commit is contained in:
@@ -57,7 +57,7 @@ class QboController < ApplicationController
|
|||||||
qbo.reconnect_token_at = 5.months.from_now.utc
|
qbo.reconnect_token_at = 5.months.from_now.utc
|
||||||
qbo.company_id = params['realmId']
|
qbo.company_id = params['realmId']
|
||||||
if qbo.save!
|
if qbo.save!
|
||||||
redirect_to qbo_path, :flash => { :notice => "Successfully connected to Quickbooks" }
|
redirect_to qbo_sync_path, :flash => { :notice => "Successfully connected to Quickbooks" }
|
||||||
else
|
else
|
||||||
redirect_to plugin_settings_path(:redmine_qbo), :flash => { :error => "Error" }
|
redirect_to plugin_settings_path(:redmine_qbo), :flash => { :error => "Error" }
|
||||||
end
|
end
|
||||||
@@ -118,6 +118,8 @@ class QboController < ApplicationController
|
|||||||
# Synchronizes the QboCustomer table with QBO
|
# Synchronizes the QboCustomer table with QBO
|
||||||
#
|
#
|
||||||
def sync
|
def sync
|
||||||
|
# Update info in background
|
||||||
|
Thread.new do
|
||||||
if Qbo.exists?
|
if Qbo.exists?
|
||||||
Customer.sync
|
Customer.sync
|
||||||
QboItem.sync
|
QboItem.sync
|
||||||
@@ -128,6 +130,8 @@ class QboController < ApplicationController
|
|||||||
# Record the last sync time
|
# Record the last sync time
|
||||||
Qbo.update_time_stamp
|
Qbo.update_time_stamp
|
||||||
end
|
end
|
||||||
|
ActiveRecord::Base.connection.close
|
||||||
|
end
|
||||||
|
|
||||||
redirect_to qbo_path(:redmine_qbo), :flash => { :notice => "Successfully synced to Quickbooks" }
|
redirect_to qbo_path(:redmine_qbo), :flash => { :notice => "Successfully synced to Quickbooks" }
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user