continue implementations

This commit is contained in:
Dennis Eichhorn 2024-01-12 00:30:21 +00:00
parent 2d5608e41f
commit be2cc5380e
25 changed files with 32 additions and 94 deletions

View File

@ -258,6 +258,11 @@
"type": "TINYINT(1)",
"null": false
},
"investmgmt_attr_type_repeatable": {
"name": "investmgmt_attr_type_repeatable",
"type": "TINYINT(1)",
"null": false
},
"investmgmt_attr_type_required": {
"description": "Every item must have this attribute type if set to true.",
"name": "investmgmt_attr_type_required",

View File

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

View File

@ -96,12 +96,10 @@ final class BackendController extends Controller
$view->data['object'] = $object;
/** @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);
@ -129,11 +127,11 @@ final class BackendController extends Controller
$investment = InvestmentMapper::get()
->with('notes')
->with('files')
->with('supplier')
->with('supplier/account')
->with('item')
->with('createdBy')
->with('options')
->with('options/supplier')
->with('options/supplier/account')
->with('options/item')
->with('options/files')
->with('options/notes')
->with('options/amountGroups')
@ -144,18 +142,16 @@ final class BackendController extends Controller
->with('options/attributes/type/l11n')
->with('options/attributes/value')
->where('id', (int) $request->getData('id'))
->where('options/attributes/type/l11n/language', $response->header->l11n->language)
//->where('options/attributes/type/l11n/language', $response->header->l11n->language)
->execute();
$view->data['investment'] = $investment;
/** @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();
$investmentTypes = InvestmentTypeMapper::getAll()
->with('l11n')

View File

@ -42,6 +42,7 @@ final class InvestmentObjectAttributeTypeMapper extends DataMapperFactory
'investmgmt_attr_type_datatype' => ['name' => 'investmgmt_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
'investmgmt_attr_type_fields' => ['name' => 'investmgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
'investmgmt_attr_type_custom' => ['name' => 'investmgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
'investmgmt_attr_type_repeatable' => ['name' => 'investmgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
'investmgmt_attr_type_pattern' => ['name' => 'investmgmt_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
'investmgmt_attr_type_required' => ['name' => 'investmgmt_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
];

View File

@ -97,7 +97,7 @@ final class InvestmentObjectMapper extends DataMapperFactory
'attributes' => [
'mapper' => InvestmentObjectAttributeMapper::class,
'table' => 'investmgmt_option_attr',
'self' => 'investmgmt_option_attr_item',
'self' => 'investmgmt_option_attr_type',
'external' => null,
],
];

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',

View File

@ -13,10 +13,6 @@
declare(strict_types=1);
return ['InvestmentManagement' => [
':status1' => '',
':status2' => '',
':status3' => '',
':status4' => '',
'Creator' => '',
'Investment' => '',
'Investments' => '',