mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-08 17:04:23 -05:00
Compare commits
36 Commits
2.0.5
...
9779437c00
| Author | SHA1 | Date | |
|---|---|---|---|
| 9779437c00 | |||
| 1a37926628 | |||
| dac9a7c756 | |||
| 9ac1261ed0 | |||
| 9b69d3f728 | |||
| a5de879260 | |||
| 6464e1cbc6 | |||
| 7f3a94229a | |||
| 395e0117fb | |||
| e04d363e42 | |||
| 3b6c0d4a70 | |||
| d1f6ccd9cb | |||
| 74f7ba41df | |||
| 4fb424faa8 | |||
| 63218e7f42 | |||
| 7f0bb3cae7 | |||
| ad7417c233 | |||
| cf0be2336b | |||
| 6e08746611 | |||
| 7eb26facaf | |||
| 9115cc662c | |||
| 9e7c1dbfb2 | |||
| e99f5d2e52 | |||
| 039d1ca993 | |||
| dd9ac3c481 | |||
| 4f789080e7 | |||
| 80fc858a35 | |||
| 6f8d280657 | |||
| 5782cbc166 | |||
| 0729d2ac41 | |||
| 6c6de0ba86 | |||
| 11dbcaf80c | |||
| 95592e542f | |||
| 472bdec4fa | |||
| c7a313e9ed | |||
| c14b590083 |
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
|||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2016 - 2023 Rick Barrette
|
Copyright (c) 2016 - 2024 Rick Barrette
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2022 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
# This controller class will handle map management
|
# This controller class will handle map management
|
||||||
class CustomersController < ApplicationController
|
class CustomersController < ApplicationController
|
||||||
unloadable
|
|
||||||
|
|
||||||
include AuthHelper
|
include AuthHelper
|
||||||
helper :issues
|
helper :issues
|
||||||
@@ -142,7 +141,7 @@ class CustomersController < ApplicationController
|
|||||||
def share
|
def share
|
||||||
|
|
||||||
Thread.new do
|
Thread.new do
|
||||||
logger.debug "Removing expired customer tokens"
|
logger.info "Removing expired customer tokens"
|
||||||
CustomerToken.remove_expired_tokens
|
CustomerToken.remove_expired_tokens
|
||||||
ActiveRecord::Base.connection.close
|
ActiveRecord::Base.connection.close
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2022 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
#
|
#
|
||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
class EstimateController < ApplicationController
|
class EstimateController < ApplicationController
|
||||||
unloadable
|
|
||||||
|
|
||||||
include AuthHelper
|
include AuthHelper
|
||||||
|
|
||||||
@@ -16,6 +15,15 @@ class EstimateController < ApplicationController
|
|||||||
skip_before_action :verify_authenticity_token, :check_if_login_required, :unless => proc {|c| session[:token].nil? }
|
skip_before_action :verify_authenticity_token, :check_if_login_required, :unless => proc {|c| session[:token].nil? }
|
||||||
|
|
||||||
def get_estimate
|
def get_estimate
|
||||||
|
# Force sync for estimate by doc number if not found
|
||||||
|
if Estimate.find_by_doc_number(params[:search]).nil?
|
||||||
|
begin
|
||||||
|
Estimate.sync_by_doc_number(params[:search]) if params[:search]
|
||||||
|
rescue
|
||||||
|
logger.info "Estimate.find_by_doc_number failed"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
estimate = Estimate.find_by_id(params[:id]) if params[:id]
|
estimate = Estimate.find_by_id(params[:id]) if params[:id]
|
||||||
estimate = Estimate.find_by_doc_number(params[:search]) if params[:search]
|
estimate = Estimate.find_by_doc_number(params[:search]) if params[:search]
|
||||||
return estimate
|
return estimate
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2023 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -8,7 +8,6 @@
|
|||||||
#
|
#
|
||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
class InvoiceController < ApplicationController
|
class InvoiceController < ApplicationController
|
||||||
unloadable
|
|
||||||
|
|
||||||
include AuthHelper
|
include AuthHelper
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2023 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
class QboController < ApplicationController
|
class QboController < ApplicationController
|
||||||
unloadable
|
|
||||||
|
|
||||||
require 'openssl'
|
require 'openssl'
|
||||||
|
|
||||||
@@ -26,9 +25,10 @@ class QboController < ApplicationController
|
|||||||
# Called when the user requests that Redmine to connect to QBO
|
# Called when the user requests that Redmine to connect to QBO
|
||||||
#
|
#
|
||||||
def authenticate
|
def authenticate
|
||||||
|
redirect_uri = "https://" + Setting.host_name + qbo_oauth_callback_path
|
||||||
|
logger.info "redirect_uri: " + redirect_uri
|
||||||
oauth2_client = Qbo.construct_oauth2_client
|
oauth2_client = Qbo.construct_oauth2_client
|
||||||
callback = Setting.host_name + "/qbo/oauth_callback/"
|
grant_url = oauth2_client.auth_code.authorize_url(redirect_uri: redirect_uri, response_type: "code", state: SecureRandom.hex(12), scope: "com.intuit.quickbooks.accounting")
|
||||||
grant_url = oauth2_client.auth_code.authorize_url(redirect_uri: callback, response_type: "code", state: SecureRandom.hex(12), scope: "com.intuit.quickbooks.accounting")
|
|
||||||
redirect_to grant_url
|
redirect_to grant_url
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ class QboController < ApplicationController
|
|||||||
if params[:state].present?
|
if params[:state].present?
|
||||||
oauth2_client = Qbo.construct_oauth2_client
|
oauth2_client = Qbo.construct_oauth2_client
|
||||||
# use the state value to retrieve from your backend any information you need to identify the customer in your system
|
# use the state value to retrieve from your backend any information you need to identify the customer in your system
|
||||||
redirect_uri = Setting.host_name + "/qbo/oauth_callback/"
|
redirect_uri = "https://" + Setting.host_name + qbo_oauth_callback_path
|
||||||
if resp = oauth2_client.auth_code.get_token(params[:code], redirect_uri: redirect_uri)
|
if resp = oauth2_client.auth_code.get_token(params[:code], redirect_uri: redirect_uri)
|
||||||
|
|
||||||
# Remove the last authentication information
|
# Remove the last authentication information
|
||||||
@@ -84,46 +84,48 @@ class QboController < ApplicationController
|
|||||||
|
|
||||||
# proceed if the request is good
|
# proceed if the request is good
|
||||||
if hash.eql? signature
|
if hash.eql? signature
|
||||||
if request.headers['content-type'] == 'application/json'
|
Thread.new do
|
||||||
data = JSON.parse(data)
|
if request.headers['content-type'] == 'application/json'
|
||||||
else
|
data = JSON.parse(data)
|
||||||
# application/x-www-form-urlencoded
|
|
||||||
data = params.as_json
|
|
||||||
end
|
|
||||||
# Process the information
|
|
||||||
entities = data['eventNotifications'][0]['dataChangeEvent']['entities']
|
|
||||||
entities.each do |entity|
|
|
||||||
id = entity['id'].to_i
|
|
||||||
name = entity['name']
|
|
||||||
|
|
||||||
logger.debug "Casting #{name.constantize} to obj"
|
|
||||||
|
|
||||||
# Magicly initialize the correct class
|
|
||||||
obj = name.constantize
|
|
||||||
|
|
||||||
# for merge events
|
|
||||||
obj.destroy(entity['deletedId']) if entity['deletedId']
|
|
||||||
|
|
||||||
#Check to see if we are deleting a record
|
|
||||||
if entity['operation'].eql? "Delete"
|
|
||||||
obj.destroy(id)
|
|
||||||
#if not then update!
|
|
||||||
else
|
else
|
||||||
begin
|
# application/x-www-form-urlencoded
|
||||||
obj.sync_by_id(id)
|
data = params.as_json
|
||||||
rescue => e
|
end
|
||||||
logger.error "Failed to call sync_by_id on obj"
|
# Process the information
|
||||||
logger.error e.message
|
entities = data['eventNotifications'][0]['dataChangeEvent']['entities']
|
||||||
logger.error e.backtrace.join("\n")
|
entities.each do |entity|
|
||||||
|
id = entity['id'].to_i
|
||||||
|
name = entity['name']
|
||||||
|
|
||||||
|
logger.info "Casting #{name.constantize} to obj"
|
||||||
|
|
||||||
|
# Magicly initialize the correct class
|
||||||
|
obj = name.constantize
|
||||||
|
|
||||||
|
# for merge events
|
||||||
|
obj.destroy(entity['deletedId']) if entity['deletedId']
|
||||||
|
|
||||||
|
#Check to see if we are deleting a record
|
||||||
|
if entity['operation'].eql? "Delete"
|
||||||
|
obj.destroy(id)
|
||||||
|
#if not then update!
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
obj.sync_by_id(id)
|
||||||
|
rescue => e
|
||||||
|
logger.error "Failed to call sync_by_id on obj"
|
||||||
|
logger.error e.message
|
||||||
|
logger.error e.backtrace.join("\n")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Record that last time we updated
|
||||||
|
Qbo.update_time_stamp
|
||||||
|
ActiveRecord::Base.connection.close
|
||||||
end
|
end
|
||||||
|
|
||||||
# Record that last time we updated
|
|
||||||
Qbo.update_time_stamp
|
|
||||||
|
|
||||||
# The webhook doesn't require a response but let's make sure we don't send anything
|
# The webhook doesn't require a response but let's make sure we don't send anything
|
||||||
render :nothing => true
|
render :nothing => true, status: 200
|
||||||
else
|
else
|
||||||
render nothing: true, status: 400
|
render nothing: true, status: 400
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2022 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
|
|
||||||
# This controller class will handle map management
|
# This controller class will handle map management
|
||||||
class VehiclesController < ApplicationController
|
class VehiclesController < ApplicationController
|
||||||
unloadable
|
|
||||||
|
|
||||||
include AuthHelper
|
include AuthHelper
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ module QuickbooksOauth
|
|||||||
begin
|
begin
|
||||||
yield oauth_access_token
|
yield oauth_access_token
|
||||||
rescue OAuth2::Error, Quickbooks::AuthorizationFailure => ex
|
rescue OAuth2::Error, Quickbooks::AuthorizationFailure => ex
|
||||||
Rails.logger.info("QuickbooksOauth.perform: #{ex.message}")
|
Rails.logger.error("QuickbooksOauth.perform: #{ex.message}")
|
||||||
|
|
||||||
# to prevent an infinite loop here keep a counter and bail out after N times...
|
# to prevent an infinite loop here keep a counter and bail out after N times...
|
||||||
attempts += 1
|
attempts += 1
|
||||||
@@ -36,6 +36,7 @@ module QuickbooksOauth
|
|||||||
end
|
end
|
||||||
|
|
||||||
def refresh_token!
|
def refresh_token!
|
||||||
|
Rails.logger.info("QuickbooksOauth.refresh_token!")
|
||||||
t = oauth_access_token
|
t = oauth_access_token
|
||||||
refreshed = t.refresh!
|
refreshed = t.refresh!
|
||||||
|
|
||||||
@@ -45,6 +46,8 @@ module QuickbooksOauth
|
|||||||
oauth2_refresh_token_expires_at = 100.days.from_now
|
oauth2_refresh_token_expires_at = 100.days.from_now
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Rails.logger.info("QuickbooksOauth.refresh_token!: #{oauth2_refresh_token_expires_at}")
|
||||||
|
|
||||||
update!(
|
update!(
|
||||||
oauth2_access_token: refreshed.token,
|
oauth2_access_token: refreshed.token,
|
||||||
oauth2_access_token_expires_at: Time.at(refreshed.expires_at),
|
oauth2_access_token_expires_at: Time.at(refreshed.expires_at),
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2023 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
class Customer < ActiveRecord::Base
|
class Customer < ActiveRecord::Base
|
||||||
unloadable
|
|
||||||
|
|
||||||
has_many :issues
|
has_many :issues
|
||||||
has_many :purchases
|
has_many :purchases
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2022 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
class CustomerToken < ActiveRecord::Base
|
class CustomerToken < ActiveRecord::Base
|
||||||
unloadable
|
|
||||||
has_many :issues
|
has_many :issues
|
||||||
validates_presence_of :issue_id
|
validates_presence_of :issue_id
|
||||||
before_create :generate_token, :generate_expire_date
|
before_create :generate_token, :generate_expire_date
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2023 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
class Employee < ActiveRecord::Base
|
class Employee < ActiveRecord::Base
|
||||||
unloadable
|
|
||||||
has_many :users
|
has_many :users
|
||||||
validates_presence_of :id, :name
|
validates_presence_of :id, :name
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2023 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
class Estimate < ActiveRecord::Base
|
class Estimate < ActiveRecord::Base
|
||||||
unloadable
|
|
||||||
|
|
||||||
has_and_belongs_to_many :issues
|
has_and_belongs_to_many :issues
|
||||||
belongs_to :customer
|
belongs_to :customer
|
||||||
@@ -18,7 +17,7 @@ class Estimate < ActiveRecord::Base
|
|||||||
|
|
||||||
# sync all estimates
|
# sync all estimates
|
||||||
def self.sync
|
def self.sync
|
||||||
logger.debug "Syncing ALL estimates"
|
logger.info "Syncing ALL estimates"
|
||||||
qbo = Qbo.first
|
qbo = Qbo.first
|
||||||
estimates = qbo.perform_authenticated_request do |access_token|
|
estimates = qbo.perform_authenticated_request do |access_token|
|
||||||
service = Quickbooks::Service::Estimate.new(:company_id => qbo.realm_id, :access_token => access_token)
|
service = Quickbooks::Service::Estimate.new(:company_id => qbo.realm_id, :access_token => access_token)
|
||||||
@@ -37,13 +36,23 @@ class Estimate < ActiveRecord::Base
|
|||||||
|
|
||||||
# sync only one estimate
|
# sync only one estimate
|
||||||
def self.sync_by_id(id)
|
def self.sync_by_id(id)
|
||||||
logger.debug "Syncing estimate #{id}"
|
logger.info "Syncing estimate #{id}"
|
||||||
qbo = Qbo.first
|
qbo = Qbo.first
|
||||||
qbo.perform_authenticated_request do |access_token|
|
qbo.perform_authenticated_request do |access_token|
|
||||||
service = Quickbooks::Service::Estimate.new(:company_id => qbo.realm_id, :access_token => access_token)
|
service = Quickbooks::Service::Estimate.new(:company_id => qbo.realm_id, :access_token => access_token)
|
||||||
process_estimate(service.fetch_by_id(id))
|
process_estimate(service.fetch_by_id(id))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# sync only one estimate
|
||||||
|
def self.sync_by_doc_number(number)
|
||||||
|
logger.info "Syncing estimate by doc number #{number}"
|
||||||
|
qbo = Qbo.first
|
||||||
|
qbo.perform_authenticated_request do |access_token|
|
||||||
|
service = Quickbooks::Service::Estimate.new(:company_id => qbo.realm_id, :access_token => access_token)
|
||||||
|
process_estimate(service.find_by( :doc_number, number).first)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# update an estimate
|
# update an estimate
|
||||||
def self.update(id)
|
def self.update(id)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2023 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
class Invoice < ActiveRecord::Base
|
class Invoice < ActiveRecord::Base
|
||||||
unloadable
|
|
||||||
has_and_belongs_to_many :issues
|
has_and_belongs_to_many :issues
|
||||||
belongs_to :customer
|
belongs_to :customer
|
||||||
validates_presence_of :doc_number, :id, :customer_id, :txn_date
|
validates_presence_of :doc_number, :id, :customer_id, :txn_date
|
||||||
@@ -17,7 +17,7 @@ class Invoice < ActiveRecord::Base
|
|||||||
|
|
||||||
# sync ALL the invoices
|
# sync ALL the invoices
|
||||||
def self.sync
|
def self.sync
|
||||||
logger.debug "Syncing all invoices"
|
logger.info "Syncing all invoices"
|
||||||
last = Qbo.first.last_sync
|
last = Qbo.first.last_sync
|
||||||
|
|
||||||
query = "SELECT Id, DocNumber FROM Invoice"
|
query = "SELECT Id, DocNumber FROM Invoice"
|
||||||
@@ -40,7 +40,7 @@ class Invoice < ActiveRecord::Base
|
|||||||
|
|
||||||
#sync by invoice ID
|
#sync by invoice ID
|
||||||
def self.sync_by_id(id)
|
def self.sync_by_id(id)
|
||||||
logger.debug "Syncing invoice #{id}"
|
logger.info "Syncing invoice #{id}"
|
||||||
qbo = Qbo.first
|
qbo = Qbo.first
|
||||||
qbo.perform_authenticated_request do |access_token|
|
qbo.perform_authenticated_request do |access_token|
|
||||||
service = Quickbooks::Service::Invoice.new(:company_id => qbo.realm_id, :access_token => access_token)
|
service = Quickbooks::Service::Invoice.new(:company_id => qbo.realm_id, :access_token => access_token)
|
||||||
@@ -58,7 +58,7 @@ class Invoice < ActiveRecord::Base
|
|||||||
# skip this issue if the issue customer is not the same as the invoice customer
|
# skip this issue if the issue customer is not the same as the invoice customer
|
||||||
return if issue.customer_id != invoice.customer_ref.value.to_i
|
return if issue.customer_id != invoice.customer_ref.value.to_i
|
||||||
|
|
||||||
logger.debug "Attaching invoice #{invoice.id} to issue #{issue.id}"
|
logger.info "Attaching invoice #{invoice.id} to issue #{issue.id}"
|
||||||
|
|
||||||
invoice = Invoice.find_or_create_by(id: invoice.id)
|
invoice = Invoice.find_or_create_by(id: invoice.id)
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ class Invoice < ActiveRecord::Base
|
|||||||
# this condions causes an infinite loop as the webhook is called when an invoice is updated
|
# this condions causes an infinite loop as the webhook is called when an invoice is updated
|
||||||
# TODO maybe add a cf_sync_confict flag to invoices
|
# TODO maybe add a cf_sync_confict flag to invoices
|
||||||
def self.compare_custom_fields(issue, invoice)
|
def self.compare_custom_fields(issue, invoice)
|
||||||
logger.debug "Comparing custom fields"
|
logger.info "Comparing custom fields"
|
||||||
# TODO break if Invoice.find(invoice.id).cf_sync_confict
|
# TODO break if Invoice.find(invoice.id).cf_sync_confict
|
||||||
is_changed = false
|
is_changed = false
|
||||||
|
|
||||||
@@ -120,12 +120,12 @@ class Invoice < ActiveRecord::Base
|
|||||||
# Only update if blank to prevent infite loops
|
# Only update if blank to prevent infite loops
|
||||||
# TODO check cf_sync_confict flag once implemented
|
# TODO check cf_sync_confict flag once implemented
|
||||||
if cf.string_value.to_s.blank?
|
if cf.string_value.to_s.blank?
|
||||||
logger.debug " VIN was blank, updating the invoice vin in quickbooks"
|
logger.info " VIN was blank, updating the invoice vin in quickbooks"
|
||||||
vin = Vehicle.find(issue.vehicles_id).vin
|
vin = Vehicle.find(issue.vehicles_id).vin
|
||||||
break if vin.nil?
|
break if vin.nil?
|
||||||
if not cf.string_value.to_s.eql? vin
|
if not cf.string_value.to_s.eql? vin
|
||||||
cf.string_value = vin.to_s
|
cf.string_value = vin.to_s
|
||||||
logger.debug "VIN has changed"
|
logger.info "VIN has changed"
|
||||||
is_changed = true
|
is_changed = true
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ class Invoice < ActiveRecord::Base
|
|||||||
|
|
||||||
# Push updates
|
# Push updates
|
||||||
begin
|
begin
|
||||||
logger.debug "Trying to update invoice"
|
logger.info "Trying to update invoice"
|
||||||
qbo = Qbo.first
|
qbo = Qbo.first
|
||||||
qbo.perform_authenticated_request do |access_token|
|
qbo.perform_authenticated_request do |access_token|
|
||||||
service = Quickbooks::Service::Invoice.new(:company_id => qbo.realm_id, :access_token => access_token)
|
service = Quickbooks::Service::Invoice.new(:company_id => qbo.realm_id, :access_token => access_token)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2023 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -9,7 +9,6 @@
|
|||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
class Qbo < ActiveRecord::Base
|
class Qbo < ActiveRecord::Base
|
||||||
unloadable
|
|
||||||
|
|
||||||
include QuickbooksOauth
|
include QuickbooksOauth
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2022 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -10,8 +10,6 @@
|
|||||||
|
|
||||||
class Vehicle < ActiveRecord::Base
|
class Vehicle < ActiveRecord::Base
|
||||||
|
|
||||||
unloadable
|
|
||||||
|
|
||||||
belongs_to :customer
|
belongs_to :customer
|
||||||
has_many :issues, :foreign_key => 'vehicles_id'
|
has_many :issues, :foreign_key => 'vehicles_id'
|
||||||
|
|
||||||
|
|||||||
11
app/views/customers/_actions.html.erb
Normal file
11
app/views/customers/_actions.html.erb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<%= link_to t(:label_appointment), "https://calendar.google.com/calendar/render?action=TEMPLATE&text=#{@customer.name}+-&details=#{ link_to "Customer Details", "https://#{Setting.host_name}#{customer_path @customer.id}"}%0A#{@customer.primary_phone}&dates=#{Time.now.strftime("%Y%m%d")}T090000/#{Time.now.strftime("%Y%m%d")}T170000", target: :_blank %>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<%= link_to t(:label_create_estimate), "https://qbo.intuit.com/app/estimate?nameId=#{@customer.id}", target: :_blank %>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<%= button_to t(:label_edit_customer), edit_customer_path(@customer), method: :get%>
|
||||||
@@ -1,5 +1,11 @@
|
|||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<th><%=t(:label_name)%></th>
|
||||||
|
<td><%= customer.name %></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th><%=t(:label_email)%></th>
|
<th><%=t(:label_email)%></th>
|
||||||
<td><%= customer.email %></td>
|
<td><%= customer.email %></td>
|
||||||
@@ -35,9 +41,6 @@
|
|||||||
<td><%= customer.notes %></td>
|
<td><%= customer.notes %></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div style="float: right;">
|
|
||||||
<%= button_to t(:label_edit_customer), edit_customer_path(customer), method: :get%>
|
|
||||||
</div>
|
|
||||||
<br/>
|
<br/>
|
||||||
<br/>
|
<br/>
|
||||||
|
|||||||
@@ -3,4 +3,3 @@
|
|||||||
<%= submit_tag t(:label_search) %>
|
<%= submit_tag t(:label_search) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= button_to t(:label_new_customer), new_customer_path, method: :get%>
|
<%= button_to t(:label_new_customer), new_customer_path, method: :get%>
|
||||||
<%= button_to(t(:label_sync), qbo_sync_path, method: :get) if User.current.admin?%>
|
|
||||||
|
|||||||
@@ -7,7 +7,22 @@
|
|||||||
|
|
||||||
<h4><%=t(:label_details)%>:</h4>
|
<h4><%=t(:label_details)%>:</h4>
|
||||||
|
|
||||||
<%= render :partial => 'customers/details', locals: {customer: @customer} %>
|
<!-- Customer Info -->
|
||||||
|
|
||||||
|
<div class="splitcontent">
|
||||||
|
<div class="splitcontentleft">
|
||||||
|
<h4><%=t(:label_customer)%>:</h4>
|
||||||
|
<%= render :partial => 'customers/details', locals: {customer: @customer} %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="splitcontentleft">
|
||||||
|
<h4><%=t(:label_actions)%>:</h4>
|
||||||
|
<%= render :partial => 'customers/actions', locals: {customer: @customer} %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- QBO Info -->
|
||||||
|
|
||||||
<div class="splitcontent">
|
<div class="splitcontent">
|
||||||
<div class="splitcontentleft">
|
<div class="splitcontentleft">
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<% if @customer.present? %>
|
<% if @customer.present? %>
|
||||||
|
|
||||||
<% @customer.estimates.order(doc_number: :desc).each do |estimate| %>
|
<% @customer.estimates.order(id: :desc).each do |estimate| %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<b><%= link_to "##{estimate.doc_number}", estimate_path(estimate), target: :_blank %></b> <%= estimate.txn_date %>
|
<b><%= link_to "##{estimate.doc_number}", estimate_path(estimate), target: :_blank %></b> <%= estimate.txn_date %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<% if @customer.present? %>
|
<% if @customer.present? %>
|
||||||
|
|
||||||
<% @customer.invoices.order(doc_number: :desc).each do |invoice| %>
|
<% @customer.invoices.order(id: :desc).each do |invoice| %>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<b><%= link_to "##{invoice.doc_number}", invoice_path(invoice), target: :_blank %></b> <%= invoice.txn_date %>
|
<b><%= link_to "##{invoice.doc_number}", invoice_path(invoice), target: :_blank %></b> <%= invoice.txn_date %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|||||||
|
|
||||||
<!-- configure the Intuit object: 'grantUrl' is a URL in your application which kicks off the flow, see below -->
|
<!-- configure the Intuit object: 'grantUrl' is a URL in your application which kicks off the flow, see below -->
|
||||||
<script>
|
<script>
|
||||||
intuit.ipp.anywhere.setup({menuProxy: '/path/to/blue-dot', grantUrl: '<%= Setting.host_name %>/qbo/authenticate'});
|
intuit.ipp.anywhere.setup({menuProxy: '/path/to/blue-dot', grantUrl: '<%= qbo_authenticate_path %>'});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<table >
|
<table >
|
||||||
|
|||||||
13
app/views/qbo/webhook.erb
Normal file
13
app/views/qbo/webhook.erb
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<!--
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2024 rick barrette
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<h2>QboController#webhook</h2>
|
||||||
@@ -88,4 +88,7 @@ en:
|
|||||||
label_qbo_sync_success: "Successfully synced to Quickbooks"
|
label_qbo_sync_success: "Successfully synced to Quickbooks"
|
||||||
label_hours: "Hours"
|
label_hours: "Hours"
|
||||||
label_oauth2_refresh_token_expires_at: "Refresh Token Expires At"
|
label_oauth2_refresh_token_expires_at: "Refresh Token Expires At"
|
||||||
|
label_name: "Name"
|
||||||
|
label_appointment: "Add Appointment"
|
||||||
|
label_actions: "Actions"
|
||||||
|
label_create_estimate: "Create Estimate"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2023 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -9,41 +9,46 @@
|
|||||||
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
class AddTxnDates < ActiveRecord::Migration[5.1]
|
class AddTxnDates < ActiveRecord::Migration[5.1]
|
||||||
|
|
||||||
def change
|
def change
|
||||||
add_column :qbo_invoices, :txn_date, :date
|
begin
|
||||||
add_column :qbo_estimates, :txn_date, :date
|
add_column :qbo_invoices, :txn_date, :date
|
||||||
|
add_column :qbo_estimates, :txn_date, :date
|
||||||
|
|
||||||
reversible do |direction|
|
reversible do |direction|
|
||||||
direction.up {
|
direction.up {
|
||||||
break unless Qbo.first
|
break unless Qbo.first
|
||||||
|
|
||||||
QboEstimate.reset_column_information
|
QboEstimate.reset_column_information
|
||||||
QboInvoice.reset_column_information
|
QboInvoice.reset_column_information
|
||||||
|
|
||||||
say "Sync Estimates"
|
say "Sync Estimates"
|
||||||
|
|
||||||
QboEstimate.sync
|
QboEstimate.sync
|
||||||
|
|
||||||
say "Sync Invoices"
|
say "Sync Invoices"
|
||||||
|
|
||||||
qbo = Qbo.first
|
qbo = Qbo.first
|
||||||
invoices = qbo.perform_authenticated_request do |access_token|
|
invoices = qbo.perform_authenticated_request do |access_token|
|
||||||
service = Quickbooks::Service::Invoice.new(:company_id => qbo.realm_id, :access_token => access_token)
|
service = Quickbooks::Service::Invoice.new(:company_id => qbo.realm_id, :access_token => access_token)
|
||||||
service.all
|
service.all
|
||||||
end
|
end
|
||||||
|
|
||||||
return unless invoices
|
return unless invoices
|
||||||
|
|
||||||
invoices.each { |invoice|
|
invoices.each { |invoice|
|
||||||
# Load the invoice into the database
|
# Load the invoice into the database
|
||||||
qbo_invoice = QboInvoice.find_or_create_by(id: invoice.id)
|
qbo_invoice = QboInvoice.find_or_create_by(id: invoice.id)
|
||||||
qbo_invoice.doc_number = invoice.doc_number
|
qbo_invoice.doc_number = invoice.doc_number
|
||||||
qbo_invoice.id = invoice.id
|
qbo_invoice.id = invoice.id
|
||||||
qbo_invoice.customer_id = invoice.customer_ref
|
qbo_invoice.customer_id = invoice.customer_ref
|
||||||
qbo_invoice.txn_date = invoice.txn_date
|
qbo_invoice.txn_date = invoice.txn_date
|
||||||
qbo_invoice.save!
|
qbo_invoice.save!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
end
|
||||||
|
rescue
|
||||||
|
logger.error "AddTxnDates Failed"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2022 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -10,19 +10,22 @@
|
|||||||
|
|
||||||
class UpdateVehiclesTrim < ActiveRecord::Migration[5.1]
|
class UpdateVehiclesTrim < ActiveRecord::Migration[5.1]
|
||||||
def change
|
def change
|
||||||
add_column :vehicles, :doors, :text
|
begin
|
||||||
add_column :vehicles, :trim, :text
|
add_column :vehicles, :doors, :text
|
||||||
|
add_column :vehicles, :trim, :text
|
||||||
|
|
||||||
reversible do |direction|
|
reversible do |direction|
|
||||||
direction.up {
|
direction.up {
|
||||||
|
|
||||||
# Update local vehicle database by forcing a save, look at before_save
|
|
||||||
vehicles = Vehicle.all
|
|
||||||
vehicles.each { |vehicle|
|
|
||||||
vehicle.save!
|
|
||||||
}
|
|
||||||
|
|
||||||
|
# Update local vehicle database by forcing a save, look at before_save
|
||||||
|
vehicles = Vehicle.all
|
||||||
|
vehicles.each { |vehicle|
|
||||||
|
vehicle.save!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
logger.error "Failed to update vehicles"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
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.5'
|
version '2.1.1'
|
||||||
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'
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2022 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -15,7 +15,6 @@ module AttachmentsControllerPatch
|
|||||||
def self.included(base)
|
def self.included(base)
|
||||||
|
|
||||||
base.class_eval do
|
base.class_eval do
|
||||||
unloadable # Send unloadable so it will not be unloaded in development
|
|
||||||
|
|
||||||
# check if login is globally required to access the application
|
# check if login is globally required to access the application
|
||||||
def check_if_login_required
|
def check_if_login_required
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2023 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -21,7 +21,6 @@ module IssuePatch
|
|||||||
|
|
||||||
# Same as typing in the class
|
# Same as typing in the class
|
||||||
base.class_eval do
|
base.class_eval do
|
||||||
unloadable # Send unloadable so it will not be unloaded in development
|
|
||||||
belongs_to :customer, primary_key: :id
|
belongs_to :customer, primary_key: :id
|
||||||
belongs_to :customer_token, primary_key: :id
|
belongs_to :customer_token, primary_key: :id
|
||||||
belongs_to :estimate, primary_key: :id
|
belongs_to :estimate, primary_key: :id
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2022 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -23,7 +23,6 @@ module IssuesControllerPatch
|
|||||||
def self.included(base)
|
def self.included(base)
|
||||||
|
|
||||||
base.class_eval do
|
base.class_eval do
|
||||||
unloadable # Send unloadable so it will not be unloaded in development
|
|
||||||
helper Helper
|
helper Helper
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2023 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -16,10 +16,8 @@ module PdfPatch
|
|||||||
def self.included(base)
|
def self.included(base)
|
||||||
base.send(:include, InstanceMethods)
|
base.send(:include, InstanceMethods)
|
||||||
base.class_eval do
|
base.class_eval do
|
||||||
unloadable # Send unloadable so it will not be unloaded in development
|
|
||||||
alias_method :issue_to_pdf, :issue_to_pdf_with_patch
|
alias_method :issue_to_pdf, :issue_to_pdf_with_patch
|
||||||
alias_method :issue_to_pdf_with_patch, :issue_to_pdf
|
alias_method :issue_to_pdf_with_patch, :issue_to_pdf
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2017 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -21,7 +21,6 @@ module ProjectPatch
|
|||||||
|
|
||||||
# Same as typing in the class
|
# Same as typing in the class
|
||||||
base.class_eval do
|
base.class_eval do
|
||||||
unloadable # Send unloadable so it will not be unloaded in development
|
|
||||||
belongs_to :customer, primary_key: :id
|
belongs_to :customer, primary_key: :id
|
||||||
belongs_to :vehicle, primary_key: :id
|
belongs_to :vehicle, primary_key: :id
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#The MIT License (MIT)
|
#The MIT License (MIT)
|
||||||
#
|
#
|
||||||
#Copyright (c) 2022 rick barrette
|
#Copyright (c) 2024 rick barrette
|
||||||
#
|
#
|
||||||
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
#Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
#
|
#
|
||||||
@@ -20,7 +20,6 @@ module UserPatch
|
|||||||
|
|
||||||
# Same as typing in the class
|
# Same as typing in the class
|
||||||
base.class_eval do
|
base.class_eval do
|
||||||
unloadable # Send unloadable so it will not be unloaded in development
|
|
||||||
belongs_to :employee, primary_key: :id
|
belongs_to :employee, primary_key: :id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user