[Fix #2613] Filter by date creation entreprise
This commit is contained in:
parent
f4b95d3f40
commit
26ece1d144
2 changed files with 35 additions and 6 deletions
|
@ -79,19 +79,19 @@ class DossierFieldService
|
|||
.includes(relation)
|
||||
.where("champs.type_de_champ_id = ?", filter['column'].to_i)
|
||||
.where("champs.value ILIKE ?", "%#{filter['value']}%")
|
||||
when 'entreprise'
|
||||
table = 'etablissement'
|
||||
if filter['column'] == 'date_creation'
|
||||
when 'etablissement'
|
||||
table = filter['table']
|
||||
if filter['column'] == 'entreprise_date_creation'
|
||||
date = filter['value'].to_date rescue nil
|
||||
dossiers
|
||||
.includes(table)
|
||||
.where("#{table.pluralize}.entreprise_#{filter['column']} = ?", date)
|
||||
.where("#{table.pluralize}.#{filter['column']} = ?", date)
|
||||
else
|
||||
dossiers
|
||||
.includes(table)
|
||||
.where("#{table.pluralize}.entreprise_#{filter['column']} ILIKE ?", "%#{filter['value']}%")
|
||||
.where("#{table.pluralize}.#{filter['column']} ILIKE ?", "%#{filter['value']}%")
|
||||
end
|
||||
when 'user', 'etablissement'
|
||||
when 'user'
|
||||
dossiers
|
||||
.includes(filter['table'])
|
||||
.where("#{filter['table'].pluralize}.#{filter['column']} ILIKE ?", "%#{filter['value']}%")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue