@@ -1692,6 +1692,7 @@ public static function findContainer($itemtype, $type = 'tab', $subtype = '')
16921692
16931693 public static function findContainers ($ itemtype , $ type = 'tab ' , $ subtype = '' , $ itemId = '' )
16941694 {
1695+ /** @var DBmysql $DB */
16951696 global $ DB ;
16961697 $ ids = [];
16971698
@@ -1707,7 +1708,7 @@ public static function findContainers($itemtype, $type = 'tab', $subtype = '', $
17071708
17081709 $ entityRestriction = getEntitiesRestrictCriteria ('' , '' , $ glpiActiveEntities , true , true );
17091710
1710- if (empty ($ entityIds )) {
1711+ if (count ($ entityIds ) === 0 ) {
17111712 $ entityIds = [$ entityId ];
17121713 }
17131714 $ entityIdList = implode (", " , $ entityIds );
@@ -1731,7 +1732,7 @@ public static function findContainers($itemtype, $type = 'tab', $subtype = '', $
17311732 $ sql .= " AND type = ' $ type' " ;
17321733 }
17331734
1734- if (is_array ( $ entityRestriction ) && !empty ($ entityRestriction )) {
1735+ if (!empty ($ entityRestriction )) {
17351736 $ allowedEntities = [];
17361737 foreach ($ entityRestriction as $ restriction ) {
17371738 if (isset ($ restriction ['entities_id ' ]) && is_array ($ restriction ['entities_id ' ])) {
@@ -1750,7 +1751,7 @@ public static function findContainers($itemtype, $type = 'tab', $subtype = '', $
17501751 $ containerId = (int ) $ row ['id ' ];
17511752
17521753 //profiles restriction
1753- if (isset ($ _SESSION ['glpiactiveprofile ' ]['id ' ]) && $ _SESSION [ ' glpiactiveprofile ' ][ ' id ' ] !== null ) {
1754+ if (isset ($ _SESSION ['glpiactiveprofile ' ]['id ' ])) {
17541755 $ profileId = $ _SESSION ['glpiactiveprofile ' ]['id ' ];
17551756 $ right = PluginFieldsProfile::getRightOnContainer ($ profileId , $ containerId );
17561757 if ($ right < READ ) {
0 commit comments