auto fixes + some impl.

This commit is contained in:
Dennis Eichhorn 2024-01-26 22:53:59 +00:00
parent be2cc5380e
commit da200dacf6
26 changed files with 203 additions and 188 deletions

View File

@ -263,6 +263,11 @@
"type": "TINYINT(1)",
"null": false
},
"investmgmt_attr_type_internal": {
"name": "investmgmt_attr_type_internal",
"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

@ -20,7 +20,6 @@ use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Module\InstallerAbstract;
use phpOMS\Module\ModuleInfo;
use phpOMS\Uri\HttpUri;
/**
* Installer class.
@ -79,7 +78,7 @@ final class Installer extends InstallerAbstract
/** @var array $type */
foreach ($types as $type) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('name', $type['name'] ?? '');
@ -105,7 +104,7 @@ final class Installer extends InstallerAbstract
}
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('title', $l11n);

View File

@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/finance/investment/find.*$' => [
'^.*/finance/investment/find(\?.*$|$)' => [
[
'dest' => '\Modules\InvestmentManagement\Controller\ApiController:apiInvestmentFind',
'verb' => RouteVerb::GET,

View File

@ -6,7 +6,7 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/finance/investment/list.*$' => [
'^.*/finance/investment/list(\?.*$|$)' => [
[
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentList',
'verb' => RouteVerb::GET,
@ -17,9 +17,9 @@ return [
],
],
],
'^.*/finance/investment/profile.*$' => [
'^.*/finance/investment/view(\?.*$|$)' => [
[
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentProfile',
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentView',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::MODULE_NAME,
@ -28,7 +28,7 @@ return [
],
],
],
'^.*/finance/investment/create.*$' => [
'^.*/finance/investment/create(\?.*$|$)' => [
[
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentCreate',
'verb' => RouteVerb::GET,
@ -39,9 +39,9 @@ return [
],
],
],
'^.*/finance/investment/object.*$' => [
'^.*/finance/investment/object(\?.*$|$)' => [
[
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentObjectProfile',
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentObjectView',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::MODULE_NAME,
@ -51,7 +51,7 @@ return [
],
],
'^.*/private/investment/list.*$' => [
'^.*/private/investment/list(\?.*$|$)' => [
[
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentList',
'verb' => RouteVerb::GET,
@ -62,9 +62,9 @@ return [
],
],
],
'^.*/private/investment/profile.*$' => [
'^.*/private/investment/view(\?.*$|$)' => [
[
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentProfile',
'dest' => '\Modules\InvestmentManagement\Controller\BackendController:viewInvestmentView',
'verb' => RouteVerb::GET,
'permission' => [
'module' => BackendController::MODULE_NAME,

View File

@ -61,12 +61,15 @@ 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('type/id', $type->id)
->where('ref', (int) $request->getData('ref'))
->execute();
@ -164,13 +167,20 @@ final class ApiAttributeController extends Controller
->where('id', $request->getDataInt('type') ?? 0)
->execute();
if ($type->isInternal) {
$response->header->status = RequestStatusCode::R_403;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attrValue = $this->createAttributeValueFromRequest($request, $type);
$this->createModel($request->header->account, $attrValue, InvestmentObjectAttributeValueMapper::class, 'attr_value', $request->getOrigin());
if ($attrValue->isDefault) {
$this->createModelRelation(
$request->header->account,
(int) $request->getData('type'),
$type->id,
$attrValue->id,
InvestmentObjectAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
);

View File

@ -99,7 +99,7 @@ final class ApiController extends Controller
$investment = new Investment();
$investment->name = $request->getDataString('name') ?? '';
$investment->description = $request->getDataString('description') ?? '';
$investment->status = $request->getDataInt('status') ?? InvestmentStatus::DRAFT;
$investment->status = InvestmentStatus::tryFromValue($request->getDataInt('status')) ?? InvestmentStatus::DRAFT;
$investment->description = $request->getDataString('description') ?? '';
$investment->unit = $request->getDataInt('unit') ?? $this->app->unitId;
$investment->createdBy = new NullAccount($request->header->account);
@ -814,7 +814,10 @@ final class ApiController extends Controller
{
$type = new BaseStringL11nType();
$type->title = $request->getDataString('name') ?? '';
$type->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN);
$type->setL11n(
$request->getDataString('title') ?? '',
ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN
);
return $type;
}
@ -878,12 +881,10 @@ final class ApiController extends Controller
*/
private function createAmountTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
{
$typeL11n = new BaseStringL11n();
$typeL11n->ref = $request->getDataInt('type') ?? 0;
$typeL11n->setLanguage(
$request->getDataString('language') ?? $request->header->l11n->language
);
$typeL11n->content = $request->getDataString('title') ?? '';
$typeL11n = new BaseStringL11n();
$typeL11n->ref = $request->getDataInt('type') ?? 0;
$typeL11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
$typeL11n->content = $request->getDataString('title') ?? '';
return $typeL11n;
}

View File

@ -14,16 +14,11 @@ declare(strict_types=1);
namespace Modules\InvestmentManagement\Controller;
use Modules\Admin\Models\LocalizationMapper;
use Modules\Admin\Models\SettingsEnum;
use Modules\InvestmentManagement\Models\InvestmentMapper;
use Modules\InvestmentManagement\Models\InvestmentObjectMapper;
use Modules\InvestmentManagement\Models\InvestmentTypeMapper;
use Modules\Media\Models\MediaMapper;
use Modules\Media\Models\MediaTypeMapper;
use Modules\Organization\Models\UnitMapper;
use phpOMS\Contract\RenderableInterface;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Views\View;
@ -78,10 +73,10 @@ final class BackendController extends Controller
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewInvestmentObjectProfile(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
public function viewInvestmentObjectView(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-object-profile');
$view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-object-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007101001, $request, $response);
$object = InvestmentObjectMapper::get()
@ -95,11 +90,8 @@ final class BackendController extends Controller
$view->data['object'] = $object;
/** @var \Model\Setting $settings */
$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['default_localization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
@ -118,10 +110,10 @@ final class BackendController extends Controller
* @since 1.0.0
* @codeCoverageIgnore
*/
public function viewInvestmentProfile(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
public function viewInvestmentView(RequestAbstract $request, ResponseAbstract $response, $data = null) : RenderableInterface
{
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-profile');
$view->setTemplate('/Modules/InvestmentManagement/Theme/Backend/investment-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007101001, $request, $response);
$investment = InvestmentMapper::get()
@ -147,11 +139,8 @@ final class BackendController extends Controller
$view->data['investment'] = $investment;
/** @var \Model\Setting $settings */
$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['default_localization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
$investmentTypes = InvestmentTypeMapper::getAll()
->with('l11n')
@ -166,7 +155,7 @@ final class BackendController extends Controller
$view->data['units'] = $units;
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
$view->data['note'] = new \Modules\Editor\Theme\Backend\Components\Note\BaseView($this->app->l11nManager, $request, $response);
$view->data['note'] = new \Modules\Editor\Theme\Backend\Components\Note\BaseView($this->app->l11nManager, $request, $response);
return $view;
}

View File

@ -36,10 +36,10 @@ final class AmountGroupMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'investmgmt_amount_group_id' => ['name' => 'investmgmt_amount_group_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_amount_group_name' => ['name' => 'investmgmt_amount_group_name', 'type' => 'string', 'internal' => 'name'],
'investmgmt_amount_group_type' => ['name' => 'investmgmt_amount_group_type', 'type' => 'int', 'internal' => 'type'],
'investmgmt_amount_group_option' => ['name' => 'investmgmt_amount_group_option', 'type' => 'int', 'internal' => 'option'],
'investmgmt_amount_group_id' => ['name' => 'investmgmt_amount_group_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_amount_group_name' => ['name' => 'investmgmt_amount_group_name', 'type' => 'string', 'internal' => 'name'],
'investmgmt_amount_group_type' => ['name' => 'investmgmt_amount_group_type', 'type' => 'int', 'internal' => 'type'],
'investmgmt_amount_group_option' => ['name' => 'investmgmt_amount_group_option', 'type' => 'int', 'internal' => 'option'],
];
/**
@ -49,9 +49,9 @@ final class AmountGroupMapper extends DataMapperFactory
* @since 1.0.0
*/
public const OWNS_ONE = [
'type' => [
'mapper' => AmountTypeMapper::class,
'external' => 'investmgmt_amount_group_type',
'type' => [
'mapper' => AmountTypeMapper::class,
'external' => 'investmgmt_amount_group_type',
],
];

View File

@ -36,11 +36,11 @@ final class AmountMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'investmgmt_amount_id' => ['name' => 'investmgmt_amount_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_amount_name' => ['name' => 'investmgmt_amount_name', 'type' => 'string', 'internal' => 'name'],
'investmgmt_amount_amount' => ['name' => 'investmgmt_amount_amount', 'type' => 'Serializable', 'internal' => 'amount'],
'investmgmt_amount_date' => ['name' => 'investmgmt_amount_date', 'type' => 'DateTime', 'internal' => 'date'],
'investmgmt_amount_group' => ['name' => 'investmgmt_amount_group', 'type' => 'int', 'internal' => 'group'],
'investmgmt_amount_id' => ['name' => 'investmgmt_amount_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_amount_name' => ['name' => 'investmgmt_amount_name', 'type' => 'string', 'internal' => 'name'],
'investmgmt_amount_amount' => ['name' => 'investmgmt_amount_amount', 'type' => 'Serializable', 'internal' => 'amount'],
'investmgmt_amount_date' => ['name' => 'investmgmt_amount_date', 'type' => 'DateTime', 'internal' => 'date'],
'investmgmt_amount_group' => ['name' => 'investmgmt_amount_group', 'type' => 'int', 'internal' => 'group'],
];
/**

View File

@ -18,7 +18,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n;
/**
* mapper class.
* Amount type l11n mapper class.
*
* @package Modules\InvestmentManagement\Models
* @license OMS License 2.0

View File

@ -37,10 +37,10 @@ final class InvestmentObjectAttributeMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'investmgmt_option_attr_id' => ['name' => 'investmgmt_option_attr_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_option_attr_option' => ['name' => 'investmgmt_option_attr_option', 'type' => 'int', 'internal' => 'ref'],
'investmgmt_option_attr_type' => ['name' => 'investmgmt_option_attr_type', 'type' => 'int', 'internal' => 'type'],
'investmgmt_option_attr_value' => ['name' => 'investmgmt_option_attr_value', 'type' => 'int', 'internal' => 'value'],
'investmgmt_option_attr_id' => ['name' => 'investmgmt_option_attr_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_option_attr_option' => ['name' => 'investmgmt_option_attr_option', 'type' => 'int', 'internal' => 'ref'],
'investmgmt_option_attr_type' => ['name' => 'investmgmt_option_attr_type', 'type' => 'int', 'internal' => 'type'],
'investmgmt_option_attr_value' => ['name' => 'investmgmt_option_attr_value', 'type' => 'int', 'internal' => 'value'],
];
/**

View File

@ -42,7 +42,8 @@ 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_repeatable' => ['name' => 'investmgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
'investmgmt_attr_type_internal' => ['name' => 'investmgmt_attr_type_internal', 'type' => 'bool', 'internal' => 'isInternal'],
'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

@ -37,10 +37,10 @@ final class InvestmentObjectAttributeValueL11nMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'investmgmt_attr_value_l11n_id' => ['name' => 'investmgmt_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_attr_value_l11n_title' => ['name' => 'investmgmt_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'investmgmt_attr_value_l11n_value' => ['name' => 'investmgmt_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
'investmgmt_attr_value_l11n_lang' => ['name' => 'investmgmt_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
'investmgmt_attr_value_l11n_id' => ['name' => 'investmgmt_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_attr_value_l11n_title' => ['name' => 'investmgmt_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'investmgmt_attr_value_l11n_value' => ['name' => 'investmgmt_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
'investmgmt_attr_value_l11n_lang' => ['name' => 'investmgmt_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
];
/**

View File

@ -37,15 +37,15 @@ final class InvestmentObjectAttributeValueMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'investmgmt_attr_value_id' => ['name' => 'investmgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_attr_value_default' => ['name' => 'investmgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
'investmgmt_attr_value_valueStr' => ['name' => 'investmgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
'investmgmt_attr_value_valueInt' => ['name' => 'investmgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
'investmgmt_attr_value_valueDec' => ['name' => 'investmgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
'investmgmt_attr_value_valueDat' => ['name' => 'investmgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
'investmgmt_attr_value_unit' => ['name' => 'investmgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
'investmgmt_attr_value_deptype' => ['name' => 'investmgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
'investmgmt_attr_value_depvalue' => ['name' => 'investmgmt_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
'investmgmt_attr_value_id' => ['name' => 'investmgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_attr_value_default' => ['name' => 'investmgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
'investmgmt_attr_value_valueStr' => ['name' => 'investmgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
'investmgmt_attr_value_valueInt' => ['name' => 'investmgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
'investmgmt_attr_value_valueDec' => ['name' => 'investmgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
'investmgmt_attr_value_valueDat' => ['name' => 'investmgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
'investmgmt_attr_value_unit' => ['name' => 'investmgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
'investmgmt_attr_value_deptype' => ['name' => 'investmgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
'investmgmt_attr_value_depvalue' => ['name' => 'investmgmt_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
];
/**

View File

@ -16,7 +16,6 @@ namespace Modules\InvestmentManagement\Models;
use Modules\Admin\Models\Account;
use Modules\Admin\Models\NullAccount;
use phpOMS\Business\Finance\DepreciationType;
use phpOMS\Localization\BaseStringL11nType;
/**

View File

@ -39,14 +39,14 @@ final class InvestmentMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'investmgmt_investment_id' => ['name' => 'investmgmt_investment_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_investment_name' => ['name' => 'investmgmt_investment_name', 'type' => 'string', 'internal' => 'name'],
'investmgmt_investment_description' => ['name' => 'investmgmt_investment_description', 'type' => 'string', 'internal' => 'description'],
'investmgmt_investment_status' => ['name' => 'investmgmt_investment_status', 'type' => 'int', 'internal' => 'status'],
'investmgmt_investment_unit' => ['name' => 'investmgmt_investment_unit', 'type' => 'int', 'internal' => 'unit'],
'investmgmt_investment_created_by' => ['name' => 'investmgmt_investment_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
'investmgmt_investment_performance' => ['name' => 'investmgmt_investment_performance', 'type' => 'DateTime', 'internal' => 'performanceDate'],
'investmgmt_investment_created_at' => ['name' => 'investmgmt_investment_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
'investmgmt_investment_id' => ['name' => 'investmgmt_investment_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_investment_name' => ['name' => 'investmgmt_investment_name', 'type' => 'string', 'internal' => 'name'],
'investmgmt_investment_description' => ['name' => 'investmgmt_investment_description', 'type' => 'string', 'internal' => 'description'],
'investmgmt_investment_status' => ['name' => 'investmgmt_investment_status', 'type' => 'int', 'internal' => 'status'],
'investmgmt_investment_unit' => ['name' => 'investmgmt_investment_unit', 'type' => 'int', 'internal' => 'unit'],
'investmgmt_investment_created_by' => ['name' => 'investmgmt_investment_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
'investmgmt_investment_performance' => ['name' => 'investmgmt_investment_performance', 'type' => 'DateTime', 'internal' => 'performanceDate'],
'investmgmt_investment_created_at' => ['name' => 'investmgmt_investment_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
];
/**
@ -57,8 +57,8 @@ final class InvestmentMapper extends DataMapperFactory
*/
public const OWNS_ONE = [
'type' => [
'mapper' => InvestmentTypeMapper::class,
'external' => 'investmgmt_investment_type',
'mapper' => InvestmentTypeMapper::class,
'external' => 'investmgmt_investment_type',
],
];
@ -97,8 +97,8 @@ final class InvestmentMapper extends DataMapperFactory
*/
public const BELONGS_TO = [
'createdBy' => [
'mapper' => AccountMapper::class,
'external' => 'investmgmt_investment_created_by',
'mapper' => AccountMapper::class,
'external' => 'investmgmt_investment_created_by',
],
];

View File

@ -41,15 +41,15 @@ final class InvestmentObjectMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'investmgmt_option_id' => ['name' => 'investmgmt_option_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_option_name' => ['name' => 'investmgmt_option_name', 'type' => 'string', 'internal' => 'name'],
'investmgmt_option_description' => ['name' => 'investmgmt_option_description', 'type' => 'string', 'internal' => 'description'],
'investmgmt_option_link' => ['name' => 'investmgmt_option_link', 'type' => 'string', 'internal' => 'link'],
'investmgmt_option_supplier' => ['name' => 'investmgmt_option_supplier', 'type' => 'int', 'internal' => 'supplier'],
'investmgmt_option_supplier_alt' => ['name' => 'investmgmt_option_supplier_alt', 'type' => 'string', 'internal' => 'supplierName'],
'investmgmt_option_item' => ['name' => 'investmgmt_option_item', 'type' => 'int', 'internal' => 'item'],
'investmgmt_option_approved' => ['name' => 'investmgmt_option_approved', 'type' => 'bool', 'internal' => 'approved'],
'investmgmt_option_investment' => ['name' => 'investmgmt_option_investment', 'type' => 'int', 'internal' => 'investment'],
'investmgmt_option_id' => ['name' => 'investmgmt_option_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_option_name' => ['name' => 'investmgmt_option_name', 'type' => 'string', 'internal' => 'name'],
'investmgmt_option_description' => ['name' => 'investmgmt_option_description', 'type' => 'string', 'internal' => 'description'],
'investmgmt_option_link' => ['name' => 'investmgmt_option_link', 'type' => 'string', 'internal' => 'link'],
'investmgmt_option_supplier' => ['name' => 'investmgmt_option_supplier', 'type' => 'int', 'internal' => 'supplier'],
'investmgmt_option_supplier_alt' => ['name' => 'investmgmt_option_supplier_alt', 'type' => 'string', 'internal' => 'supplierName'],
'investmgmt_option_item' => ['name' => 'investmgmt_option_item', 'type' => 'int', 'internal' => 'item'],
'investmgmt_option_approved' => ['name' => 'investmgmt_option_approved', 'type' => 'bool', 'internal' => 'approved'],
'investmgmt_option_investment' => ['name' => 'investmgmt_option_investment', 'type' => 'int', 'internal' => 'investment'],
];
/**
@ -59,13 +59,13 @@ final class InvestmentObjectMapper extends DataMapperFactory
* @since 1.0.0
*/
public const OWNS_ONE = [
'supplier' => [
'mapper' => SupplierMapper::class,
'external' => 'investmgmt_option_supplier',
'supplier' => [
'mapper' => SupplierMapper::class,
'external' => 'investmgmt_option_supplier',
],
'item' => [
'mapper' => ItemMapper::class,
'external' => 'investmgmt_option_item',
'item' => [
'mapper' => ItemMapper::class,
'external' => 'investmgmt_option_item',
],
];

View File

@ -18,7 +18,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11n;
/**
* mapper class.
* Inspection type l11n mapper class.
*
* @package Modules\InvestmentManagement\Models
* @license OMS License 2.0

View File

@ -37,8 +37,8 @@ final class InvestmentTypeMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'investmgmt_investment_type_id' => ['name' => 'investmgmt_investment_type_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_investment_type_name' => ['name' => 'investmgmt_investment_type_name', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
'investmgmt_investment_type_id' => ['name' => 'investmgmt_investment_type_id', 'type' => 'int', 'internal' => 'id'],
'investmgmt_investment_type_name' => ['name' => 'investmgmt_investment_type_name', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
];

View File

@ -25,18 +25,18 @@ return ['InvestmentManagement' => [
'Title' => 'Titel',
'Files' => 'Dateien',
'Notes' => 'Notizen',
'Options' => 'Optionen',
'Option' => 'Option',
'Description' => 'Beschreibung',
'Link' => 'Link',
'Amounts' => 'Beträge',
'Amount' => 'Betrag',
'Quantity' => 'Menge',
'Attributes' => 'Attribute',
'Type' => 'Typ',
'Purchase' => 'Kauf',
'Options' => 'Optionen',
'Option' => 'Option',
'Description' => 'Beschreibung',
'Link' => 'Link',
'Amounts' => 'Beträge',
'Amount' => 'Betrag',
'Quantity' => 'Menge',
'Attributes' => 'Attribute',
'Type' => 'Typ',
'Purchase' => 'Kauf',
'Price' => 'Preis',
'Supplier' => 'Lieferant',
'Approved' => 'Genehmigt',
'Approve' => 'Genehmigen',
'Supplier' => 'Lieferant',
'Approved' => 'Genehmigt',
'Approve' => 'Genehmigen',
]];

View File

@ -25,18 +25,18 @@ return ['InvestmentManagement' => [
'Title' => 'Title',
'Files' => 'Files',
'Notes' => 'Notes',
'Options' => 'Options',
'Option' => 'Option',
'Description' => 'Description',
'Link' => 'Link',
'Amounts' => 'Amounts',
'Amount' => 'Amount',
'Quantity' => 'Quantity',
'Attributes' => 'Attributes',
'Type' => 'Type',
'Purchase' => 'Purchase',
'Options' => 'Options',
'Option' => 'Option',
'Description' => 'Description',
'Link' => 'Link',
'Amounts' => 'Amounts',
'Amount' => 'Amount',
'Quantity' => 'Quantity',
'Attributes' => 'Attributes',
'Type' => 'Type',
'Purchase' => 'Purchase',
'Price' => 'Price',
'Supplier' => 'Supplier',
'Approved' => 'Approved',
'Approve' => 'Approve',
'Supplier' => 'Supplier',
'Approved' => 'Approved',
'Approve' => 'Approve',
]];

View File

@ -23,53 +23,53 @@ echo $this->data['nav']->render(); ?>
<section class="portlet">
<div class="portlet-head"><?= $this->getHtml('Investments'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table id="iSalesClientList" class="default sticky">
<table id="iInvestmentList" class="default sticky">
<thead>
<tr>
<td>
<td><?= $this->getHtml('ID', '0', '0'); ?>
<label for="iSalesClientList-sort-1">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-1">
<label for="iInvestmentList-sort-1">
<input type="radio" name="iInvestmentList-sort" id="iInvestmentList-sort-1">
<i class="sort-asc g-icon">expand_less</i>
</label>
<label for="iSalesClientList-sort-2">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-2">
<label for="iInvestmentList-sort-2">
<input type="radio" name="iInvestmentList-sort" id="iInvestmentList-sort-2">
<i class="sort-desc g-icon">expand_more</i>
</label>
<label>
<i class="filter g-icon">filter_alt</i>
</label>
<td><?= $this->getHtml('Status'); ?>
<label for="iSalesClientList-sort-3">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-3">
<label for="iInvestmentList-sort-3">
<input type="radio" name="iInvestmentList-sort" id="iInvestmentList-sort-3">
<i class="sort-asc g-icon">expand_less</i>
</label>
<label for="iSalesClientList-sort-4">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-4">
<label for="iInvestmentList-sort-4">
<input type="radio" name="iInvestmentList-sort" id="iInvestmentList-sort-4">
<i class="sort-desc g-icon">expand_more</i>
</label>
<label>
<i class="filter g-icon">filter_alt</i>
</label>
<td class="wf-100"><?= $this->getHtml('Name'); ?>
<label for="iSalesClientList-sort-5">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-5">
<label for="iInvestmentList-sort-5">
<input type="radio" name="iInvestmentList-sort" id="iInvestmentList-sort-5">
<i class="sort-asc g-icon">expand_less</i>
</label>
<label for="iSalesClientList-sort-6">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-6">
<label for="iInvestmentList-sort-6">
<input type="radio" name="iInvestmentList-sort" id="iInvestmentList-sort-6">
<i class="sort-desc g-icon">expand_more</i>
</label>
<label>
<i class="filter g-icon">filter_alt</i>
</label>
<td><?= $this->getHtml('Creator'); ?>
<label for="iSalesClientList-sort-7">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-7">
<label for="iInvestmentList-sort-7">
<input type="radio" name="iInvestmentList-sort" id="iInvestmentList-sort-7">
<i class="sort-asc g-icon">expand_less</i>
</label>
<label for="iSalesClientList-sort-8">
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-8">
<label for="iInvestmentList-sort-8">
<input type="radio" name="iInvestmentList-sort" id="iInvestmentList-sort-8">
<i class="sort-desc g-icon">expand_more</i>
</label>
<label>
@ -80,14 +80,14 @@ echo $this->data['nav']->render(); ?>
$count = 0;
foreach ($investments as $key => $value) :
++$count;
$url = UriFactory::build('{/base}/finance/investment/profile?{?}&id=' . $value->id);
$url = UriFactory::build('{/base}/finance/investment/view?{?}&id=' . $value->id);
?>
<tr data-href="<?= $url; ?>">
<td>
<td data-label="<?= $this->getHtml('ID', '0', '0'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml((string) $value->id); ?></a>
<td data-label="<?= $this->getHtml('Status'); ?>"><a href="<?= $url; ?>"><?= $this->getHtml(':status' . $value->status); ?></a>
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->name); ?></a>
<td data-label="<?= $this->getHtml('Creator'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/profile/single?{?}&for=' . $value->createdBy->id); ?>"><?= $this->printHtml($this->renderUserName('%3$s %2$s %1$s', [$value->createdBy->name1, $value->createdBy->name2, $value->createdBy->name3, $value->createdBy->login ?? ''])); ?></a>
<td data-label="<?= $this->getHtml('Creator'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/profile/view?{?}&for=' . $value->createdBy->id); ?>"><?= $this->printHtml($this->renderUserName('%3$s %2$s %1$s', [$value->createdBy->name1, $value->createdBy->name2, $value->createdBy->name3, $value->createdBy->login ?? ''])); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="8" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>

View File

@ -17,8 +17,8 @@ use phpOMS\Localization\ISO639Enum;
/** @var \phpOMS\Views\View $this */
$object = $this->data['object'] ?? null;
$attributeView = $this->data['attributeView'];
$languages = ISO639Enum::getConstants();
$attributeView = $this->data['attributeView'];
$languages = ISO639Enum::getConstants();
echo $this->data['nav']->render(); ?>
<div class="tabview tab-2">

View File

@ -16,9 +16,9 @@ use Modules\InvestmentManagement\Models\InvestmentStatus;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
$investment = $this->data['investment'] ?? null;
$investment = $this->data['investment'] ?? null;
$investmentStatus = InvestmentStatus::getConstants();
$files = $investment->files;
$files = $investment->files;
$investmentTypes = $this->data['types'] ?? [];
echo $this->data['nav']->render(); ?>
@ -234,7 +234,7 @@ echo $this->data['nav']->render(); ?>
</div>
</div>
<div class="portlet-foot">
<a class="button edit" href="<?= UriFactory::build('{/base}/finance/investment/object?id=' . $option->id) ?>"><?= $this->getHtml('Edit', '0', '0'); ?></a>
<a class="button edit" href="<?= UriFactory::build('{/base}/finance/investment/object?id=' . $option->id); ?>"><?= $this->getHtml('Edit', '0', '0'); ?></a>
</div>
</section>
</div>

View File

@ -75,8 +75,8 @@ final class Autoloader
*/
public static function defaultAutoloader(string $class) : void
{
$class = \ltrim($class, '\\');
$class = \strtr($class, '_\\', '//');
$class = \ltrim($class, '\\');
$class = \strtr($class, '_\\', '//');
if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) {
$class = \is_dir(__DIR__ . '/Web') ? $class : \str_replace('Web/', 'MainRepository/Web/', $class);

View File

@ -1,4 +1,15 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\InvestmentManagement\tests
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
\ini_set('memory_limit', '2048M');
@ -67,10 +78,10 @@ $GLOBALS['is_github'] = $IS_GITHUB;
$tmp = FileLogger::getInstance(__DIR__ . '/../Logs');
$CONFIG = [
'db' => [
'db' => [
'core' => [
'masters' => [
'admin' => [
'admin' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -80,7 +91,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'insert' => [
'insert' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -90,7 +101,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'select' => [
'select' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -100,7 +111,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'update' => [
'update' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -110,7 +121,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'delete' => [
'delete' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -120,7 +131,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'schema' => [
'schema' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -132,7 +143,7 @@ $CONFIG = [
],
],
'postgresql' => [
'admin' => [
'admin' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -142,7 +153,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'insert' => [
'insert' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -152,7 +163,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'select' => [
'select' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -162,7 +173,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'update' => [
'update' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -172,7 +183,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'delete' => [
'delete' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -182,7 +193,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'schema' => [
'schema' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -194,37 +205,37 @@ $CONFIG = [
],
],
'sqlite' => [
'admin' => [
'admin' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'insert' => [
'insert' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'select' => [
'select' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'update' => [
'update' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'delete' => [
'delete' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'schema' => [
'schema' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
@ -232,7 +243,7 @@ $CONFIG = [
],
],
'mssql' => [
'admin' => [
'admin' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -242,7 +253,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'insert' => [
'insert' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -252,7 +263,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'select' => [
'select' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -262,7 +273,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'update' => [
'update' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -272,7 +283,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'delete' => [
'delete' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -282,7 +293,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'schema' => [
'schema' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -322,16 +333,16 @@ $CONFIG = [
'password' => '123456',
],
],
'log' => [
'log' => [
'file' => [
'path' => __DIR__ . '/Logs',
],
],
'page' => [
'page' => [
'root' => '/',
'https' => false,
],
'app' => [
'app' => [
'path' => __DIR__,
'default' => [
'app' => 'Backend',
@ -350,7 +361,7 @@ $CONFIG = [
],
],
],
'socket' => [
'socket' => [
'master' => [
'host' => '127.0.0.1',
'limit' => 300,
@ -360,7 +371,7 @@ $CONFIG = [
'language' => [
'en',
],
'apis' => [
'apis' => [
],
];