Only return child elements when Process.load_children is set
https://redmine.teklia.com/issues/11567
The Process.list_elements method needs to be updated:
- When
load_childrenis not set, keep the existing behavior; - When the process runs on the whole corpus without
self.elementorself.elements, keep the existing behavior; - When the process runs with
self.elementorself.elementsset andload_childrenis set todirect, only return the direct children, and do not includeself.elementorself.elements; - When the process runs with
self.elementorself.elementsset andload_childrenis set toall, only return the children recursively, and do not includeself.elementorself.elements.
Returning only the children, without duplicating them, might get us into the same trouble as in #769, so ListProcessElements needs to be tested carefully. While CTEs and UNION ALL might no longer be needed with this change, CTEs might still be useful to avoid this issue.