Merge pull request #1 from Karaka-Management/develop

Develop
This commit is contained in:
Dennis Eichhorn 2023-09-30 03:22:12 +02:00 committed by GitHub
commit 1589842616
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
80 changed files with 5509 additions and 1495 deletions

View File

@ -8,9 +8,11 @@ assignees: ''
---
# Bug Description
A clear and concise description of what the bug is.
# How to Reproduce
Steps to reproduce the behavior:
1. Go to '...'
@ -19,16 +21,20 @@ Steps to reproduce the behavior:
4. See error
# Expected Behavior
A clear and concise description of what you expected to happen.
# Screenshots
If applicable, add screenshots to help explain your problem.
# System Information
- System: [e.g. PC or iPhone11, ...]
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- KarakaVersion [e.g. 22]
# Additional Information
Add any other context about the problem here.

View File

@ -8,11 +8,14 @@ assignees: ''
---
# What is the feature you request
* A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
* A clear and concise description of what you want to happen.
# Alternatives
A clear and concise description of any alternative solutions or features you've considered.
# Additional Information
Add any other context or screenshots about the feature request here.

View File

@ -1,24 +1,10 @@
name: Compress images
on:
push:
paths:
- '**.jpg'
- '**.png'
- '**.webp'
pull_request:
paths:
- '**.jpg'
- '**.png'
- '**.webp'
jobs:
build:
name: calibreapp/image-actions
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@main
name: Image optimization
- name: Compress Images
uses: calibreapp/image-actions@main
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}
on: [push, pull_request]
jobs:
general_image_workflow:
uses: Karaka-Management/Karaka/.github/workflows/image.yml@develop
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_PAT: ${{ secrets.GH_PAT }}

View File

@ -1,281 +1,20 @@
name: CI
on: [push, pull_request]
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
schedule:
- cron: '0 0 1,15 * *'
jobs:
autoformat:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'NO_CI')"
strategy:
fail-fast: false
max-parallel: 3
steps:
- name: Checkout Repository
uses: actions/checkout@main
with:
fetch-depth: 1
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Setup Composer
run: composer install
- name: Autoformat
run: 'vendor/bin/php-cs-fixer fix ./ --rules=''{"array_syntax": {"syntax": "short"}, "blank_line_after_namespace": true, "global_namespace_import": {"import_classes": false, "import_constants": false, "import_functions": false}, "binary_operator_spaces": {"operators": {"=": "align", ".=": "align", "+=": "align", "-=": "align", "*=": "align", "/=": "align", "|=": "align", "&=": "align", "=>": "align", "??=": "align"}}, "cast_spaces": {"space": "single"}, "class_attributes_separation": { "elements": {"const": "one", "method": "one", "property": "one"} }, "combine_consecutive_issets": true, "compact_nullable_typehint": true, "declare_strict_types": true, "declare_equal_normalize": {"space": "none"}, "elseif": true, "encoding": true, "explicit_indirect_variable": true, "explicit_string_variable": true, "function_to_constant": true, "implode_call": true, "increment_style": {"style": "pre"}, "is_null": true, "yoda_style": {"equal": false, "identical": false, "less_and_greater": false}, "line_ending": true, "logical_operators": true, "lowercase_cast": true, "constant_case": {"case": "lower"}, "lowercase_keywords": true, "modernize_types_casting": true, "native_constant_invocation": true, "native_function_casing": true, "native_function_invocation": {"include": ["@all"]}, "new_with_braces": true, "no_extra_blank_lines": {"tokens": ["break", "case", "continue", "curly_brace_block", "extra", "return", "switch", "throw", "use"]}, "no_spaces_after_function_name": true, "no_alias_functions": true, "no_closing_tag": true, "no_empty_comment": true, "no_empty_phpdoc": true, "no_empty_statement": true, "no_homoglyph_names": true, "no_mixed_echo_print": {"use": "echo"}, "no_php4_constructor": true, "no_singleline_whitespace_before_semicolons": true, "no_spaces_inside_parenthesis": true, "no_trailing_whitespace": true, "no_unneeded_final_method": true, "no_unused_imports": true, "no_useless_return": true, "no_whitespace_before_comma_in_array": true, "no_whitespace_in_blank_line": true, "non_printable_character": true, "normalize_index_brace": true, "ordered_imports": {"sort_algorithm": "alpha"}, "ordered_interfaces": {"order": "alpha"}, "php_unit_construct": true, "php_unit_internal_class": true, "php_unit_set_up_tear_down_visibility": true, "phpdoc_indent": true, "phpdoc_align": {"align": "vertical"}, "phpdoc_annotation_without_dot": true, "phpdoc_scalar": true, "phpdoc_return_self_reference": {"replacements": {"this": "self"}}, "phpdoc_trim": true, "phpdoc_trim_consecutive_blank_line_separation": true, "random_api_migration": true, "self_accessor": true, "return_type_declaration": {"space_before": "one"}, "semicolon_after_instruction": true, "set_type_to_cast": true, "short_scalar_cast": true, "single_blank_line_at_eof": true, "single_line_after_imports": true, "standardize_increment": true, "trailing_comma_in_multiline": true, "trim_array_spaces": true, "visibility_required": true, "void_return": true}'' --allow-risky=yes'
- name: Check for modified files
id: git-check
run: echo ::set-output name=modified::$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)
- name: Push changes
if: steps.git-check.outputs.modified == 'true'
run: |
git config --global user.name 'Formatter Bot'
git config --global user.email 'formatter.bot@karaka.app'
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git commit -am "Automated formatting changes"
git push
code-tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'NO_CI')"
services:
mysql:
image: mysql:5.7
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: oms
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: root
POSTGRES_DB: oms
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
redis:
image: redis
ports:
- 6379:6379
options: --entrypoint redis-server
memcached:
image: memcached
ports:
- 11211:11211
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['8.1']
steps:
- name: Checkout Repository
uses: actions/checkout@main
with:
fetch-depth: 1
- name: Checkout Build Repository
uses: actions/checkout@main
with:
fetch-depth: 1
ref: develop
repository: Karaka-Management/Build
path: Build
- name: Checkout Resource Repository
uses: actions/checkout@main
with:
fetch-depth: 1
ref: develop
repository: Karaka-Management/Resources
path: Resources
- name: Checkout phpOMS Repository
uses: actions/checkout@main
with:
fetch-depth: 1
ref: develop
repository: Karaka-Management/phpOMS
path: phpOMS
token: ${{ secrets.GH_PAT }}
- name: Checkout Karaka Repository
uses: actions/checkout@main
with:
fetch-depth: 1
ref: develop
repository: Karaka-Management/Karaka
path: Karaka
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, gd, zip, dom, mysql, pgsql, sqlite, imap, bcmath, redis, memcached
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1
coverage: pcov
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Setup Composer
run: composer install
- name: phpunit
run: vendor/bin/phpunit --coverage-clover tests/coverage.xml --configuration tests/phpunit_default.xml
static-tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'NO_CI')"
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['8.1']
steps:
- name: Checkout Repository
uses: actions/checkout@main
with:
fetch-depth: 1
submodules: recursive
token: ${{ secrets.GH_PAT }}
- name: Checkout Build Repository
uses: actions/checkout@main
with:
fetch-depth: 1
ref: develop
repository: Karaka-Management/Build
path: Build
- name: Checkout phpOMS Repository
uses: actions/checkout@main
with:
fetch-depth: 1
ref: develop
repository: Karaka-Management/phpOMS
path: phpOMS
token: ${{ secrets.GH_PAT }}
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, gd, zip, dom, mysql, pgsql, sqlite, imap, bcmath, redis, memcached
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Setup Composer
run: composer install
- name: phpstan
run: vendor/bin/phpstan analyse -a phpOMS/Autoloader.php --no-progress -l 9 -c Build/Config/phpstan.neon ./
codestyle-tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'NO_CI')"
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['8.1']
steps:
- name: Checkout Repository
uses: actions/checkout@main
with:
fetch-depth: 1
submodules: recursive
token: ${{ secrets.GH_PAT }}
- name: Checkout Build Repository
uses: actions/checkout@main
with:
fetch-depth: 1
ref: develop
repository: Karaka-Management/Build
path: Build
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, gd, zip, dom, mysql, pgsql, sqlite, imap, bcmath, redis, memcached
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1
- name: Get Composer Cache Directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Setup Composer
run: composer install
- name: phpcs
run: vendor/bin/phpcs --severity=1 ./ --standard="Build/Config/phpcs.xml" -s --report=full
- name: Install NPM
uses: actions/setup-node@v3
with:
node-version: '14'
cache: 'npm'
- run: npm install
- name: eslint
run: npx eslint ./ -c Build/Config/.eslintrc.json
# linting:
# runs-on: ubuntu-latest
# if: "!contains(github.event.head_commit.message, 'NO_CI')"
# strategy:
# fail-fast: false
# max-parallel: 3
# steps:
# - name: Checkout Repository
# uses: actions/checkout@main
# with:
# fetch-depth: 0
# submodules: recursive
# token: ${{ secrets.GH_TOKEN }}
# - name: Lint Code Base
# uses: github/super-linter/slim@v4
# env:
# VALIDATE_ALL_CODEBASE: false
# VALIDATE_PHP: true
# VALIDATE_PHP_BUILTIN: true
# DEFAULT_BRANCH: develop
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
custom:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'NO_CI')"
strategy:
fail-fast: false
max-parallel: 3
matrix:
php-versions: ['8.1']
steps:
- name: Checkout Repository
uses: actions/checkout@main
with:
fetch-depth: 1
- name: Checkout Build Repository
uses: actions/checkout@main
with:
fetch-depth: 1
ref: develop
repository: Karaka-Management/Build
path: Build
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@master
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring, gd, zip, dom, mysql, pgsql, sqlite, bcmath, redis, memcached
ini-values: opcache.jit_buffer_size=256M, opcache.jit=1235, pcre.jit=1
- name: PHP linting
run: |
find ./ -type f \
-name '*.php' -print0 | xargs -0 -n1 -P4 php -l -n | (! grep -v "No syntax errors detected" )
- name: Php strict
run: if [[ $(grep -r -L "declare(strict_types=1);" --include=*.php --exclude={*.tpl.php,*Hooks.php,*Routes.php,*SearchCommands.php} ./) -ne "" ]]; then exit 1; fi
general_module_workflow:
uses: Karaka-Management/Karaka/.github/workflows/php_template.yml@develop
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_PAT: ${{ secrets.GH_PAT }}

14
.gitignore vendored
View File

@ -1 +1,15 @@
Build
*.cache
.directory
Vagrantfile
vendor
bower_components
node_modules
*.log
.vagrant
.vscode
.sass-cache
cache
Cache
Libraries
.idea

View File

@ -19,7 +19,7 @@
"type": 2,
"subtype": 1,
"name": "Analysis",
"uri": "{/lang}/{/app}/sales/analysis?{?}",
"uri": "{/base}/sales/analysis?{?}",
"target": "self",
"icon": null,
"order": 15,
@ -33,7 +33,7 @@
"type": 3,
"subtype": 1,
"name": "Dashboard",
"uri": "{/lang}/{/app}/sales/analysis?{?}",
"uri": "{/base}/sales/analysis?{?}",
"target": "self",
"icon": null,
"order": 1,

View File

@ -1,12 +1,12 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Admin\Install
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@ -20,7 +20,7 @@ use phpOMS\Application\ApplicationAbstract;
* Navigation class.
*
* @package Modules\Finance\Admin\Install
* @license OMS License 1.0
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/

76
Admin/Install/db.json Executable file
View File

@ -0,0 +1,76 @@
{
"tax_code": {
"name": "tax_code",
"fields": {
"tax_code_id": {
"name": "tax_code_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"tax_code_abbr": {
"name": "tax_code_abbr",
"type": "VARCHAR(10)",
"null": false,
"unique": true
},
"tax_code_invoice": {
"name": "tax_code_invoice",
"type": "INT(11)",
"null": false
},
"tax_code_sales": {
"name": "tax_code_sales",
"type": "INT(11)",
"null": false
},
"tax_code_input": {
"name": "tax_code_input",
"type": "INT(11)",
"null": false
}
}
},
"tax_code_l11n": {
"name": "tax_code_l11n",
"fields": {
"tax_code_l11n_id": {
"name": "tax_code_l11n_id",
"type": "INT",
"null": false,
"primary": true,
"autoincrement": true
},
"tax_code_l11n_text_title": {
"name": "tax_code_l11n_text_title",
"type": "VARCHAR(255)",
"null": false
},
"tax_code_l11n_text_short": {
"name": "tax_code_l11n_text_short",
"type": "VARCHAR(255)",
"null": false
},
"tax_code_l11n_text_long": {
"name": "tax_code_l11n_text_long",
"type": "VARCHAR(255)",
"null": false
},
"tax_code_l11n_lang": {
"name": "tax_code_l11n_lang",
"type": "VARCHAR(2)",
"null": false,
"foreignTable": "language",
"foreignKey": "language_639_1"
},
"tax_code_l11n_code": {
"name": "tax_code_l11n_code",
"type": "INT(11)",
"null": false,
"foreignTable": "tax_code",
"foreignKey": "tax_code_id"
}
}
}
}

2747
Admin/Install/taxcodes.json Executable file

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,12 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Admin
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@ -14,13 +14,19 @@ declare(strict_types=1);
namespace Modules\Finance\Admin;
use phpOMS\Application\ApplicationAbstract;
use phpOMS\Config\SettingsInterface;
use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Module\InstallerAbstract;
use phpOMS\Module\ModuleInfo;
use phpOMS\Uri\HttpUri;
/**
* Installer class.
*
* @package Modules\Finance\Admin
* @license OMS License 1.0
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
@ -33,4 +39,85 @@ final class Installer extends InstallerAbstract
* @since 1.0.0
*/
public const PATH = __DIR__;
/**
* {@inheritdoc}
*/
public static function install(ApplicationAbstract $app, ModuleInfo $info, SettingsInterface $cfgHandler) : void
{
parent::install($app, $info, $cfgHandler);
$fileContent = \file_get_contents(__DIR__ . '/Install/taxcodes.json');
if ($fileContent === false) {
return;
}
/** @var array $taxes */
$taxes = \json_decode($fileContent, true);
foreach ($taxes as $type) {
self::createCode($app, $type);
}
}
/**
* Install default tax codes
*
* @param ApplicationAbstract $app Application
* @param array $data Tax code data
*
* @return array
*
* @since 1.0.0
*/
private static function createCode(ApplicationAbstract $app, array $data) : array
{
/** @var \Modules\Finance\Controller\ApiController $module */
$module = $app->moduleManager->get('Finance');
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('abbr', $data['abbr'] ?? '');
$request->setData('percentage_invoice', $data['percentage_invoice'] ?? 0);
$request->setData('percentage_sales_tax', $data['percentage_sales_tax'] ?? 0);
$request->setData('percentage_input_tax', $data['percentage_input_tax'] ?? 0);
$request->setData('title', \reset($data['l11n'])['title'] ?? '');
$request->setData('short', \reset($data['l11n'])['short'] ?? '');
$request->setData('long', \reset($data['l11n'])['long'] ?? '');
$request->setData('language', \array_keys($data['l11n'])[0]);
$module->apiTaxCodeCreate($request, $response);
$responseData = $response->get('');
if (!\is_array($responseData)) {
return [];
}
/** @var \Modules\Finance\Models\TaxCode $code */
$code = $responseData['response'];
$id = $code->id;
$isFirst = true;
foreach ($data['l11n'] as $lang => $l11n) {
if ($isFirst) {
$isFirst = false;
continue;
}
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request->header->account = 1;
$request->setData('title', $l11n['title'] ?? '');
$request->setData('short', $l11n['short'] ?? '');
$request->setData('long', $l11n['long'] ?? '');
$request->setData('language', $lang);
$request->setData('code', $id);
$module->apiTaxCodeL11nCreate($request, $response);
}
return $code->toArray();
}
}

View File

@ -1,12 +1,12 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/

View File

@ -1,12 +1,12 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Admin
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@ -20,7 +20,7 @@ use phpOMS\Module\StatusAbstract;
* Status class.
*
* @package Modules\Finance\Admin
* @license OMS License 1.0
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/

View File

@ -1,12 +1,12 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Admin
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@ -20,7 +20,7 @@ use phpOMS\Module\UninstallerAbstract;
* Uninstaller class.
*
* @package Modules\Finance\Admin
* @license OMS License 1.0
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/

View File

@ -1,12 +1,12 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Admin
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@ -20,10 +20,17 @@ use phpOMS\Module\UpdaterAbstract;
* Updater class.
*
* @package Modules\Finance\Admin
* @license OMS License 1.0
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class Updater extends UpdaterAbstract
{
/**
* Path of the file
*
* @var string
* @since 1.0.0
*/
public const PATH = __DIR__;
}

423
Controller/ApiController.php Executable file
View File

@ -0,0 +1,423 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Finance\Controller;
use Modules\Finance\Models\TaxCode;
use Modules\Finance\Models\TaxCodeL11n;
use Modules\Finance\Models\TaxCodeL11nMapper;
use Modules\Finance\Models\TaxCodeMapper;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
/**
* Finance class.
*
* @package Modules\Finance
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class ApiController extends Controller
{
/**
* Validate document create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateTaxCodeCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['abbr'] = !$request->hasData('abbr'))
|| ($val['title'] = !$request->hasData('title'))
) {
return $val;
}
return [];
}
/**
* Api method to create document
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiTaxCodeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateTaxCodeCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$code = $this->createTaxCodeFromRequest($request);
$this->createModel($request->header->account, $code, TaxCodeMapper::class, 'tax_code', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $code);
}
/**
* Method to create task from request.
*
* @param RequestAbstract $request Request
*
* @return TaxCode
*
* @since 1.0.0
*/
private function createTaxCodeFromRequest(RequestAbstract $request) : TaxCode
{
$code = new TaxCode();
$code->abbr = $request->getDataString('abbr') ?? '';
$code->percentageInvoice = $request->getDataInt('percentage_invoice') ?? 0;
$code->percentageSales = $request->getDataInt('percentage_sales_tax') ?? 0;
$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');
}
return $code;
}
/**
* Validate l11n create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateTaxCodeL11nCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['title'] = !$request->hasData('title'))
|| ($val['code'] = !$request->hasData('code'))
) {
return $val;
}
return [];
}
/**
* Api method to create tag localization
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiTaxCodeL11nCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateTaxCodeL11nCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$l11nCode = $this->createTaxCodeL11nFromRequest($request);
$this->createModel($request->header->account, $l11nCode, TaxCodeL11nMapper::class, 'tax_code_l11n', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $l11nCode);
}
/**
* Method to create tag localization from request.
*
* @param RequestAbstract $request Request
*
* @return TaxCodeL11n
*
* @since 1.0.0
*/
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);
return $l11n;
}
/**
* Api method to update TaxCode
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiTaxCodeUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateTaxCodeUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var \Modules\Finance\Models\TaxCode $old */
$old = TaxCodeMapper::get()->where('id', (int) $request->getData('id'))->execute();
$new = $this->updateTaxCodeFromRequest($request, clone $old);
$this->updateModel($request->header->account, $old, $new, TaxCodeMapper::class, 'tax_code', $request->getOrigin());
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Method to update TaxCode from request.
*
* @param RequestAbstract $request Request
* @param TaxCode $new Model to modify
*
* @return TaxCode
*
* @todo: implement
*
* @since 1.0.0
*/
public function updateTaxCodeFromRequest(RequestAbstract $request, TaxCode $new) : TaxCode
{
$new->abbr = $request->getDataString('abbr') ?? $new->abbr;
$new->percentageInvoice = $request->getDataInt('percentage_invoice') ?? $new->percentageInvoice;
$new->percentageSales = $request->getDataInt('percentage_sales_tax') ?? $new->percentageSales;
$new->percentageInput = $request->getDataInt('percentage_input_tax') ?? $new->percentageInput;
return $new;
}
/**
* Validate TaxCode update request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @todo: implement
*
* @since 1.0.0
*/
private function validateTaxCodeUpdate(RequestAbstract $request) : array
{
$val = [];
if (($val['id'] = !$request->hasData('id'))) {
return $val;
}
return [];
}
/**
* Api method to delete TaxCode
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiTaxCodeDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateTaxCodeDelete($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidDeleteResponse($request, $response, $val);
return;
}
/** @var \Modules\Finance\Models\TaxCode $taxCode */
$taxCode = TaxCodeMapper::get()->where('id', (int) $request->getData('id'))->execute();
$this->deleteModel($request->header->account, $taxCode, TaxCodeMapper::class, 'tax_code', $request->getOrigin());
$this->createStandardDeleteResponse($request, $response, $taxCode);
}
/**
* Validate TaxCode delete request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @todo: implement
*
* @since 1.0.0
*/
private function validateTaxCodeDelete(RequestAbstract $request) : array
{
$val = [];
if (($val['id'] = !$request->hasData('id'))) {
return $val;
}
return [];
}
/**
* Api method to update TaxCodeL11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiTaxCodeL11nUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateTaxCodeL11nUpdate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidUpdateResponse($request, $response, $val);
return;
}
/** @var \Modules\Finance\Models\TaxCodeL11n $old */
$old = TaxCodeL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
$new = $this->updateTaxCodeL11nFromRequest($request, clone $old);
$this->updateModel($request->header->account, $old, $new, TaxCodeL11nMapper::class, 'tax_code_l11n', $request->getOrigin());
$this->createStandardUpdateResponse($request, $response, $new);
}
/**
* Method to update TaxCodeL11n from request.
*
* @param RequestAbstract $request Request
* @param TaxCodeL11n $new Model to modify
*
* @return TaxCodeL11n
*
* @todo: implement
*
* @since 1.0.0
*/
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);
return $new;
}
/**
* Validate TaxCodeL11n update request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @todo: implement
*
* @since 1.0.0
*/
private function validateTaxCodeL11nUpdate(RequestAbstract $request) : array
{
$val = [];
if (($val['id'] = !$request->hasData('id'))) {
return $val;
}
return [];
}
/**
* Api method to delete TaxCodeL11n
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiTaxCodeL11nDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateTaxCodeL11nDelete($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidDeleteResponse($request, $response, $val);
return;
}
/** @var \Modules\Finance\Models\TaxCodeL11n $taxCodeL11n */
$taxCodeL11n = TaxCodeL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
$this->deleteModel($request->header->account, $taxCodeL11n, TaxCodeL11nMapper::class, 'tax_code_l11n', $request->getOrigin());
$this->createStandardDeleteResponse($request, $response, $taxCodeL11n);
}
/**
* Validate TaxCodeL11n delete request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @todo: implement
*
* @since 1.0.0
*/
private function validateTaxCodeL11nDelete(RequestAbstract $request) : array
{
$val = [];
if (($val['id'] = !$request->hasData('id'))) {
return $val;
}
return [];
}
}

View File

@ -1,12 +1,12 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Sales
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@ -24,7 +24,7 @@ use phpOMS\Views\View;
* Finance class.
*
* @package Modules\Finance
* @license OMS License 1.0
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
* @codeCoverageIgnore
@ -36,22 +36,24 @@ final class BackendController extends Controller
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param mixed $data Generic data
* @param array $data Generic data
*
* @return RenderableInterface Response can be rendered
*
* @since 1.0.0
*/
public function viewDashboard(RequestAbstract $request, ResponseAbstract $response, mixed $data = null) : RenderableInterface
public function viewDashboard(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
{
$head = $response->get('Content')->getData('head');
$head = $response->data['Content']->head;
$nonce = $this->app->appSettings->getOption('script-nonce');
$head->addAsset(AssetType::CSS, 'Resources/chartjs/Chartjs/chart.css');
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js');
$head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['type' => 'module']);
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/Chartjs/chart.js', ['nonce' => $nonce]);
$head->addAsset(AssetType::JSLATE, 'Modules/ClientManagement/Controller.js', ['nonce' => $nonce, 'type' => 'module']);
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Sales/Theme/Backend/sales-analysis-dashboard');
$view->addData('nav', $this->app->moduleManager->get('Navigation')->createNavigationMid(1001602001, $request, $response));
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1001602001, $request, $response);
/////
$monthlySalesCustomer = [];
@ -64,7 +66,7 @@ final class BackendController extends Controller
];
}
$view->addData('monthlySalesCustomer', $monthlySalesCustomer);
$view->data['monthlySalesCustomer'] = $monthlySalesCustomer;
$annualSalesCustomer = [];
for ($i = 1; $i < 11; ++$i) {
@ -75,7 +77,7 @@ final class BackendController extends Controller
];
}
$view->addData('annualSalesCustomer', $annualSalesCustomer);
$view->data['annualSalesCustomer'] = $annualSalesCustomer;
return $view;
}

View File

@ -1,12 +1,12 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@ -20,7 +20,7 @@ use phpOMS\Module\ModuleAbstract;
* Finance class.
*
* @package Modules\Finance
* @license OMS License 1.0
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
@ -64,7 +64,7 @@ class Controller extends ModuleAbstract
* @var string[]
* @since 1.0.0
*/
protected static array $providing = [];
public static array $providing = [];
/**
* Dependencies.
@ -72,5 +72,5 @@ class Controller extends ModuleAbstract
* @var string[]
* @since 1.0.0
*/
protected static array $dependencies = [];
public static array $dependencies = [];
}

48
LICENSE.txt Executable file
View File

@ -0,0 +1,48 @@
The OMS License
Version 2.0
1. Definitions
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by this entire document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License
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.
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.
4. Submission of Contributions
Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
5. Trademarks
This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work.
6. Disclaimer of Warranty
Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using the Work and assume any risks associated with Your exercise of permissions under this License.
7. Limitation of Liability
In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.

197
Models/EUVATRates.php Executable file
View File

@ -0,0 +1,197 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Finance\Models;
use phpOMS\Stdlib\Base\EnumArray;
/**
* EU VAT rates
*
* @package Modules\Finance\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class EUVATRates extends EnumArray
{
protected static array $constants = [
'_AUT' => [
[2000, 'S'],
[1300, 'R'],
[1000, 'R'],
[0, 'Z'],
],
'_BEL' => [
[2100, 'S'],
[1200, 'R'],
[600, 'R'],
[0, 'Z'],
],
'_BGR' => [
[2000, 'S'],
[2100, 'R'],
[1000, 'R'],
[900, 'R'],
[0, 'Z'],
],
'_HRV' => [
[2500, 'S'],
[1300, 'R'],
[500, 'R'],
[0, 'Z'],
],
'_CYP' => [
[1900, 'S'],
[900, 'R'],
[500, 'R'],
[0, 'Z'],
],
'_CZE' => [
[2100, 'S'],
[1500, 'R'],
[1000, 'R'],
[0, 'Z'],
],
'_DNK' => [
[2500, 'S'],
[0, 'Z'],
],
'_EST' => [
[2000, 'S'],
[900, 'R'],
[0, 'Z'],
],
'_FIN' => [
[2400, 'S'],
[1400, 'R'],
[1000, 'R'],
[0, 'Z'],
],
'_FRA' => [
[2000, 'S'],
[1000, 'R'],
[550, 'R'],
[210, 'R'],
[0, 'Z'],
],
'_DEU' => [
[1900, 'S'],
[700, 'R'],
[0, 'Z'],
],
'_GRC' => [
[2400, 'S'],
[1300, 'R'],
[600, 'R'],
[0, 'Z'],
],
'_HUN' => [
[2700, 'S'],
[1800, 'R'],
[500, 'R'],
[0, 'Z'],
],
'_IRL' => [
[2300, 'S'],
[1350, 'R'],
[900, 'R'],
[480, 'R'],
[0, 'Z'],
],
'_ITA' => [
[2200, 'S'],
[1000, 'R'],
[500, 'R'],
[400, 'R'],
[0, 'Z'],
],
'_LVA' => [
[2100, 'S'],
[1200, 'R'],
[500, 'R'],
[0, 'Z'],
],
'_LTU' => [
[2100, 'S'],
[900, 'R'],
[500, 'R'],
[0, 'Z'],
],
'_LUX' => [
[1700, 'S'],
[1400, 'R'],
[800, 'R'],
[300, 'R'],
[0, 'Z'],
],
'_MLT' => [
[1800, 'S'],
[700, 'R'],
[500, 'R'],
[0, 'Z'],
],
'_NLD' => [
[2100, 'S'],
[900, 'R'],
[0, 'Z'],
],
'_POL' => [
[2300, 'S'],
[800, 'R'],
[500, 'R'],
[0, 'Z'],
],
'_PRT' => [
[2300, 'S'],
[1300, 'R'],
[600, 'R'],
[0, 'Z'],
],
'_ROU' => [
[1900, 'S'],
[900, 'R'],
[500, 'R'],
[0, 'Z'],
],
'_SVK' => [
[2000, 'S'],
[1000, 'R'],
[0, 'Z'],
],
'_SVN' => [
[2200, 'S'],
[950, 'R'],
[500, 'R'],
[0, 'Z'],
],
'_ESP' => [
[2100, 'S'],
[1000, 'R'],
[400, 'R'],
[0, 'Z'],
],
'_SWE' => [
[2500, 'S'],
[1200, 'R'],
[600, 'R'],
[0, 'Z'],
],
'_GBR' => [
[2000, 'S'],
[500, 'R'],
[0, 'Z'],
],
];
}

46
Models/NullTaxCode.php Executable file
View File

@ -0,0 +1,46 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Finance\Models;
/**
* Null model
*
* @package Modules\Finance\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullTaxCode extends TaxCode
{
/**
* Constructor
*
* @param int $id Model id
*
* @since 1.0.0
*/
public function __construct(int $id = 0)
{
$this->id = $id;
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return ['id' => $this->id];
}
}

46
Models/NullTaxCodeL11n.php Executable file
View File

@ -0,0 +1,46 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Finance\Models;
/**
* Null model
*
* @package Modules\Finance\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
final class NullTaxCodeL11n extends TaxCodeL11n
{
/**
* Constructor
*
* @param int $id Model id
*
* @since 1.0.0
*/
public function __construct(int $id = 0)
{
$this->id = $id;
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return ['id' => $this->id];
}
}

View File

@ -1,12 +1,12 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Models
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@ -20,7 +20,7 @@ use phpOMS\Stdlib\Base\Enum;
* Permision state enum.
*
* @package Modules\Finance\Models
* @license OMS License 1.0
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/

78
Models/TaxCode.php Executable file
View File

@ -0,0 +1,78 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Finance\Models;
/**
* Finance class.
*
* @package Modules\Finance\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class TaxCode implements \JsonSerializable
{
/**
* Article ID.
*
* @var int
* @since 1.0.0
*/
public int $id = 0;
public string $abbr = '';
public int $percentageInvoice = 0;
public int $percentageSales = 0;
public int $percentageInput = 0;
/**
* Localization.
*
* @var TaxCodeL11n
* @since 1.0.0
*/
public TaxCodeL11n $l11n;
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
$this->l11n = new TaxCodeL11n();
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

133
Models/TaxCodeL11n.php Executable file
View File

@ -0,0 +1,133 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Finance\Models;
use phpOMS\Localization\ISO639x1Enum;
/**
* Localization of the item class.
*
* @package Modules\Finance\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class TaxCodeL11n implements \JsonSerializable
{
/**
* Article ID.
*
* @var int
* @since 1.0.0
*/
public int $id = 0;
/**
* Tax code ID.
*
* @var int
* @since 1.0.0
*/
public int $code = 0;
/**
* Language.
*
* @var string
* @since 1.0.0
*/
public string $language = ISO639x1Enum::_EN;
/**
* Title.
*
* @var string
* @since 1.0.0
*/
public string $title = '';
/**
* Title.
*
* @var string
* @since 1.0.0
*/
public string $short = '';
/**
* Title.
*
* @var string
* @since 1.0.0
*/
public string $long = '';
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
}
/**
* Get language
*
* @return string
*
* @since 1.0.0
*/
public function getLanguage() : string
{
return $this->language;
}
/**
* Set language
*
* @param string $language Language
*
* @return void
*
* @since 1.0.0
*/
public function setLanguage(string $language) : void
{
$this->language = $language;
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
'title' => $this->title,
'short' => $this->short,
'long' => $this->long,
'language' => $this->language,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

62
Models/TaxCodeL11nMapper.php Executable file
View File

@ -0,0 +1,62 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Finance\Models;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* TaxCode mapper class.
*
* @package Modules\Finance\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of TaxCodeL11n
* @extends DataMapperFactory<T>
*/
final class TaxCodeL11nMapper 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 = [
'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'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'tax_code_l11n';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'tax_code_l11n_id';
}

76
Models/TaxCodeMapper.php Executable file
View File

@ -0,0 +1,76 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Finance\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\Finance\Models;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
/**
* TaxCode mapper class.
*
* @package Modules\Finance\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*
* @template T of TaxCode
* @extends DataMapperFactory<T>
*/
final class TaxCodeMapper 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 = [
'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'],
];
/**
* Primary table.
*
* @var string
* @since 1.0.0
*/
public const TABLE = 'tax_code';
/**
* Primary field name.
*
* @var string
* @since 1.0.0
*/
public const PRIMARYFIELD = 'tax_code_id';
/**
* 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' => TaxCodeL11nMapper::class,
'table' => 'tax_code_l11n',
'self' => 'tax_code_l11n_code',
'external' => null,
],
];
}

0
README.md Normal file → Executable file
View File

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'التحليلات',
'Articles' => 'مقالات',
'Clients' => 'عملاء',
'Create' => 'يخلق',
'Finance' => '',
'Invoice' => 'فاتورة',
'Invoices' => 'الفواتير',
'Items' => '',
'Profile' => 'الملف الشخصي',
'Sales' => 'مبيعات',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Analýza',
'Articles' => 'Články',
'Clients' => 'Klienti',
'Create' => 'Vytvořit',
'Finance' => '',
'Invoice' => 'Faktura',
'Invoices' => 'Faktury',
'Items' => '',
'Profile' => 'Profil',
'Sales' => 'Odbyt',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Analyse',
'Articles' => 'Artikler',
'Clients' => 'Klienter.',
'Create' => 'skab',
'Finance' => '',
'Invoice' => 'Faktura',
'Invoices' => 'Fakturaer.',
'Items' => '',
'Profile' => 'Profil',
'Sales' => 'SALG',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Analyse',
'Articles' => 'Artikel',
'Clients' => 'Kunden',
'Create' => 'Erstellen',
'Finance' => '',
'Invoice' => 'Rechnung',
'Invoices' => 'Rechnungen',
'Items' => '',
'Profile' => 'Profil',
'Sales' => 'Der Umsatz',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Ανάλυση',
'Articles' => 'Είδη',
'Clients' => 'Πελάτες',
'Create' => 'Δημιουργώ',
'Finance' => '',
'Invoice' => 'Τιμολόγιο',
'Invoices' => 'Τιμολόγια',
'Items' => '',
'Profile' => 'Προφίλ',
'Sales' => 'Εκπτώσεις',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => 'Account',
'Analysis' => 'Analysis',
'Articles' => 'Articles',
'Articles' => '',
'Clients' => 'Clients',
'Create' => 'Create',
'Finance' => 'Finance',
'Invoice' => 'Invoice',
'Invoices' => 'Invoices',
'Items' => 'Items',
'Profile' => 'Profile',
'Sales' => 'Sales',
'Suppliers' => 'Suppliers',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Análisis',
'Articles' => 'Artículos',
'Clients' => 'Clientela',
'Create' => 'Crear',
'Finance' => '',
'Invoice' => 'Factura',
'Invoices' => 'Facturas',
'Items' => '',
'Profile' => 'Perfil',
'Sales' => 'Ventas',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Analyysi',
'Articles' => 'Artikkelit',
'Clients' => 'Asiakkaat',
'Create' => 'Luoda',
'Finance' => '',
'Invoice' => 'Lasku',
'Invoices' => 'Laskut',
'Items' => '',
'Profile' => 'Profiili',
'Sales' => 'Myynti',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Analyse',
'Articles' => 'Des articles',
'Clients' => 'Clients',
'Create' => 'Créer',
'Finance' => '',
'Invoice' => 'Facture d\'achat',
'Invoices' => 'Factures',
'Items' => '',
'Profile' => 'Profil',
'Sales' => 'Ventes',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Elemzés',
'Articles' => 'Árucikkek',
'Clients' => 'Kliensek',
'Create' => 'Teremt',
'Finance' => '',
'Invoice' => 'Számla',
'Invoices' => 'Számlák',
'Items' => '',
'Profile' => 'Profil',
'Sales' => 'Értékesítés',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Analisi',
'Articles' => 'Artificio',
'Clients' => 'Clienti',
'Create' => 'Creare',
'Finance' => '',
'Invoice' => 'Fattura',
'Invoices' => 'Fatture',
'Items' => '',
'Profile' => 'Profilo',
'Sales' => 'Saldi',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => '分析',
'Articles' => 'articles',
'Clients' => 'クライアント',
'Create' => '作成',
'Finance' => '',
'Invoice' => '請求書',
'Invoices' => '請求書',
'Items' => '',
'Profile' => 'プロフィール',
'Sales' => '売り返り',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => '분석',
'Articles' => '조항',
'Clients' => '클라이언트',
'Create' => '만들다',
'Finance' => '',
'Invoice' => '송장',
'Invoices' => '송장',
'Items' => '',
'Profile' => '프로필',
'Sales' => '매상',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Analyse',
'Articles' => 'Artikler',
'Clients' => 'Klienter',
'Create' => 'Skape',
'Finance' => '',
'Invoice' => 'Faktura',
'Invoices' => 'Fakturaer',
'Items' => '',
'Profile' => 'Profil',
'Sales' => 'Salg',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Analiza',
'Articles' => 'Artykuły',
'Clients' => 'Klienci.',
'Create' => 'Tworzyć',
'Finance' => '',
'Invoice' => 'Faktura',
'Invoices' => 'Faktury',
'Items' => '',
'Profile' => 'Profil',
'Sales' => 'Obroty',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Análise',
'Articles' => 'Artigos',
'Clients' => 'Clientes',
'Create' => 'Crio',
'Finance' => '',
'Invoice' => 'Fatura',
'Invoices' => 'Faturas',
'Items' => '',
'Profile' => 'Perfil',
'Sales' => 'Vendas',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Анализ',
'Articles' => 'Статьи',
'Clients' => 'Клиенты',
'Create' => 'Создавать',
'Finance' => '',
'Invoice' => 'Счет',
'Invoices' => 'Счета',
'Items' => '',
'Profile' => 'Профиль',
'Sales' => 'Продажи',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Analys',
'Articles' => 'Artiklar',
'Clients' => 'Klienter',
'Create' => 'Skapa',
'Finance' => '',
'Invoice' => 'Faktura',
'Invoices' => 'Fakturor',
'Items' => '',
'Profile' => 'Profil',
'Sales' => 'Försäljning',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'การวิเคราะห์',
'Articles' => 'บทความ',
'Clients' => 'ลูกค้า',
'Create' => 'สร้าง',
'Finance' => '',
'Invoice' => 'ใบแจ้งหนี้',
'Invoices' => 'ใบแจ้งหนี้',
'Items' => '',
'Profile' => 'ประวัติโดยย่อ',
'Sales' => 'ฝ่ายขาย',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Analiz',
'Articles' => 'Nesne',
'Clients' => 'Müşteriler',
'Create' => 'Yaratmak',
'Finance' => '',
'Invoice' => 'Fatura',
'Invoices' => 'Faturalar',
'Items' => '',
'Profile' => 'Profil',
'Sales' => 'Satış',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => 'Аналіз',
'Articles' => 'Статті',
'Clients' => 'Клієнти',
'Create' => 'Створювати',
'Finance' => '',
'Invoice' => 'Рахунок-фактура',
'Invoices' => 'Рахунки-фактури',
'Items' => '',
'Profile' => 'Профіль',
'Sales' => 'Продаж',
'Suppliers' => '',
]];

View File

@ -1,24 +1,28 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Navigation' => [
'Account' => '',
'Analysis' => '分析',
'Articles' => '文章',
'Clients' => '客户',
'Create' => '创建',
'Finance' => '',
'Invoice' => '发票',
'Invoices' => '发票',
'Items' => '',
'Profile' => '轮廓',
'Sales' => '销售量',
'Suppliers' => '',
]];

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'الحساب',
'Active' => 'نشيط',
'Activity' => 'نشاط',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Účet',
'Active' => 'Aktivní',
'Activity' => 'Aktivita',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Konto',
'Active' => 'Aktiv',
'Activity' => 'Aktivitet',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Konto',
'Active' => 'Aktiv',
'Activity' => 'Aktivität',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'λογαριασμός',
'Active' => 'Ενεργός',
'Activity' => 'Δραστηριότητα',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Account',
'Active' => 'Active',
'Activity' => 'Activity',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Cuenta',
'Active' => 'Activo',
'Activity' => 'Actividad',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Tili',
'Active' => 'Aktiivinen',
'Activity' => 'Toiminta',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Compte',
'Active' => 'actif',
'Activity' => 'Activité',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Számla',
'Active' => 'Aktív',
'Activity' => 'Tevékenység',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Account',
'Active' => 'Attivo',
'Activity' => 'Attività',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'アカウント',
'Active' => 'アクティブ',
'Activity' => 'アクティビティ',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => '계정',
'Active' => '활동적인',
'Activity' => '활동',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Regnskap',
'Active' => 'Aktiv',
'Activity' => 'Aktivitet',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Rachunek',
'Active' => 'Aktywny',
'Activity' => 'Czynność',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Conta',
'Active' => 'Ativo',
'Activity' => 'Atividade',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Счет',
'Active' => 'Активный',
'Activity' => 'Мероприятия',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'konto',
'Active' => 'Aktiva',
'Activity' => 'Aktivitet',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'บัญชี',
'Active' => 'คล่องแคล่ว',
'Activity' => 'กิจกรรม',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Hesap',
'Active' => 'Aktif',
'Activity' => 'Aktivite',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => 'Обліковий запис',
'Active' => 'Активний',
'Activity' => 'Діяльність',

View File

@ -1,18 +1,18 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Localization
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
return ['Sales' => [
return ['Finance' => [
'Account' => '帐户',
'Active' => '积极的',
'Activity' => '活动',

View File

@ -1,12 +1,12 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules\Billing
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@ -18,7 +18,7 @@ use phpOMS\Localization\Money;
* @var \phpOMS\Views\View $this
*/
echo $this->getData('nav')->render();
echo $this->data['nav']->render();
?>
<div class="row">
@ -119,7 +119,7 @@ echo $this->getData('nav')->render();
Sales / Profit - Monthly
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $salesCustomer = $this->getData('monthlySalesCustomer'); ?>
<?php $salesCustomer = $this->data['monthlySalesCustomer']; ?>
<div class="portlet-body">
<canvas id="sales-region" data-chart='{
"type": "bar",
@ -223,7 +223,7 @@ echo $this->getData('nav')->render();
?>
<tr>
<td><?= $values['month'] . '/' . \substr((string) $values['year'], -2); ?>
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
<td><?= ((int) $values['customers']); ?>
<?php endforeach; ?>
<tr>
@ -243,7 +243,7 @@ echo $this->getData('nav')->render();
Sales / Profit - Annual
<?php include __DIR__ . '/../../../../Web/Backend/Themes/popup-export-data.tpl.php'; ?>
</div>
<?php $salesCustomer = $this->getData('annualSalesCustomer'); ?>
<?php $salesCustomer = $this->data['annualSalesCustomer']; ?>
<div class="portlet-body">
<canvas id="sales-customer-annual" data-chart='{
"type": "bar",
@ -343,7 +343,7 @@ echo $this->getData('nav')->render();
?>
<tr>
<td><?= (string) $values['year']; ?>
<td><?= (new Money(((int) $values['net_sales']) / 1000))->getCurrency(); ?>
<td><?= (new Money(((int) $values['net_sales']) / 10000))->getCurrency(); ?>
<td><?= ((int) $values['customers']); ?>
<?php endforeach; ?>
</table>

View File

@ -1,6 +1,6 @@
{
"name": "karaka/karaka",
"description": "PHP Framework for Karaka.",
"description": "PHP Framework for Jingga.",
"authors": [
{
"name": "Dennis Eichhorn",
@ -13,7 +13,10 @@
"squizlabs/php_codesniffer": ">=3.6",
"phpmd/phpmd": ">=2.9",
"phpstan/phpstan": ">=1.8.6",
"phan/phan": ">=3.2.6"
"phan/phan": ">=3.2.6",
"phploc/phploc": ">=7.0",
"phpmetrics/phpmetrics": ">=2.8",
"rector/rector": ">=0.18.0"
},
"minimum-stability": "dev",
"prefer-stable": true

1410
composer.lock generated

File diff suppressed because it is too large Load Diff

BIN
img/module_teaser_small.png Executable file → Normal file

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

@ -11,7 +11,7 @@
"phpOMS-db": "1.0.0"
},
"creator": {
"name": "Karaka",
"name": "Jingga",
"website": "jingga.app"
},
"description": "Finance module.",

View File

@ -1,12 +1,12 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package tests
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
@ -21,7 +21,7 @@ final class AdminTest extends \PHPUnit\Framework\TestCase
{
protected const NAME = 'Finance';
protected const URI_LOAD = '';
protected const URI_LOAD = 'http://127.0.0.1/en/backend/finance';
use \Modules\tests\ModuleTestTrait;
use \tests\Modules\ModuleTestTrait;
}

View File

@ -1,26 +1,26 @@
<?php
/**
* Karaka
* Jingga
*
* PHP Version 8.1
*
* @package Modules/tests
* @copyright Dennis Eichhorn
* @license OMS License 1.0
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace tests;
namespace Modules\Finance\tests;
\spl_autoload_register('\tests\Autoloader::defaultAutoloader');
\spl_autoload_register('\Modules\Finance\tests\Autoloader::defaultAutoloader');
/**
* Autoloader class.
*
* @package tests
* @license OMS License 1.0
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
@ -34,7 +34,7 @@ final class Autoloader
*/
private static $paths = [
__DIR__ . '/../',
__DIR__ . '/../Karaka/',
__DIR__ . '/../MainRepository/',
__DIR__ . '/../../',
];
@ -59,7 +59,7 @@ final class Autoloader
*/
public static function addPath(string $path) : void
{
self::$paths[] = $path;
self::$paths[] = \rtrim($path, '/\\') . '/';
}
/**
@ -71,20 +71,37 @@ final class Autoloader
*
* @return void
*
* @throws AutoloadException Throws this exception if the class to autoload doesn't exist. This could also be related to a wrong namespace/file path correlation.
*
* @since 1.0.0
*/
public static function defaultAutoloader(string $class) : void
{
$class = \ltrim($class, '\\');
$class = \str_replace(['_', '\\'], '/', $class);
$class = \strtr($class, '_\\', '//');
if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) {
$class = \is_dir(__DIR__ . '/Web') ? $class : \str_replace('Web/', 'Karaka/Web/', $class);
}
$class2 = $class;
$class3 = $class;
$pos = \stripos($class, '/');
if ($pos !== false) {
$class3 = \substr($class, $pos + 1);
$pos = \stripos($class, '/', $pos + 1);
if ($pos !== false) {
$class2 = \substr($class, $pos + 1);
}
}
foreach (self::$paths as $path) {
$file = $path . $class . '.php';
$file = \str_replace('/Modules/', '/', $file);
if (($file = \realpath($path . $class2 . '.php')) !== false && \stripos($file, $class3) !== false) {
include_once $file;
if (\is_file($file)) {
return;
} elseif (\is_file($file = $path . $class . '.php')) {
include_once $file;
return;

View File

@ -1,8 +1,6 @@
<?php
declare(strict_types=1);
// Modules/tests
\ini_set('memory_limit', '2048M');
\ini_set('display_errors', '1');
\ini_set('display_startup_errors', '1');
@ -15,6 +13,55 @@ require_once __DIR__ . '/Autoloader.php';
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\DataStorage\Session\HttpSession;
use phpOMS\Log\FileLogger;
$IS_GITHUB = false;
$temp = \array_keys($_SERVER);
foreach ($temp as $key) {
if (\is_string($key) && \stripos(\strtolower($key), 'github') !== false) {
$IS_GITHUB = true;
break;
}
}
if (!$IS_GITHUB) {
foreach ($_SERVER as $value) {
if (\is_string($value) && \stripos(\strtolower($value), 'github') !== false) {
$IS_GITHUB = true;
break;
}
}
}
$temp = \array_keys(\getenv());
if (!$IS_GITHUB) {
foreach ($temp as $key) {
if (\is_string($key) && \stripos(\strtolower($key), 'github') !== false) {
$IS_GITHUB = true;
break;
}
}
}
$temp = \array_values(\getenv());
if (!$IS_GITHUB) {
foreach ($temp as $value) {
if (\is_string($value) && \stripos(\strtolower($value), 'github') !== false) {
$IS_GITHUB = true;
break;
}
}
}
$GLOBALS['is_github'] = $IS_GITHUB;
// Initialize file logger with correct path
$tmp = FileLogger::getInstance(__DIR__ . '/../Logs');
$CONFIG = [
'db' => [
@ -28,6 +75,7 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'insert' => [
'db' => 'mysql', /* db type */
@ -37,6 +85,7 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'select' => [
'db' => 'mysql', /* db type */
@ -46,6 +95,7 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'update' => [
'db' => 'mysql', /* db type */
@ -55,6 +105,7 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'delete' => [
'db' => 'mysql', /* db type */
@ -64,6 +115,7 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'schema' => [
'db' => 'mysql', /* db type */
@ -73,6 +125,7 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
],
'postgresql' => [
@ -84,6 +137,7 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'insert' => [
'db' => 'pgsql', /* db type */
@ -93,6 +147,7 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'select' => [
'db' => 'pgsql', /* db type */
@ -102,6 +157,7 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'update' => [
'db' => 'pgsql', /* db type */
@ -111,6 +167,7 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'delete' => [
'db' => 'pgsql', /* db type */
@ -120,6 +177,7 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'schema' => [
'db' => 'pgsql', /* db type */
@ -129,38 +187,45 @@ $CONFIG = [
'password' => 'root', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
],
'sqlite' => [
'admin' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/test.sqlite', /* db name */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'insert' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/test.sqlite', /* db name */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'select' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/test.sqlite', /* db name */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'update' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/test.sqlite', /* db name */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'delete' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/test.sqlite', /* db name */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'schema' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/test.sqlite', /* db name */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
],
'mssql' => [
@ -169,54 +234,60 @@ $CONFIG = [
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
'login' => 'sa', /* db login name */
'password' => 'R00troot', /* db login password */
'password' => 'c0MplicatedP@ssword', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'insert' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
'login' => 'sa', /* db login name */
'password' => 'R00troot', /* db login password */
'password' => 'c0MplicatedP@ssword', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'select' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
'login' => 'sa', /* db login name */
'password' => 'R00troot', /* db login password */
'password' => 'c0MplicatedP@ssword', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'update' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
'login' => 'sa', /* db login name */
'password' => 'R00troot', /* db login password */
'password' => 'c0MplicatedP@ssword', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'delete' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
'login' => 'sa', /* db login name */
'password' => 'R00troot', /* db login password */
'password' => 'c0MplicatedP@ssword', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'schema' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
'login' => 'sa', /* db login name */
'password' => 'R00troot', /* db login password */
'password' => 'c0MplicatedP@ssword', /* db login password */
'database' => 'oms', /* db name */
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
],
],
@ -302,7 +373,7 @@ if (\defined('RESET') && RESET === '1') {
$db->exec('DROP DATABASE IF EXISTS ' . $CONFIG['db']['core']['masters']['admin']['database']);
$db->exec('CREATE DATABASE IF NOT EXISTS ' . $CONFIG['db']['core']['masters']['admin']['database']);
$db = null;
} catch (\Throwable $t) {
} catch (\Throwable $_) {
echo "\nCouldn't connect to MYSQL DB\n";
}
}
@ -317,7 +388,7 @@ if (\defined('RESET') && RESET === '1') {
$db->exec('DROP DATABASE IF EXISTS ' . $CONFIG['db']['core']['postgresql']['admin']['database']);
$db->exec('CREATE DATABASE ' . $CONFIG['db']['core']['postgresql']['admin']['database']);
$db = null;
} catch (\Throwable $t) {
} catch (\Throwable $_) {
echo "\nCouldn't connect to POSTGRESQL DB\n";
}
}
@ -332,7 +403,7 @@ if (\defined('RESET') && RESET === '1') {
$db->exec('DROP DATABASE IF EXISTS ' . $CONFIG['db']['core']['mssql']['admin']['database']);
$db->exec('CREATE DATABASE ' . $CONFIG['db']['core']['mssql']['admin']['database']);
$db = null;
} catch (\Throwable $t) {
} catch (\Throwable $_) {
echo "\nCouldn't connect to MSSQL DB\n";
}
}
@ -344,9 +415,9 @@ $GLOBALS['session'] = $httpSession;
$GLOBALS['dbpool'] = new DatabasePool();
$GLOBALS['dbpool']->create('admin', $CONFIG['db']['core']['masters']['admin']);
$GLOBALS['dbpool']->create('select', $CONFIG['db']['core']['masters']['select']);
$GLOBALS['dbpool']->create('insert', $CONFIG['db']['core']['masters']['insert']);
$GLOBALS['dbpool']->create('update', $CONFIG['db']['core']['masters']['update']);
$GLOBALS['dbpool']->create('delete', $CONFIG['db']['core']['masters']['delete']);
$GLOBALS['dbpool']->create('insert', $CONFIG['db']['core']['masters']['insert']);
$GLOBALS['dbpool']->create('schema', $CONFIG['db']['core']['masters']['schema']);
DataMapperFactory::db($GLOBALS['dbpool']->get());
@ -381,7 +452,7 @@ function phpServe() : void
// Execute the command and store the process ID
$output = [];
echo \sprintf('Starting server...') . \PHP_EOL;
echo 'Starting server...' . \PHP_EOL;
echo \sprintf(' Current directory: %s', \getcwd()) . \PHP_EOL;
echo \sprintf(' %s', $command);
\exec($command, $output);
@ -406,10 +477,14 @@ function phpServe() : void
// Kill the web server when the process ends
\register_shutdown_function(function() use ($killCommand, $pid) : void {
echo \PHP_EOL . \sprintf('Stopping server...') . \PHP_EOL;
echo \PHP_EOL . 'Stopping server...' . \PHP_EOL;
echo \sprintf(' %s - Killing process with ID %d', \date('r'), $pid) . \PHP_EOL;
\exec($killCommand . $pid);
});
}
try {
\phpServe();
} catch(\Throwable $t) {
echo $t->getMessage();
}

View File

@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="Bootstrap.php" colors="true" columns="120" stopOnError="true" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false" beStrictAboutTestsThatDoNotTestAnything="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage includeUncoveredFiles="true" processUncoveredFiles="false">
<include>
<directory suffix=".php">../</directory>
</include>
<exclude>
<directory>*vendor*</directory>
<directory>vendor</directory>
<directory>../vendor</directory>
<directory>../phpOMS</directory>
<directory>../vendor*</directory>
<directory>../MainRepository*</directory>
<directory>../Admin/Install/Application*</directory>
<directory>../phpOMS*</directory>
<directory>../phpOMS/*</directory>
<directory>../tests*</directory>
<directory>../*/tests*</directory>
<directory>../**/tests*</directory>
@ -31,7 +32,7 @@
</coverage>
<testsuites>
<testsuite name="Install">
<directory>../Karaka/Install/tests*</directory>
<directory>../MainRepository/Install/tests*</directory>
</testsuite>
<testsuite name="Module">
<directory>../tests*</directory>
@ -51,7 +52,7 @@
<php>
<const name="WEB_SERVER_HOST" value="localhost"/>
<const name="WEB_SERVER_PORT" value="1234"/>
<const name="WEB_SERVER_DOCROOT" value="./"/>
<const name="WEB_SERVER_DOCROOT" value="./Karaka"/>
<const name="RESET" value="1"/>
</php>
</phpunit>