mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-04-03 00:31:58 -04:00
Compare commits
2 Commits
5fbc169ade
...
2026.2.15
| Author | SHA1 | Date | |
|---|---|---|---|
| b38f850df3 | |||
| 138e55933b |
@@ -235,6 +235,30 @@ class Customer < ActiveRecord::Base
|
|||||||
def to_s
|
def to_s
|
||||||
return "#{self[:name]} - #{phone_number.split(//).last(4).join unless phone_number.nil?}"
|
return "#{self[:name]} - #{phone_number.split(//).last(4).join unless phone_number.nil?}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Push the updates
|
||||||
|
def save_with_push
|
||||||
|
begin
|
||||||
|
qbo = Qbo.first
|
||||||
|
@details = qbo.perform_authenticated_request do |access_token|
|
||||||
|
service = Quickbooks::Service::Customer.new(
|
||||||
|
company_id: qbo.realm_id,
|
||||||
|
access_token: access_token
|
||||||
|
)
|
||||||
|
service.update(@details)
|
||||||
|
end
|
||||||
|
|
||||||
|
self.id = @details.id
|
||||||
|
rescue => e
|
||||||
|
errors.add(:base, e.message)
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
save_without_push
|
||||||
|
end
|
||||||
|
|
||||||
|
alias_method :save_without_push, :save
|
||||||
|
alias_method :save, :save_with_push
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
@@ -251,24 +275,5 @@ class Customer < ActiveRecord::Base
|
|||||||
@details = Quickbooks::Model::Customer.new
|
@details = Quickbooks::Model::Customer.new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Push the updates
|
|
||||||
def save_with_push
|
|
||||||
begin
|
|
||||||
qbo = Qbo.first
|
|
||||||
@details = qbo.perform_authenticated_request do |access_token|
|
|
||||||
service = Quickbooks::Service::Customer.new(company_id: qbo.realm_id, access_token: access_token)
|
|
||||||
service.update(@details)
|
|
||||||
end
|
|
||||||
#raise "QBO Fault" if @details.fault?
|
|
||||||
self.id = @details.id
|
|
||||||
rescue Exception => e
|
|
||||||
errors.add(e.message)
|
|
||||||
end
|
|
||||||
save_without_push
|
|
||||||
end
|
|
||||||
|
|
||||||
alias_method :save_without_push, :save
|
|
||||||
alias_method :save, :save_with_push
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
2
init.rb
2
init.rb
@@ -14,7 +14,7 @@ Redmine::Plugin.register :redmine_qbo do
|
|||||||
name 'Redmine QBO plugin'
|
name 'Redmine QBO plugin'
|
||||||
author 'Rick Barrette'
|
author 'Rick Barrette'
|
||||||
description 'A pluging for Redmine to connect with QuickBooks Online to create Time Activity Entries for billable hours logged when an Issue is closed'
|
description 'A pluging for Redmine to connect with QuickBooks Online to create Time Activity Entries for billable hours logged when an Issue is closed'
|
||||||
version '2026.2.14'
|
version '2026.2.15'
|
||||||
url 'https://github.com/rickbarrette/redmine_qbo'
|
url 'https://github.com/rickbarrette/redmine_qbo'
|
||||||
author_url 'https://barrettefabrication.com'
|
author_url 'https://barrettefabrication.com'
|
||||||
settings default: {empty: true}, partial: 'qbo/settings'
|
settings default: {empty: true}, partial: 'qbo/settings'
|
||||||
|
|||||||
Reference in New Issue
Block a user