1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(bug) product search accent letter

This commit is contained in:
Du Peng 2022-10-20 15:09:12 +02:00
parent de960cf00c
commit b2ddc48d51

View File

@ -150,8 +150,8 @@ class ProductService
def filter_by_keyword_or_reference(products, filters)
return products if filters[:keywords].blank?
products.where('sku = :sku OR name ILIKE :query OR description ILIKE :query',
{ sku: filters[:keywords], query: "%#{filters[:keywords]}%" })
products.where('sku = :sku OR lower(f_unaccent(name)) ILIKE :query OR lower(f_unaccent(description)) ILIKE :query',
{ sku: (filters[:keywords]), query: "%#{I18n.transliterate(filters[:keywords])}%" })
end
def filter_by_stock(products, filters, operator)