diff --git a/Admin/Install/db.json b/Admin/Install/db.json index 86e48a0..7c3f4a6 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -273,6 +273,11 @@ "type": "TINYINT(1)", "null": false }, + "equipmgmt_attr_type_repeatable": { + "name": "equipmgmt_attr_type_repeatable", + "type": "TINYINT(1)", + "null": false + }, "equipmgmt_attr_type_required": { "description": "Every equipment must have this attribute type if set to true.", "name": "equipmgmt_attr_type_required", diff --git a/Controller/ApiEquipmentAttributeController.php b/Controller/ApiEquipmentAttributeController.php index c830435..1ce43f4 100755 --- a/Controller/ApiEquipmentAttributeController.php +++ b/Controller/ApiEquipmentAttributeController.php @@ -61,7 +61,23 @@ final class ApiEquipmentAttributeController extends Controller return; } - $type = EquipmentAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute(); + $type = EquipmentAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute(); + + if (!$type->repeatable) { + $attr = EquipmentAttributeMapper::count() + ->with('type') + ->where('type/id', (int) $request->getData('type')) + ->where('ref', (int) $request->getData('ref')) + ->execute(); + + if ($attr > 0) { + $response->header->status = RequestStatusCode::R_409; + $this->createInvalidCreateResponse($request, $response, $val); + + return; + } + } + $attribute = $this->createAttributeFromRequest($request, $type); $this->createModel($request->header->account, $attribute, EquipmentAttributeMapper::class, 'attribute', $request->getOrigin()); $this->createStandardCreateResponse($request, $response, $attribute); diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 7bae04b..b2b7551 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -156,12 +156,10 @@ final class BackendController extends Controller $view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008402001, $request, $response); /** @var \Model\Setting $settings */ - $settings = $this->app->appSettings->get(null, [ - SettingsEnum::DEFAULT_LOCALIZATION, - ]); + $settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_LOCALIZATION); $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response); - $view->data['attributeView']->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute(); + $view->data['attributeView']->data['default_localization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute(); $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response); $view->data['equipment-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response); @@ -252,12 +250,10 @@ final class BackendController extends Controller $view->data['units'] = $units; /** @var \Model\Setting $settings */ - $settings = $this->app->appSettings->get(null, [ - SettingsEnum::DEFAULT_LOCALIZATION, - ]); + $settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_LOCALIZATION); $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response); - $view->data['attributeView']->data['defaultlocalization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute(); + $view->data['attributeView']->data['default_localization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute(); $view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response); $view->data['equipment-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response); diff --git a/Models/Attribute/EquipmentAttributeTypeMapper.php b/Models/Attribute/EquipmentAttributeTypeMapper.php index 71c6063..0bcb99f 100755 --- a/Models/Attribute/EquipmentAttributeTypeMapper.php +++ b/Models/Attribute/EquipmentAttributeTypeMapper.php @@ -42,6 +42,7 @@ final class EquipmentAttributeTypeMapper extends DataMapperFactory 'equipmgmt_attr_type_datatype' => ['name' => 'equipmgmt_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'], 'equipmgmt_attr_type_fields' => ['name' => 'equipmgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'], 'equipmgmt_attr_type_custom' => ['name' => 'equipmgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'], + 'equipmgmt_attr_type_repeatable' => ['name' => 'equipmgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'], 'equipmgmt_attr_type_pattern' => ['name' => 'equipmgmt_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'], 'equipmgmt_attr_type_required' => ['name' => 'equipmgmt_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'], ]; diff --git a/Models/Attribute/EquipmentAttributeValueMapper.php b/Models/Attribute/EquipmentAttributeValueMapper.php index e7e68f6..da2243a 100755 --- a/Models/Attribute/EquipmentAttributeValueMapper.php +++ b/Models/Attribute/EquipmentAttributeValueMapper.php @@ -59,6 +59,7 @@ final class EquipmentAttributeValueMapper extends DataMapperFactory 'mapper' => EquipmentAttributeValueL11nMapper::class, 'table' => 'equipmgmt_attr_value_l11n', 'self' => 'equipmgmt_attr_value_l11n_value', + 'column' => 'content', 'external' => null, ], ]; diff --git a/Theme/Backend/Lang/ar.lang.php b/Theme/Backend/Lang/ar.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/ar.lang.php +++ b/Theme/Backend/Lang/ar.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/cs.lang.php b/Theme/Backend/Lang/cs.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/cs.lang.php +++ b/Theme/Backend/Lang/cs.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/da.lang.php b/Theme/Backend/Lang/da.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/da.lang.php +++ b/Theme/Backend/Lang/da.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index 38abe4d..06eb1ca 100755 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -24,7 +24,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => 'Ein', 'End' => 'Ende', - 'Equipment' => 'Equipment', 'Equipments' => 'Equipment', 'Files' => 'Dateien', 'History' => 'Historie', diff --git a/Theme/Backend/Lang/el.lang.php b/Theme/Backend/Lang/el.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/el.lang.php +++ b/Theme/Backend/Lang/el.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 401a95e..d99a0c8 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -24,7 +24,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => 'Ein', 'End' => 'End', - 'Equipment' => 'Equipment', 'Equipments' => 'Equipments', 'Files' => 'Files', 'History' => 'History', diff --git a/Theme/Backend/Lang/es.lang.php b/Theme/Backend/Lang/es.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/es.lang.php +++ b/Theme/Backend/Lang/es.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/fi.lang.php b/Theme/Backend/Lang/fi.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/fi.lang.php +++ b/Theme/Backend/Lang/fi.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/fr.lang.php b/Theme/Backend/Lang/fr.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/fr.lang.php +++ b/Theme/Backend/Lang/fr.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/hu.lang.php b/Theme/Backend/Lang/hu.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/hu.lang.php +++ b/Theme/Backend/Lang/hu.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/it.lang.php b/Theme/Backend/Lang/it.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/it.lang.php +++ b/Theme/Backend/Lang/it.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/ja.lang.php b/Theme/Backend/Lang/ja.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/ja.lang.php +++ b/Theme/Backend/Lang/ja.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/ko.lang.php b/Theme/Backend/Lang/ko.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/ko.lang.php +++ b/Theme/Backend/Lang/ko.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/no.lang.php b/Theme/Backend/Lang/no.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/no.lang.php +++ b/Theme/Backend/Lang/no.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/pl.lang.php b/Theme/Backend/Lang/pl.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/pl.lang.php +++ b/Theme/Backend/Lang/pl.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/pt.lang.php b/Theme/Backend/Lang/pt.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/pt.lang.php +++ b/Theme/Backend/Lang/pt.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/ru.lang.php b/Theme/Backend/Lang/ru.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/ru.lang.php +++ b/Theme/Backend/Lang/ru.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/sv.lang.php b/Theme/Backend/Lang/sv.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/sv.lang.php +++ b/Theme/Backend/Lang/sv.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/th.lang.php b/Theme/Backend/Lang/th.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/th.lang.php +++ b/Theme/Backend/Lang/th.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/tr.lang.php b/Theme/Backend/Lang/tr.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/tr.lang.php +++ b/Theme/Backend/Lang/tr.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/uk.lang.php b/Theme/Backend/Lang/uk.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/uk.lang.php +++ b/Theme/Backend/Lang/uk.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '', diff --git a/Theme/Backend/Lang/zh.lang.php b/Theme/Backend/Lang/zh.lang.php index 4edcf77..8b2a9c5 100755 --- a/Theme/Backend/Lang/zh.lang.php +++ b/Theme/Backend/Lang/zh.lang.php @@ -13,10 +13,6 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => '', - ':status2' => '', - ':status3' => '', - ':status4' => '', 'Attributes' => '', 'Costs' => '', 'Date' => '', @@ -24,7 +20,6 @@ return ['EquipmentManagement' => [ 'EIN' => '', 'Ein' => '', 'End' => '', - 'Equipment' => '', 'Equipments' => '', 'Files' => '', 'History' => '',