auto fixes + some impl.

This commit is contained in:
Dennis Eichhorn 2024-01-26 22:53:59 +00:00
parent 9e02d6f4cb
commit d41d458839
11 changed files with 340 additions and 329 deletions

File diff suppressed because it is too large Load Diff

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.
@ -75,7 +74,7 @@ final class Installer extends InstallerAbstract
$module = $app->moduleManager->get('Finance');
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('abbr', $data['abbr'] ?? '');
@ -106,7 +105,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['title'] ?? '');

View File

@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/finance/analysis(\?.*|$)$' => [
'^.*/finance/analysis(\?.*$|$)' => [
[
'dest' => '\Modules\Finance\Controller\BackendController:viewDashboard',
'verb' => RouteVerb::GET,

View File

@ -18,6 +18,7 @@ use Modules\Finance\Models\TaxCode;
use Modules\Finance\Models\TaxCodeL11n;
use Modules\Finance\Models\TaxCodeL11nMapper;
use Modules\Finance\Models\TaxCodeMapper;
use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
@ -98,10 +99,10 @@ final class ApiController extends Controller
$code->percentageInput = $request->getDataInt('percentage_input_tax') ?? 0;
if ($request->hasData('title')) {
$code->l11n->title = $request->getDataString('title') ?? '';
$code->l11n->short = $request->getDataString('short') ?? '';
$code->l11n->long = $request->getDataString('long') ?? '';
$code->l11n->setLanguage($request->getDataString('language') ?? 'en');
$code->l11n->title = $request->getDataString('title') ?? '';
$code->l11n->short = $request->getDataString('short') ?? '';
$code->l11n->long = $request->getDataString('long') ?? '';
$code->l11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? 'en';
}
return $code;
@ -166,12 +167,12 @@ final class ApiController extends Controller
*/
private function createTaxCodeL11nFromRequest(RequestAbstract $request) : TaxCodeL11n
{
$l11n = new TaxCodeL11n();
$l11n->title = $request->getDataString('title') ?? '';
$l11n->short = $request->getDataString('short') ?? '';
$l11n->long = $request->getDataString('long') ?? '';
$l11n->code = $request->getDataInt('code') ?? 0;
$l11n->setLanguage($request->getDataString('language') ?? $request->header->l11n->language);
$l11n = new TaxCodeL11n();
$l11n->title = $request->getDataString('title') ?? '';
$l11n->short = $request->getDataString('short') ?? '';
$l11n->long = $request->getDataString('long') ?? '';
$l11n->code = $request->getDataInt('code') ?? 0;
$l11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
return $l11n;
}
@ -342,11 +343,11 @@ final class ApiController extends Controller
*/
public function updateTaxCodeL11nFromRequest(RequestAbstract $request, TaxCodeL11n $new) : TaxCodeL11n
{
$new->title = $request->getDataString('title') ?? $new->title;
$new->short = $request->getDataString('short') ?? $new->short;
$new->long = $request->getDataString('long') ?? $new->long;
$new->code = $request->getDataInt('code') ?? $new->code;
$new->setLanguage($request->getDataString('language') ?? $new->language);
$new->title = $request->getDataString('title') ?? $new->title;
$new->short = $request->getDataString('short') ?? $new->short;
$new->long = $request->getDataString('long') ?? $new->long;
$new->code = $request->getDataInt('code') ?? $new->code;
$new->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $new->language;
return $new;
}

View File

@ -27,7 +27,7 @@ Version 2.0
Subject to the terms and conditions of this License, each Contributor grants to You after purchase a perpetual, worldwide, non-exclusive, irrevocable copyright license to prepare Derivative Works of, publicly display, publicly perform the Work and such Derivative Works in Source or Object form. You are not allowed to sublicense, reproduce, or distribute the Work and such Derivative Works in Source or Object form.
3. Redistribution.
3. Redistribution
You may not reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form.

View File

@ -64,7 +64,7 @@ class TaxCode implements \JsonSerializable
public function toArray() : array
{
return [
'id' => $this->id,
'id' => $this->id,
];
}

View File

@ -115,11 +115,11 @@ class TaxCodeL11n implements \JsonSerializable
public function toArray() : array
{
return [
'id' => $this->id,
'title' => $this->title,
'short' => $this->short,
'long' => $this->long,
'language' => $this->language,
'id' => $this->id,
'title' => $this->title,
'short' => $this->short,
'long' => $this->long,
'language' => $this->language,
];
}

View File

@ -36,12 +36,12 @@ final class TaxCodeL11nMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'tax_code_l11n_id' => ['name' => 'tax_code_l11n_id', 'type' => 'int', 'internal' => 'id'],
'tax_code_l11n_text_title' => ['name' => 'tax_code_l11n_text_title', 'type' => 'string', 'internal' => 'title'],
'tax_code_l11n_text_short' => ['name' => 'tax_code_l11n_text_short', 'type' => 'string', 'internal' => 'short'],
'tax_code_l11n_text_long' => ['name' => 'tax_code_l11n_text_long', 'type' => 'string', 'internal' => 'long'],
'tax_code_l11n_lang' => ['name' => 'tax_code_l11n_lang', 'type' => 'string', 'internal' => 'language'],
'tax_code_l11n_code' => ['name' => 'tax_code_l11n_code', 'type' => 'int', 'internal' => 'code'],
'tax_code_l11n_id' => ['name' => 'tax_code_l11n_id', 'type' => 'int', 'internal' => 'id'],
'tax_code_l11n_text_title' => ['name' => 'tax_code_l11n_text_title', 'type' => 'string', 'internal' => 'title'],
'tax_code_l11n_text_short' => ['name' => 'tax_code_l11n_text_short', 'type' => 'string', 'internal' => 'short'],
'tax_code_l11n_text_long' => ['name' => 'tax_code_l11n_text_long', 'type' => 'string', 'internal' => 'long'],
'tax_code_l11n_lang' => ['name' => 'tax_code_l11n_lang', 'type' => 'string', 'internal' => 'language'],
'tax_code_l11n_code' => ['name' => 'tax_code_l11n_code', 'type' => 'int', 'internal' => 'code'],
];
/**

View File

@ -36,11 +36,11 @@ final class TaxCodeMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'tax_code_id' => ['name' => 'tax_code_id', 'type' => 'int', 'internal' => 'id'],
'tax_code_abbr' => ['name' => 'tax_code_abbr', 'type' => 'string', 'internal' => 'abbr'],
'tax_code_invoice' => ['name' => 'tax_code_invoice', 'type' => 'int', 'internal' => 'percentageInvoice'],
'tax_code_sales' => ['name' => 'tax_code_sales', 'type' => 'int', 'internal' => 'percentageSales'],
'tax_code_input' => ['name' => 'tax_code_input', 'type' => 'int', 'internal' => 'percentageInput'],
'tax_code_id' => ['name' => 'tax_code_id', 'type' => 'int', 'internal' => 'id'],
'tax_code_abbr' => ['name' => 'tax_code_abbr', 'type' => 'string', 'internal' => 'abbr'],
'tax_code_invoice' => ['name' => 'tax_code_invoice', 'type' => 'int', 'internal' => 'percentageInvoice'],
'tax_code_sales' => ['name' => 'tax_code_sales', 'type' => 'int', 'internal' => 'percentageSales'],
'tax_code_input' => ['name' => 'tax_code_input', 'type' => 'int', 'internal' => 'percentageInput'],
];
/**

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\Finance\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' => [
],
];