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,
'description' => $this->description,
'descriptionRaw' => $this->descriptionRaw,
'unit' => $this->unit ?? new NullUnit(),
'parent' => $this->parent ?? new NullDepartment(),
'unit' => $this->unit,
'parent' => $this->parent ?? null,
];
}

View File

@ -143,7 +143,7 @@ class Position implements \JsonSerializable, ArrayableInterface
'description' => $this->description,
'descriptionRaw' => $this->descriptionRaw,
'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,
'description' => $this->description,
'descriptionRaw' => $this->descriptionRaw,
'parent' => $this->parent,
'parent' => $this->parent ?? null,
'image' => $this->image,
];
}

View File

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