From a94397a70c38cd7db69b2fb91070794a96b33159 Mon Sep 17 00:00:00 2001 From: Frederic Merizen Date: Thu, 13 Sep 2018 10:21:45 +0200 Subject: [PATCH] [Fix #2562] Make dossier filters case insensitive --- .../new_gestionnaire/procedures_controller.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/controllers/new_gestionnaire/procedures_controller.rb b/app/controllers/new_gestionnaire/procedures_controller.rb index 968c04e3b..8078a9947 100644 --- a/app/controllers/new_gestionnaire/procedures_controller.rb +++ b/app/controllers/new_gestionnaire/procedures_controller.rb @@ -221,19 +221,19 @@ module NewGestionnaire current_filters.map do |filter| case filter['table'] when 'self' - dossiers.where("? LIKE ?", filter['column'], "%#{filter['value']}%") + dossiers.where("? ILIKE ?", filter['column'], "%#{filter['value']}%") when 'france_connect_information' dossiers .includes(user: :france_connect_information) - .where("? LIKE ?", "france_connect_informations.#{filter['column']}", "%#{filter['value']}%") + .where("? ILIKE ?", "france_connect_informations.#{filter['column']}", "%#{filter['value']}%") when 'type_de_champ', 'type_de_champ_private' relation = filter['table'] == 'type_de_champ' ? :champs : :champs_private dossiers .includes(relation) .where("champs.type_de_champ_id = ?", filter['column'].to_i) - .where("champs.value LIKE ?", "%#{filter['value']}%") + .where("champs.value ILIKE ?", "%#{filter['value']}%") when 'entreprise' table = 'etablissement' if filter['column'] == 'date_creation' @@ -244,12 +244,12 @@ module NewGestionnaire else dossiers .includes(table) - .where("#{table.pluralize}.entreprise_#{filter['column']} LIKE ?", "%#{filter['value']}%") + .where("#{table.pluralize}.entreprise_#{filter['column']} ILIKE ?", "%#{filter['value']}%") end when 'user', 'etablissement' dossiers .includes(filter['table']) - .where("#{filter['table'].pluralize}.#{filter['column']} LIKE ?", "%#{filter['value']}%") + .where("#{filter['table'].pluralize}.#{filter['column']} ILIKE ?", "%#{filter['value']}%") end.pluck(:id) end.reduce(:&) end