mirror of
https://github.com/Karaka-Management/oms-InvestmentManagement.git
synced 2026-01-11 11:48:41 +00:00
loan/investment/fleetmgmt fixes
This commit is contained in:
parent
999e85b138
commit
9cd68d4459
|
|
@ -4,7 +4,7 @@
|
|||
"pid": "/",
|
||||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Investment",
|
||||
"name": "Investments",
|
||||
"uri": "{/base}finance/investment/list?{?}",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,52 @@
|
|||
{
|
||||
"investmgmt_investment_type": {
|
||||
"name": "investmgmt_investment_type",
|
||||
"fields": {
|
||||
"investmgmt_investment_type_id": {
|
||||
"name": "investmgmt_investment_type_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"investmgmt_investment_type_name": {
|
||||
"name": "investmgmt_investment_type_name",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"investmgmt_investment_type_l11n": {
|
||||
"name": "investmgmt_investment_type_l11n",
|
||||
"fields": {
|
||||
"investmgmt_investment_type_l11n_id": {
|
||||
"name": "investmgmt_investment_type_l11n_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"investmgmt_investment_type_l11n_title": {
|
||||
"name": "investmgmt_investment_type_l11n_title",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"investmgmt_investment_type_l11n_type": {
|
||||
"name": "investmgmt_investment_type_l11n_type",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "investmgmt_investment_type",
|
||||
"foreignKey": "investmgmt_investment_type_id"
|
||||
},
|
||||
"investmgmt_investment_type_l11n_lang": {
|
||||
"name": "investmgmt_investment_type_l11n_lang",
|
||||
"type": "VARCHAR(2)",
|
||||
"null": false,
|
||||
"foreignTable": "language",
|
||||
"foreignKey": "language_639_1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"investmgmt_investment": {
|
||||
"name": "investmgmt_investment",
|
||||
"fields": {
|
||||
|
|
@ -24,6 +72,12 @@
|
|||
"type": "TINYINT",
|
||||
"null": false
|
||||
},
|
||||
"investmgmt_investment_type": {
|
||||
"name": "investmgmt_investment_type",
|
||||
"type": "INT",
|
||||
"foreignTable": "investmgmt_investment_type",
|
||||
"foreignKey": "investmgmt_investment_type_id"
|
||||
},
|
||||
"investmgmt_investment_depreciation_type": {
|
||||
"name": "investmgmt_investment_depreciation_type",
|
||||
"type": "TINYINT",
|
||||
|
|
@ -56,25 +110,25 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"investmgmt_investmen_media": {
|
||||
"name": "investmgmt_investmen_media",
|
||||
"investmgmt_investment_media": {
|
||||
"name": "investmgmt_investment_media",
|
||||
"fields": {
|
||||
"investmgmt_investmen_media_id": {
|
||||
"name": "investmgmt_investmen_media_id",
|
||||
"investmgmt_investment_media_id": {
|
||||
"name": "investmgmt_investment_media_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"investmgmt_investmen_media_investment": {
|
||||
"name": "investmgmt_investmen_media_investment",
|
||||
"investmgmt_investment_media_investment": {
|
||||
"name": "investmgmt_investment_media_investment",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "investmgmt_investmen",
|
||||
"foreignKey": "investmgmt_investmen_id"
|
||||
"foreignTable": "investmgmt_investment",
|
||||
"foreignKey": "investmgmt_investment_id"
|
||||
},
|
||||
"investmgmt_investmen_media_media": {
|
||||
"name": "investmgmt_investmen_media_media",
|
||||
"investmgmt_investment_media_media": {
|
||||
"name": "investmgmt_investment_media_media",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "media",
|
||||
|
|
@ -82,25 +136,25 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"investmgmt_investmen_note": {
|
||||
"name": "investmgmt_investmen_note",
|
||||
"investmgmt_investment_note": {
|
||||
"name": "investmgmt_investment_note",
|
||||
"fields": {
|
||||
"investmgmt_investmen_note_id": {
|
||||
"name": "investmgmt_investmen_note_id",
|
||||
"investmgmt_investment_note_id": {
|
||||
"name": "investmgmt_investment_note_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"investmgmt_investmen_note_investment": {
|
||||
"name": "investmgmt_investmen_note_investment",
|
||||
"investmgmt_investment_note_investment": {
|
||||
"name": "investmgmt_investment_note_investment",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "investmgmt_investmen",
|
||||
"foreignKey": "investmgmt_investmen_id"
|
||||
"foreignTable": "investmgmt_investment",
|
||||
"foreignKey": "investmgmt_investment_id"
|
||||
},
|
||||
"investmgmt_investmen_note_doc": {
|
||||
"name": "investmgmt_investmen_note_doc",
|
||||
"investmgmt_investment_note_doc": {
|
||||
"name": "investmgmt_investment_note_doc",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "editor_doc",
|
||||
|
|
@ -173,7 +227,7 @@
|
|||
"default": null,
|
||||
"foreignTable": "investmgmt_option",
|
||||
"foreignKey": "investmgmt_option_id"
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
"investmgmt_option_media": {
|
||||
|
|
@ -190,7 +244,7 @@
|
|||
"name": "investmgmt_option_media_option",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "investmgmt_investmen",
|
||||
"foreignTable": "investmgmt_option",
|
||||
"foreignKey": "investmgmt_option_id"
|
||||
},
|
||||
"investmgmt_option_media_media": {
|
||||
|
|
@ -216,7 +270,7 @@
|
|||
"name": "investmgmt_option_note_option",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "investmgmt_investmen",
|
||||
"foreignTable": "investmgmt_option",
|
||||
"foreignKey": "investmgmt_option_id"
|
||||
},
|
||||
"investmgmt_option_note_doc": {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ final class Installer extends InstallerAbstract
|
|||
{
|
||||
parent::install($app, $info, $cfgHandler);
|
||||
|
||||
/* Fuel types */
|
||||
/* Amount types */
|
||||
$fileContent = \file_get_contents(__DIR__ . '/Install/amounttypes.json');
|
||||
if ($fileContent === false) {
|
||||
return;
|
||||
|
|
@ -86,7 +86,7 @@ final class Installer extends InstallerAbstract
|
|||
$request->setData('title', \reset($type['l11n']));
|
||||
$request->setData('language', \array_keys($type['l11n'])[0] ?? 'en');
|
||||
|
||||
$module->apiFuelTypeCreate($request, $response);
|
||||
$module->apiAmountTypeCreate($request, $response);
|
||||
|
||||
$responseData = $response->get('');
|
||||
if (!\is_array($responseData)) {
|
||||
|
|
@ -112,7 +112,7 @@ final class Installer extends InstallerAbstract
|
|||
$request->setData('language', $language);
|
||||
$request->setData('type', $amountTypes[$type['name']]['id']);
|
||||
|
||||
$module->apiFuelTypeL11nCreate($request, $response);
|
||||
$module->apiAmountTypeL11nCreate($request, $response);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@ use Modules\InvestmentManagement\Models\InvestmentObject;
|
|||
use Modules\InvestmentManagement\Models\InvestmentObjectMapper;
|
||||
use Modules\InvestmentManagement\Models\InvestmentMapper;
|
||||
use Modules\InvestmentManagement\Models\InvestmentStatus;
|
||||
use Modules\InvestmentManagement\Models\InvestmentTypeL11nMapper;
|
||||
use Modules\InvestmentManagement\Models\InvestmentTypeMapper;
|
||||
use Modules\Media\Models\CollectionMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Media\Models\NullMedia;
|
||||
|
|
@ -51,7 +49,7 @@ use phpOMS\Stdlib\Base\FloatInt;
|
|||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class ApiInvestmentController extends Controller
|
||||
final class ApiController extends Controller
|
||||
{
|
||||
/**
|
||||
* Api method to create a investment
|
||||
|
|
@ -109,9 +107,12 @@ final class ApiInvestmentController extends Controller
|
|||
$investment = new Investment();
|
||||
$investment->name = $request->getDataString('name') ?? '';
|
||||
$investment->description = $request->getDataString('description') ?? '';
|
||||
$investment->status = (int) ($request->getDataInt('status') ?? InvestmentStatus::DRAFT);
|
||||
$investment->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0));
|
||||
$investment->description = $request->getDataString('description') ?? '';
|
||||
$investment->unit = $request->getDataInt('unit') ?? $this->app->unitId;
|
||||
$investment->createdBy = new NullAccount($request->header->account);
|
||||
$investment->performanceDate = $request->getDataDateTime('performance') ?? $investment->createdAt;
|
||||
$investment->performanceDate = $request->getDataDateTime('performance') ?? new \DateTime($investment->createdAt->format('Y-m-d H:i:s'));
|
||||
|
||||
return $investment;
|
||||
}
|
||||
|
|
@ -491,7 +492,7 @@ final class ApiInvestmentController extends Controller
|
|||
$investment->link = $request->getDataString('link') ?? '';
|
||||
$investment->investment = (int) $request->getData('investment');
|
||||
$investment->parent = $request->getDataInt('parent');
|
||||
$investment->supplier = $request->getDataInt('supplier') ?? 0;
|
||||
$investment->supplier = $request->getDataInt('supplier');
|
||||
$investment->supplierName = $request->getDataString('supplierName') ?? '';
|
||||
$investment->item = $request->getDataInt('item');
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ namespace Modules\InvestmentManagement\Models;
|
|||
use Modules\Admin\Models\Account;
|
||||
use Modules\Admin\Models\NullAccount;
|
||||
use phpOMS\Business\Finance\DepreciationType;
|
||||
use phpOMS\Localization\BaseStringL11nType;
|
||||
|
||||
/**
|
||||
* Investment model.
|
||||
|
|
@ -38,6 +39,8 @@ class Investment
|
|||
|
||||
public int $status = InvestmentStatus::DRAFT;
|
||||
|
||||
public BaseStringL11nType $type;
|
||||
|
||||
public array $options = [];
|
||||
|
||||
/**
|
||||
|
|
@ -57,14 +60,15 @@ class Investment
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public __construct()
|
||||
public function __construct()
|
||||
{
|
||||
$this->createdBy = new NullAccount();
|
||||
$this->createdAt = new \DateTimeImmutable('now');
|
||||
$this->perforamnceDate = new \DateTime('now');
|
||||
$this->performanceDate = new \DateTime('now');
|
||||
$this->type = new BaseStringL11nType();
|
||||
}
|
||||
|
||||
use \Modules\Media\Models\MediaListTrait;
|
||||
|
|
|
|||
|
|
@ -51,6 +51,19 @@ final class InvestmentMapper extends DataMapperFactory
|
|||
'investmgmt_investment_created_at' => ['name' => 'investmgmt_investment_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const OWNS_ONE = [
|
||||
'type' => [
|
||||
'mapper' => InvestmentTypeMapper::class,
|
||||
'external' => 'investmgmt_investment_type',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class InvestmentObject
|
|||
|
||||
public string $description = '';
|
||||
|
||||
public int $supplier = 0;
|
||||
public ?int $supplier = null;
|
||||
|
||||
public string $supplierName = '';
|
||||
|
||||
|
|
|
|||
84
Models/InvestmentTypeMapper.php
Normal file
84
Models/InvestmentTypeMapper.php
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\InvestmentManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\InvestmentManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\Localization\BaseStringL11nType;
|
||||
|
||||
/**
|
||||
* Item mapper class.
|
||||
*
|
||||
* @package Modules\InvestmentManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of BaseStringL11nType
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class InvestmentTypeMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @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],
|
||||
|
||||
];
|
||||
|
||||
/**
|
||||
* Has many relation.
|
||||
*
|
||||
* @var array<string, array{mapper:class-string, table:string, self?:?string, external?:?string, column?:string}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const HAS_MANY = [
|
||||
'l11n' => [
|
||||
'mapper' => InvestmentTypeL11nMapper::class,
|
||||
'table' => 'investmgmt_investment_type_l11n',
|
||||
'self' => 'investmgmt_investment_type_l11n_type',
|
||||
'column' => 'content',
|
||||
'external' => null,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11nType::class;
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const TABLE = 'investmgmt_investment_type';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'investmgmt_investment_type_id';
|
||||
}
|
||||
69
Models/VehicleTypeL11nMapper.php
Normal file
69
Models/VehicleTypeL11nMapper.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\InvestmentManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\InvestmentManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
|
||||
/**
|
||||
* mapper class.
|
||||
*
|
||||
* @package Modules\InvestmentManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of BaseStringL11n
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class InvestmentTypeL11nMapper extends DataMapperFactory
|
||||
{
|
||||
/**
|
||||
* Columns.
|
||||
*
|
||||
* @var array<string, array{name:string, type:string, internal:string, autocomplete?:bool, readonly?:bool, writeonly?:bool, annotations?:array}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const COLUMNS = [
|
||||
'investmgmt_investment_type_l11n_id' => ['name' => 'investmgmt_investment_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'investmgmt_investment_type_l11n_title' => ['name' => 'investmgmt_investment_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
||||
'investmgmt_investment_type_l11n_type' => ['name' => 'investmgmt_investment_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
|
||||
'investmgmt_investment_type_l11n_lang' => ['name' => 'investmgmt_investment_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const TABLE = 'investmgmt_investment_type_l11n';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'investmgmt_investment_type_l11n_id';
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
}
|
||||
|
|
@ -13,6 +13,6 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'PurchaseInquiries' => 'PurchaseInquiries',
|
||||
'Investment' => 'Investment',
|
||||
'PurchaseInquiries' => 'Purchase Inquiries',
|
||||
'Investments' => 'Investments',
|
||||
]];
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user