diff --git a/Admin/Installer.php b/Admin/Installer.php index 6263688..b38dd53 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -90,7 +90,7 @@ final class Installer extends InstallerAbstract $request->setData('title', \reset($attribute['l11n'])); $request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en'); $request->setData('is_required', $attribute['is_required'] ?? false); - $request->setData('is_custom_allowed', $attribute['is_custom_allowed'] ?? false); + $request->setData('custom', $attribute['is_custom_allowed'] ?? false); $request->setData('validation_pattern', $attribute['validation_pattern'] ?? ''); $request->setData('datatype', (int) $attribute['value_type']); diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 9799948..188d3fd 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -223,7 +223,7 @@ final class ApiController extends Controller /** @var \Modules\Admin\Models\Group $group */ $group = $internalResponse->get($newRequest->uri->__toString())['response']; - $content = \json_encode([$group->getId()]); + $content = \json_encode([$group->id]); if ($content === false) { $content = '[]'; } @@ -232,7 +232,7 @@ final class ApiController extends Controller 0, ModelsSettingsEnum::UNIT_DEFAULT_GROUPS, $content, - unit: $unit->getId(), + unit: $unit->id, module: 'Admin' ); $this->createModel($request->header->account, $setting, SettingMapper::class, 'setting', $request->getOrigin()); @@ -267,7 +267,7 @@ final class ApiController extends Controller $unit = UnitMapper::get()->with('mainAddress')->where('id', $request->getData('unit'))->execute(); $oldUnit = clone $unit; - if ($unit->mainAddress->getId() !== 0) { + if ($unit->mainAddress->id !== 0) { $oldAddr = clone $unit->mainAddress; $addr = $this->updateUnitMainAddressFromRequest($request, $unit); $this->updateModel($request->header->account, $oldAddr, $addr, AddressMapper::class, 'address', $request->getOrigin()); @@ -276,7 +276,7 @@ final class ApiController extends Controller $addr = $this->createUnitMainAddressFromRequest($request); $this->createModel($request->header->account, $addr, AddressMapper::class, 'address', $request->getOrigin()); - $unit->mainAddress = new NullAddress($addr->getId()); + $unit->mainAddress = new NullAddress($addr->id); $this->updateModel($request->header->account, $oldUnit, $unit, UnitMapper::class, 'unit', $request->getOrigin()); } @@ -1109,7 +1109,7 @@ final class ApiController extends Controller $this->createModelRelation( $request->header->account, (int) $request->getData('type'), - $attrValue->getId(), + $attrValue->id, UnitAttributeTypeMapper::class, 'defaults', '', $request->getOrigin() ); } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 9c47870..efd7677 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -163,36 +163,17 @@ final class BackendController extends Controller { $tree = []; foreach ($components as $component) { - $ref = null; + $ref = 0; if ($component instanceof Department) { - $ref = $component->unit->getId(); + $ref = $component->unit->id; } elseif ($component instanceof Position) { - $ref = $component->department->getId(); + $ref = $component->department->id; } - if (!isset($tree[$ref])) { - $tree[$ref] = []; - } - - if (!isset($tree[$ref][$component->getId()])) { - $tree[$ref][$component->getId()] = ['obj' => null, 'children' => [], 'index' => 0]; - } - - $tree[$ref][$component->getId()]['obj'] = $component; - - $parent = $component->parent->getId(); - if ($parent !== 0 - && (!($component instanceof Position) // parent could be in different department then ignore - || $component->parent->department->getId() === $component->department->getId() - ) - ) { - if (!isset($tree[$ref][$parent])) { - $tree[$ref][$parent] = ['obj' => null, 'children' => [], 'index' => 0]; - } - - /** @phpstan-ignore-next-line */ - $tree[$ref][$parent]['children'][] = &$tree[$ref][$component->getId()]; - } + $tree[$component->id] = [ + 'obj' => $component, + 'ref' => $ref + ]; } return $tree; diff --git a/Models/Department.php b/Models/Department.php index 5aa6913..2105f2d 100755 --- a/Models/Department.php +++ b/Models/Department.php @@ -30,7 +30,7 @@ class Department implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Name. @@ -54,7 +54,7 @@ class Department implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $status = Status::INACTIVE; + public int $status = Status::INACTIVE; /** * Unit this department belongs to diff --git a/Models/Position.php b/Models/Position.php index da75aaa..776aa53 100755 --- a/Models/Position.php +++ b/Models/Position.php @@ -30,7 +30,7 @@ class Position implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Name. @@ -78,7 +78,7 @@ class Position implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $status = Status::INACTIVE; + public int $status = Status::INACTIVE; /** * Constructor. diff --git a/Models/Unit.php b/Models/Unit.php index 27c0e73..883a170 100755 --- a/Models/Unit.php +++ b/Models/Unit.php @@ -35,7 +35,7 @@ class Unit implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $id = 0; + public int $id = 0; /** * Name. @@ -83,7 +83,7 @@ class Unit implements \JsonSerializable * @var int * @since 1.0.0 */ - protected int $status = Status::INACTIVE; + public int $status = Status::INACTIVE; public Address $mainAddress; diff --git a/Theme/Backend/Components/DepartmentTagSelector/DepartmentTagSelectorView.php b/Theme/Backend/Components/DepartmentTagSelector/DepartmentTagSelectorView.php index 201315c..6e2d4c7 100755 --- a/Theme/Backend/Components/DepartmentTagSelector/DepartmentTagSelectorView.php +++ b/Theme/Backend/Components/DepartmentTagSelector/DepartmentTagSelectorView.php @@ -52,7 +52,7 @@ class DepartmentTagSelectorView extends View * @var bool * @since 1.0.0 */ - private bool $isRequired = false; + public bool $isRequired = false; /** * {@inheritdoc} diff --git a/Theme/Backend/Components/DepartmentTagSelector/department-selector.tpl.php b/Theme/Backend/Components/DepartmentTagSelector/department-selector.tpl.php index 8d734f6..60f45b6 100755 --- a/Theme/Backend/Components/DepartmentTagSelector/department-selector.tpl.php +++ b/Theme/Backend/Components/DepartmentTagSelector/department-selector.tpl.php @@ -1,10 +1,10 @@
- -
- + -