mirror of
https://github.com/rickbarrette/redmine_qbo.git
synced 2025-11-09 01:14:23 -05:00
Update customer.rb
This commit is contained in:
@@ -153,19 +153,9 @@ class Customer < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Searchs the database for a customer by name
|
# Searchs the database for a customer by name or phone number with out special chars
|
||||||
def self.search(search)
|
def self.search(search)
|
||||||
customers = where("name LIKE ?", "%#{search}%")
|
customers = where("name LIKE ? OR phone_number LIKE ?", "%#{search}%", "%#{search}%")
|
||||||
|
|
||||||
#if customers.empty?
|
|
||||||
# service = Qbo.get_base(:customer).service
|
|
||||||
# results = service.query("Select Id From Customer Where PrimaryPhone LIKE '%#{search}%' AND Mobile LIKE '%#{search}%'")
|
|
||||||
|
|
||||||
# results.each do |customer|
|
|
||||||
# customers << Customer.find_by_id(customer.id)
|
|
||||||
# end
|
|
||||||
#end
|
|
||||||
|
|
||||||
return customers.order(:name)
|
return customers.order(:name)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user