admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Quintiq file version 2.0
#parent: #root
Method IsInClosure (
  Entitys userentities
) as Boolean
{
  Description: 'Return a boolean value depending if the entity owner ( entity ) is a descendant of any entities in argument'
  TextBody:
  [*
    // Return if ( this ) entity is a descendant of any of the userentities
    
    // Need this single entity structure in order to call Entity::GetAllParent( )
    entityInStructure := construct( Entitys );
    entityInStructure.Add( this );
    
    entityParents := Entity::GetAllParents( entityInStructure );
    
    foundParent := exists( entityParents,
                           Elements,
                           p,
                           p <> this
                           and exists( userentities,
                                       Elements, 
                                       e,
                                       e <> this 
                                       and e = p ) );
    
    return foundParent;
  *]
}