mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 040c920481 | |||
| 8c63817950 | |||
| e2f43d398f | |||
| 7ba4829066 | |||
| 938999db91 |
@@ -155,11 +155,13 @@ class Customer < ActiveRecord::Base
|
|||||||
logger.info "Processing customer #{c.id}"
|
logger.info "Processing customer #{c.id}"
|
||||||
customer = Customer.find_or_create_by(id: c.id)
|
customer = Customer.find_or_create_by(id: c.id)
|
||||||
if c.active?
|
if c.active?
|
||||||
if not customer.name.eql? c.display_name
|
#if not customer.name.eql? c.display_name
|
||||||
customer.name = c.display_name
|
customer.name = c.display_name
|
||||||
customer.id = c.id
|
customer.id = c.id
|
||||||
|
customer.phone_number = c.primary_phone.free_form_number.tr('^0-9', '') unless c.primary_phone.nil?
|
||||||
|
customer.mobile_phone_number = c.mobile_phone.free_form_number.tr('^0-9', '') unless c.mobile_phone.nil?
|
||||||
customer.save_without_push
|
customer.save_without_push
|
||||||
end
|
#end
|
||||||
else
|
else
|
||||||
if not c.new_record?
|
if not c.new_record?
|
||||||
customer.delete
|
customer.delete
|
||||||
@@ -178,20 +180,22 @@ class Customer < ActiveRecord::Base
|
|||||||
# This needs to be simplified
|
# This needs to be simplified
|
||||||
def self.sync_by_id(id)
|
def self.sync_by_id(id)
|
||||||
qbo = Qbo.first
|
qbo = Qbo.first
|
||||||
customer = qbo.perform_authenticated_request do |access_token|
|
c = qbo.perform_authenticated_request do |access_token|
|
||||||
service = Quickbooks::Service::Customer.new(:company_id => qbo.realm_id, :access_token => access_token)
|
service = Quickbooks::Service::Customer.new(:company_id => qbo.realm_id, :access_token => access_token)
|
||||||
service.fetch_by_id(id)
|
service.fetch_by_id(id)
|
||||||
end
|
end
|
||||||
|
|
||||||
return unless customer
|
return unless c
|
||||||
|
|
||||||
customer = Customer.find_or_create_by(id: customer.id)
|
customer = Customer.find_or_create_by(id: c.id)
|
||||||
if customer.active?
|
if c.active?
|
||||||
if not customer.name.eql? customer.display_name
|
#if not customer.name.eql? c.display_name
|
||||||
customer.name = customer.display_name
|
customer.name = c.display_name
|
||||||
customer.id = customer.id
|
customer.id = c.id
|
||||||
|
customer.phone_number = c.primary_phone.free_form_number.tr('^0-9', '') unless c.primary_phone.nil?
|
||||||
|
customer.mobile_phone_number = c.mobile_phone.free_form_number.tr('^0-9', '') unless c.mobile_phone.nil?
|
||||||
customer.save_without_push
|
customer.save_without_push
|
||||||
end
|
#end
|
||||||
else
|
else
|
||||||
if not customer.new_record?
|
if not customer.new_record?
|
||||||
customer.delete
|
customer.delete
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<h2><%=t(:field_customer)%> #<%= @customer.id %> - <%= @customer.name %> </h2>
|
<h2><%=t(:field_customer)%> #<%= @customer.id %> - <%= link_to @customer.to_s, "https://app.qbo.intuit.com/app/customerdetail?nameId=#{@customer.id}", target: :_blank %> </h2>
|
||||||
<div class="issue">
|
<div class="issue">
|
||||||
|
|
||||||
<div class="splitcontent">
|
<div class="splitcontent">
|
||||||
|
|||||||
2
init.rb
2
init.rb
@@ -22,7 +22,7 @@ Redmine::Plugin.register :redmine_qbo do
|
|||||||
name 'Redmine Quickbooks Online plugin'
|
name 'Redmine Quickbooks Online plugin'
|
||||||
author 'Rick Barrette'
|
author 'Rick Barrette'
|
||||||
description 'This is a plugin for Redmine to intergrate with Quickbooks Online to allow for seamless intergration CRM and invoicing of completed issues'
|
description 'This is a plugin for Redmine to intergrate with Quickbooks Online to allow for seamless intergration CRM and invoicing of completed issues'
|
||||||
version '2.0.4'
|
version '2.0.5'
|
||||||
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