mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2026-02-14 17:43:59 -05:00
added sync estimates by id
This commit is contained in:
@@ -15,18 +15,31 @@ 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
|
||||||
|
|
||||||
|
e = Estimate.find_by_doc_number(params[:search]) if params[:search]
|
||||||
|
e = Estimate.find_by_id(params[:id]) if params[:id]
|
||||||
|
|
||||||
# Force sync for estimate by doc number if not found
|
# Force sync for estimate by doc number if not found
|
||||||
if Estimate.find_by_doc_number(params[:search]).nil?
|
if e.nil? && params[:search]
|
||||||
begin
|
begin
|
||||||
Estimate.sync_by_doc_number(params[:search]) if params[:search]
|
Estimate.sync_by_doc_number(params[:search])
|
||||||
|
e = Estimate.find_by_doc_number(params[:search])
|
||||||
rescue
|
rescue
|
||||||
logger.info "Estimate.find_by_doc_number failed"
|
logger.info "Estimate.find_by_doc_number failed"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
estimate = Estimate.find_by_id(params[:id]) if params[:id]
|
# Force sync for estimate by id if not found
|
||||||
estimate = Estimate.find_by_doc_number(params[:search]) if params[:search]
|
if e.nil? && params[:id]
|
||||||
return estimate
|
begin
|
||||||
|
Estimate.sync_by_id(params[:id])
|
||||||
|
e = Estimate.find_by_id(params[:id])
|
||||||
|
rescue
|
||||||
|
logger.info "Estimate.find_by_id failed"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return e
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user