[Fix #2562] Make dossier filters case insensitive
This commit is contained in:
parent
72f23719e1
commit
a94397a70c
1 changed files with 5 additions and 5 deletions
|
@ -221,19 +221,19 @@ module NewGestionnaire
|
||||||
current_filters.map do |filter|
|
current_filters.map do |filter|
|
||||||
case filter['table']
|
case filter['table']
|
||||||
when 'self'
|
when 'self'
|
||||||
dossiers.where("? LIKE ?", filter['column'], "%#{filter['value']}%")
|
dossiers.where("? ILIKE ?", filter['column'], "%#{filter['value']}%")
|
||||||
|
|
||||||
when 'france_connect_information'
|
when 'france_connect_information'
|
||||||
dossiers
|
dossiers
|
||||||
.includes(user: :france_connect_information)
|
.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'
|
when 'type_de_champ', 'type_de_champ_private'
|
||||||
relation = filter['table'] == 'type_de_champ' ? :champs : :champs_private
|
relation = filter['table'] == 'type_de_champ' ? :champs : :champs_private
|
||||||
dossiers
|
dossiers
|
||||||
.includes(relation)
|
.includes(relation)
|
||||||
.where("champs.type_de_champ_id = ?", filter['column'].to_i)
|
.where("champs.type_de_champ_id = ?", filter['column'].to_i)
|
||||||
.where("champs.value LIKE ?", "%#{filter['value']}%")
|
.where("champs.value ILIKE ?", "%#{filter['value']}%")
|
||||||
when 'entreprise'
|
when 'entreprise'
|
||||||
table = 'etablissement'
|
table = 'etablissement'
|
||||||
if filter['column'] == 'date_creation'
|
if filter['column'] == 'date_creation'
|
||||||
|
@ -244,12 +244,12 @@ module NewGestionnaire
|
||||||
else
|
else
|
||||||
dossiers
|
dossiers
|
||||||
.includes(table)
|
.includes(table)
|
||||||
.where("#{table.pluralize}.entreprise_#{filter['column']} LIKE ?", "%#{filter['value']}%")
|
.where("#{table.pluralize}.entreprise_#{filter['column']} ILIKE ?", "%#{filter['value']}%")
|
||||||
end
|
end
|
||||||
when 'user', 'etablissement'
|
when 'user', 'etablissement'
|
||||||
dossiers
|
dossiers
|
||||||
.includes(filter['table'])
|
.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.pluck(:id)
|
||||||
end.reduce(:&)
|
end.reduce(:&)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue