bug fixes and permission tests

This commit is contained in:
Dennis Eichhorn 2022-01-22 21:56:01 +01:00
parent 90115162de
commit 9fd6d3d3a1
4 changed files with 6 additions and 6 deletions

View File

@ -145,8 +145,8 @@ class Department implements \JsonSerializable, ArrayableInterface
'status' => $this->status, 'status' => $this->status,
'description' => $this->description, 'description' => $this->description,
'descriptionRaw' => $this->descriptionRaw, 'descriptionRaw' => $this->descriptionRaw,
'unit' => $this->unit ?? new NullUnit(), 'unit' => $this->unit,
'parent' => $this->parent ?? new NullDepartment(), 'parent' => $this->parent ?? null,
]; ];
} }

View File

@ -143,7 +143,7 @@ class Position implements \JsonSerializable, ArrayableInterface
'description' => $this->description, 'description' => $this->description,
'descriptionRaw' => $this->descriptionRaw, 'descriptionRaw' => $this->descriptionRaw,
'department' => $this->department ?? new NullDepartment(), 'department' => $this->department ?? new NullDepartment(),
'parent' => $this->parent ?? new NullPosition(), 'parent' => $this->parent ?? null,
]; ];
} }

View File

@ -144,7 +144,7 @@ class Unit implements \JsonSerializable, ArrayableInterface
'status' => $this->status, 'status' => $this->status,
'description' => $this->description, 'description' => $this->description,
'descriptionRaw' => $this->descriptionRaw, 'descriptionRaw' => $this->descriptionRaw,
'parent' => $this->parent, 'parent' => $this->parent ?? null,
'image' => $this->image, 'image' => $this->image,
]; ];
} }

View File

@ -87,8 +87,8 @@ $unitRoot = $unitTree[null][0]['children'];
do { do {
++$toCloseDep; ++$toCloseDep;
$parentDep = $parentDep->parent; $parentDep = $parentDep->parent ?? null;
$parentDepId = $parentDep->getId(); $parentDepId = $parentDep?->getId() ?? 0;
} while ($parentDepId !== 0 } while ($parentDepId !== 0
&& !isset($depTree[$unitId][$parentDepId]['children'][($depTree[$unitId][$parentDepId]['index'] ?? 0) + 1]) && !isset($depTree[$unitId][$parentDepId]['children'][($depTree[$unitId][$parentDepId]['index'] ?? 0) + 1])
); );