continue implementations

This commit is contained in:
Dennis Eichhorn 2024-01-12 00:30:03 +00:00
parent 74541d765d
commit f8afe183e1
6 changed files with 26 additions and 6 deletions

View File

@ -147,6 +147,11 @@
"type": "TINYINT(1)",
"null": false
},
"assetmgmt_attr_type_repeatable": {
"name": "assetmgmt_attr_type_repeatable",
"type": "TINYINT(1)",
"null": false
},
"assetmgmt_attr_type_required": {
"description": "Every asset must have this attribute type if set to true.",
"name": "assetmgmt_attr_type_required",

View File

@ -61,7 +61,23 @@ final class ApiAssetAttributeController extends Controller
return;
}
$type = AssetAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute();
$type = AssetAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute();
if (!$type->repeatable) {
$attr = AssetAttributeMapper::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, AssetAttributeMapper::class, 'attribute', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $attribute);

View File

@ -175,12 +175,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['asset-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);

View File

@ -42,6 +42,7 @@ final class AssetAttributeTypeMapper extends DataMapperFactory
'assetmgmt_attr_type_datatype' => ['name' => 'assetmgmt_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
'assetmgmt_attr_type_fields' => ['name' => 'assetmgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
'assetmgmt_attr_type_custom' => ['name' => 'assetmgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
'assetmgmt_attr_type_repeatable' => ['name' => 'assetmgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
'assetmgmt_attr_type_pattern' => ['name' => 'assetmgmt_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
'assetmgmt_attr_type_required' => ['name' => 'assetmgmt_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
];

View File

@ -59,6 +59,7 @@ final class AssetAttributeValueMapper extends DataMapperFactory
'mapper' => AssetAttributeValueL11nMapper::class,
'table' => 'assetmgmt_attr_value_l11n',
'self' => 'assetmgmt_attr_value_l11n_value',
'column' => 'content',
'external' => null,
],
];

View File

@ -16,7 +16,6 @@ return ['AssetManagement' => [
'Assets' => 'Assets',
'Status' => 'Status',
'Name' => 'Name',
'Number' => 'Number',
'Type' => 'Type',
':status1' => 'Active',
':status2' => 'Inactive',