Announcement

Collapse
No announcement yet.

Multiple Assigned Users and Assigned User : OnlyMy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple Assigned Users and Assigned User : OnlyMy

    Hi,
    As next release will have : Multiple assigned users enabled with parameter in entity manager #3158

    There are something i don't understand and it's just for understand.

    What happend if we use assignedUser and assignedUsers
    If i look this file (maybe wrong file) .. i see the "return" in the if statement "$this->fieldHelper->hasAssignedUsersField()", so never go in the if statement of assignedUser

    Maybe is preferable to remove the "return" ?
    What do you think ? i am wrong or ?

    Best Regards

    application/Espo/Core/Select/Bool/Filters/OnlyMy.php
    PHP Code:

            
    if ($this->fieldHelper->hasAssignedUsersField()) {
                
    $relationDefs $this->defs
                    
    ->getEntity($this->entityType)
                    ->
    getRelation('assignedUsers');

                
    $middleEntityType ucfirst($relationDefs->getRelationshipName());
                
    $key1 $relationDefs->getMidKey();
                
    $key2 $relationDefs->getForeignMidKey();

                
    $subQuery QueryBuilder::create()
                    ->
    select('id')
                    ->
    from($this->entityType)
                    ->
    leftJoin($middleEntityType'assignedUsersMiddle', [
                        
    "assignedUsersMiddle.$key1:" => 'id',
                        
    'assignedUsersMiddle.deleted' => false,
                    ])
                    ->
    where(["assignedUsersMiddle.$key2=> $this->user->getId()])
                    ->
    build();

                
    $orGroupBuilder->add(
                    
    Cond::in(
                        
    Cond::column('id'),
                        
    $subQuery
                    
    )
                );

                return; 
    // <-- maybe remove "return" ?
            
    }

            if (
    $this->fieldHelper->hasAssignedUserField()) {
                
    $orGroupBuilder->add(
                    
    Cond::equal(
                        
    Cond::column('assignedUserId'),
                        
    $this->user->getId()
                    )
                );

                return;
            }
    ​ 

  • #2
    Hi,

    Assigned Users were not compatible with Assigned User. If users is enabled, the user is bypassed. It would not be just to remove return.

    You can always define own custom bool and ACL filters.
    Last edited by yuri; 09-30-2024, 07:43 PM.

    Comment


    • item
      item commented
      Editing a comment
      Thank Yuri for clarification.
      I will create my own filter.
Working...
X