Sanitize datatable params [SCI-8007]

This commit is contained in:
sboursen-scinote 2023-03-10 11:13:00 +01:00
parent e9bdd218fa
commit ce3fbfe4eb

View file

@ -86,10 +86,7 @@ class ProtocolLinkedChildrenDatatable < CustomDatatable
def filter_child_records(records)
if params[:version].present?
version = params[:version]
records = records.joins('LEFT JOIN protocols protocol_parents ' \
'ON protocols.parent_id = protocol_parents.id ')
.where('protocol_parents.version_number = #{version}')
records = records.left_outer_joins(:parent).where(parent: { version_number: params[:version] })
end
records
end