mirror of
https://github.com/Karaka-Management/oms-ContractManagement.git
synced 2026-01-11 17:48:40 +00:00
commit
0a37de6f58
35
.github/dev_bug_report.md
vendored
Executable file
35
.github/dev_bug_report.md
vendored
Executable file
|
|
@ -0,0 +1,35 @@
|
|||
---
|
||||
name: Dev Bug Report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: stat_backlog, type_bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Bug Description
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
# How to Reproduce
|
||||
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
## Minimal Code Example
|
||||
|
||||
```
|
||||
// your code ...
|
||||
```
|
||||
|
||||
# Expected Behavior
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
# Screenshots
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
# Additional Information
|
||||
Add any other context about the problem here.
|
||||
18
.github/dev_feature_request.md
vendored
Executable file
18
.github/dev_feature_request.md
vendored
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
name: Dev Feature Request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: stat_backlog, type_feature
|
||||
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.
|
||||
40
.github/user_bug_report.md
vendored
Executable file
40
.github/user_bug_report.md
vendored
Executable file
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
name: User Bug Report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: stat_backlog, type_bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
# Bug Description
|
||||
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
# How to Reproduce
|
||||
|
||||
Steps to reproduce the behavior:
|
||||
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
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.
|
||||
21
.github/user_feature_request.md
vendored
Executable file
21
.github/user_feature_request.md
vendored
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
---
|
||||
name: User Feature Request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: stat_backlog, type_feature
|
||||
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.
|
||||
13
.github/workflows/greetings.yml
vendored
Executable file
13
.github/workflows/greetings.yml
vendored
Executable file
|
|
@ -0,0 +1,13 @@
|
|||
name: Greetings
|
||||
|
||||
on: [pull_request, issues]
|
||||
|
||||
jobs:
|
||||
greeting:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/first-interaction@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message: 'Thank you for createing this issue. We will check it as soon as possible.'
|
||||
pr-message: 'Thank you for your pull request. We will check it as soon as possible.'
|
||||
10
.github/workflows/image.yml
vendored
Executable file
10
.github/workflows/image.yml
vendored
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
name: Image optimization
|
||||
|
||||
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 }}
|
||||
20
.github/workflows/main.yml
vendored
Executable file
20
.github/workflows/main.yml
vendored
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
schedule:
|
||||
- cron: '0 0 1,15 * *'
|
||||
|
||||
jobs:
|
||||
general_module_workflow:
|
||||
uses: Karaka-Management/Karaka/.github/workflows/php_template.yml@develop
|
||||
secrets:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_PAT: ${{ secrets.GH_PAT }}
|
||||
15
.gitignore
vendored
Normal file
15
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
Build
|
||||
*.cache
|
||||
.directory
|
||||
Vagrantfile
|
||||
vendor
|
||||
bower_components
|
||||
node_modules
|
||||
*.log
|
||||
.vagrant
|
||||
.vscode
|
||||
.sass-cache
|
||||
cache
|
||||
Cache
|
||||
Libraries
|
||||
.idea
|
||||
25
Admin/Install/Admin.install.php
Executable file
25
Admin/Install/Admin.install.php
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\ContractManagement\Controller\ApiController;
|
||||
use Modules\ContractManagement\Models\SettingsEnum;
|
||||
|
||||
return [
|
||||
[
|
||||
'type' => 'setting',
|
||||
'name' => SettingsEnum::CONTRACT_RENEWAL_WARNING,
|
||||
'content' => '7776000',
|
||||
'module' => ApiController::NAME,
|
||||
],
|
||||
];
|
||||
16
Admin/Install/Media.install.json
Executable file
16
Admin/Install/Media.install.json
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
[
|
||||
{
|
||||
"type": "type",
|
||||
"name": "contract",
|
||||
"l11n": [
|
||||
{
|
||||
"title": "Contract",
|
||||
"lang": "en"
|
||||
},
|
||||
{
|
||||
"title": "Vertrag",
|
||||
"lang": "de"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
43
Admin/Install/Media.php
Executable file
43
Admin/Install/Media.php
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin\Install
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Admin\Install;
|
||||
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
|
||||
/**
|
||||
* Media class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin\Install
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Media
|
||||
{
|
||||
/**
|
||||
* Install media providing
|
||||
*
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param string $path Module path
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function install(ApplicationAbstract $app, string $path) : void
|
||||
{
|
||||
\Modules\Media\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Media.install.json']);
|
||||
}
|
||||
}
|
||||
48
Admin/Install/Navigation.install.json
Executable file
48
Admin/Install/Navigation.install.json
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
[
|
||||
{
|
||||
"id": 1007901001,
|
||||
"pid": "/",
|
||||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Contract",
|
||||
"uri": "{/base}/contract/list?{?}",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 45,
|
||||
"from": "Kanban",
|
||||
"permission": { "permission": 2, "category": null, "element": null },
|
||||
"parent": 1003301001,
|
||||
"children": [
|
||||
{
|
||||
"id": 1007902001,
|
||||
"pid": "/contract",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Contracts",
|
||||
"uri": "{/base}/contract/list?{?}",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
"from": "Kanban",
|
||||
"permission": { "permission": 2, "category": null, "element": null },
|
||||
"parent": 1007901001,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"id": 1007903001,
|
||||
"pid": "/contract",
|
||||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "ContractTypes",
|
||||
"uri": "{/base}/contract/type/list?{?}",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
"from": "Kanban",
|
||||
"permission": { "permission": 2, "category": null, "element": null },
|
||||
"parent": 1007901001,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
43
Admin/Install/Navigation.php
Executable file
43
Admin/Install/Navigation.php
Executable file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin\Install
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Admin\Install;
|
||||
|
||||
use phpOMS\Application\ApplicationAbstract;
|
||||
|
||||
/**
|
||||
* Navigation class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin\Install
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Navigation
|
||||
{
|
||||
/**
|
||||
* Install navigation providing
|
||||
*
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param string $path Module path
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function install(ApplicationAbstract $app, string $path) : void
|
||||
{
|
||||
\Modules\Navigation\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Navigation.install.json']);
|
||||
}
|
||||
}
|
||||
444
Admin/Install/db.json
Executable file
444
Admin/Install/db.json
Executable file
|
|
@ -0,0 +1,444 @@
|
|||
{
|
||||
"contractmgmt_type": {
|
||||
"name": "contractmgmt_type",
|
||||
"fields": {
|
||||
"contractmgmt_type_id": {
|
||||
"name": "contractmgmt_type_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"contractmgmt_type_name": {
|
||||
"name": "contractmgmt_type_name",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"contractmgmt_type_l11n": {
|
||||
"name": "contractmgmt_type_l11n",
|
||||
"fields": {
|
||||
"contractmgmt_type_l11n_id": {
|
||||
"name": "contractmgmt_type_l11n_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"contractmgmt_type_l11n_title": {
|
||||
"name": "contractmgmt_type_l11n_title",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_type_l11n_type": {
|
||||
"name": "contractmgmt_type_l11n_type",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "contractmgmt_type",
|
||||
"foreignKey": "contractmgmt_type_id"
|
||||
},
|
||||
"contractmgmt_type_l11n_lang": {
|
||||
"name": "contractmgmt_type_l11n_lang",
|
||||
"type": "VARCHAR(2)",
|
||||
"null": false,
|
||||
"foreignTable": "language",
|
||||
"foreignKey": "language_639_1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"contractmgmt_contract": {
|
||||
"name": "contractmgmt_contract",
|
||||
"fields": {
|
||||
"contractmgmt_contract_id": {
|
||||
"name": "contractmgmt_contract_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"contractmgmt_contract_template": {
|
||||
"name": "contractmgmt_contract_template",
|
||||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_contract_title": {
|
||||
"name": "contractmgmt_contract_title",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_contract_description": {
|
||||
"name": "contractmgmt_contract_description",
|
||||
"type": "TEXT",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_contract_account": {
|
||||
"name": "contractmgmt_contract_account",
|
||||
"type": "INT",
|
||||
"null": true,
|
||||
"foreignTable": "account",
|
||||
"foreignKey": "account_id"
|
||||
},
|
||||
"contractmgmt_contract_startoriginal": {
|
||||
"name": "contractmgmt_contract_startoriginal",
|
||||
"type": "DATETIME",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_contract_start": {
|
||||
"name": "contractmgmt_contract_start",
|
||||
"type": "DATETIME",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_contract_end": {
|
||||
"name": "contractmgmt_contract_end",
|
||||
"type": "DATETIME",
|
||||
"null": true,
|
||||
"default": null
|
||||
},
|
||||
"contractmgmt_contract_costs": {
|
||||
"name": "contractmgmt_contract_costs",
|
||||
"type": "BIGINT",
|
||||
"null": true,
|
||||
"default": null
|
||||
},
|
||||
"contractmgmt_contract_renewal": {
|
||||
"name": "contractmgmt_contract_renewal",
|
||||
"type": "INT",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_contract_autorenewal": {
|
||||
"name": "contractmgmt_contract_autorenewal",
|
||||
"type": "TINYINT",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_contract_duration": {
|
||||
"name": "contractmgmt_contract_duration",
|
||||
"type": "INT",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_contract_warning": {
|
||||
"name": "contractmgmt_contract_warning",
|
||||
"type": "INT",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_contract_type": {
|
||||
"name": "contractmgmt_contract_type",
|
||||
"type": "INT",
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "contractmgmt_type",
|
||||
"foreignKey": "contractmgmt_type_id"
|
||||
},
|
||||
"contractmgmt_contract_parent": {
|
||||
"name": "contractmgmt_contract_parent",
|
||||
"type": "INT",
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "contractmgmt_contract",
|
||||
"foreignKey": "contractmgmt_contract_id"
|
||||
},
|
||||
"contractmgmt_contract_unit": {
|
||||
"name": "contractmgmt_contract_unit",
|
||||
"type": "INT",
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "unit",
|
||||
"foreignKey": "unit_id"
|
||||
},
|
||||
"contractmgmt_contract_responsible": {
|
||||
"name": "contractmgmt_contract_responsible",
|
||||
"type": "INT",
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "account",
|
||||
"foreignKey": "account_id"
|
||||
},
|
||||
"contractmgmt_contract_created_at": {
|
||||
"name": "contractmgmt_contract_created_at",
|
||||
"type": "DATETIME",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"contractmgmt_contract_media": {
|
||||
"name": "contractmgmt_contract_media",
|
||||
"fields": {
|
||||
"contractmgmt_contract_media_id": {
|
||||
"name": "contractmgmt_contract_media_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"contractmgmt_contract_media_contract": {
|
||||
"name": "contractmgmt_contract_media_contract",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "contractmgmt_contract",
|
||||
"foreignKey": "contractmgmt_contract_id"
|
||||
},
|
||||
"contractmgmt_contract_media_media": {
|
||||
"name": "contractmgmt_contract_media_media",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "media",
|
||||
"foreignKey": "media_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
"contractmgmt_contract_note": {
|
||||
"name": "contractmgmt_contract_note",
|
||||
"fields": {
|
||||
"contractmgmt_contract_note_id": {
|
||||
"name": "contractmgmt_contract_note_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"contractmgmt_contract_note_contract": {
|
||||
"name": "contractmgmt_contract_note_contract",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "contractmgmt_contract",
|
||||
"foreignKey": "contractmgmt_contract_id"
|
||||
},
|
||||
"contractmgmt_contract_note_doc": {
|
||||
"name": "contractmgmt_contract_note_doc",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"foreignTable": "editor_doc",
|
||||
"foreignKey": "editor_doc_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
"contractmgmt_attr_type": {
|
||||
"name": "contractmgmt_attr_type",
|
||||
"fields": {
|
||||
"contractmgmt_attr_type_id": {
|
||||
"name": "contractmgmt_attr_type_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"contractmgmt_attr_type_name": {
|
||||
"name": "contractmgmt_attr_type_name",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false,
|
||||
"unique": true
|
||||
},
|
||||
"contractmgmt_attr_type_datatype": {
|
||||
"name": "contractmgmt_attr_type_datatype",
|
||||
"type": "INT(11)",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_attr_type_fields": {
|
||||
"name": "contractmgmt_attr_type_fields",
|
||||
"type": "INT(11)",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_attr_type_custom": {
|
||||
"name": "contractmgmt_attr_type_custom",
|
||||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_attr_type_required": {
|
||||
"description": "Every contract must have this attribute type if set to true.",
|
||||
"name": "contractmgmt_attr_type_required",
|
||||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_attr_type_pattern": {
|
||||
"description": "This is a regex validation pattern.",
|
||||
"name": "contractmgmt_attr_type_pattern",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"contractmgmt_attr_type_l11n": {
|
||||
"name": "contractmgmt_attr_type_l11n",
|
||||
"fields": {
|
||||
"contractmgmt_attr_type_l11n_id": {
|
||||
"name": "contractmgmt_attr_type_l11n_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"contractmgmt_attr_type_l11n_title": {
|
||||
"name": "contractmgmt_attr_type_l11n_title",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_attr_type_l11n_type": {
|
||||
"name": "contractmgmt_attr_type_l11n_type",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "contractmgmt_attr_type",
|
||||
"foreignKey": "contractmgmt_attr_type_id"
|
||||
},
|
||||
"contractmgmt_attr_type_l11n_lang": {
|
||||
"name": "contractmgmt_attr_type_l11n_lang",
|
||||
"type": "VARCHAR(2)",
|
||||
"null": false,
|
||||
"foreignTable": "language",
|
||||
"foreignKey": "language_639_1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"contractmgmt_attr_value": {
|
||||
"name": "contractmgmt_attr_value",
|
||||
"fields": {
|
||||
"contractmgmt_attr_value_id": {
|
||||
"name": "contractmgmt_attr_value_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"contractmgmt_attr_value_default": {
|
||||
"name": "contractmgmt_attr_value_default",
|
||||
"type": "TINYINT(1)",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_attr_value_valueStr": {
|
||||
"name": "contractmgmt_attr_value_valueStr",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": true,
|
||||
"default": null
|
||||
},
|
||||
"contractmgmt_attr_value_valueInt": {
|
||||
"name": "contractmgmt_attr_value_valueInt",
|
||||
"type": "INT(11)",
|
||||
"null": true,
|
||||
"default": null
|
||||
},
|
||||
"contractmgmt_attr_value_valueDec": {
|
||||
"name": "contractmgmt_attr_value_valueDec",
|
||||
"type": "DECIMAL(19,5)",
|
||||
"null": true,
|
||||
"default": null
|
||||
},
|
||||
"contractmgmt_attr_value_valueDat": {
|
||||
"name": "contractmgmt_attr_value_valueDat",
|
||||
"type": "DATETIME",
|
||||
"null": true,
|
||||
"default": null
|
||||
},
|
||||
"contractmgmt_attr_value_unit": {
|
||||
"name": "contractmgmt_attr_value_unit",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_attr_value_deptype": {
|
||||
"name": "contractmgmt_attr_value_deptype",
|
||||
"type": "INT(11)",
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "contractmgmt_attr_type",
|
||||
"foreignKey": "contractmgmt_attr_type_id"
|
||||
},
|
||||
"contractmgmt_attr_value_depvalue": {
|
||||
"name": "contractmgmt_attr_value_depvalue",
|
||||
"type": "INT(11)",
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "contractmgmt_attr_value",
|
||||
"foreignKey": "contractmgmt_attr_value_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
"contractmgmt_attr_value_l11n": {
|
||||
"name": "contractmgmt_attr_value_l11n",
|
||||
"fields": {
|
||||
"contractmgmt_attr_value_l11n_id": {
|
||||
"name": "contractmgmt_attr_value_l11n_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"contractmgmt_attr_value_l11n_title": {
|
||||
"name": "contractmgmt_attr_value_l11n_title",
|
||||
"type": "VARCHAR(255)",
|
||||
"null": false
|
||||
},
|
||||
"contractmgmt_attr_value_l11n_value": {
|
||||
"name": "contractmgmt_attr_value_l11n_value",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "contractmgmt_attr_value",
|
||||
"foreignKey": "contractmgmt_attr_value_id"
|
||||
},
|
||||
"contractmgmt_attr_value_l11n_lang": {
|
||||
"name": "contractmgmt_attr_value_l11n_lang",
|
||||
"type": "VARCHAR(2)",
|
||||
"null": false,
|
||||
"foreignTable": "language",
|
||||
"foreignKey": "language_639_1"
|
||||
}
|
||||
}
|
||||
},
|
||||
"contractmgmt_contract_attr_default": {
|
||||
"name": "contractmgmt_contract_attr_default",
|
||||
"fields": {
|
||||
"contractmgmt_contract_attr_default_id": {
|
||||
"name": "contractmgmt_contract_attr_default_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"contractmgmt_contract_attr_default_type": {
|
||||
"name": "contractmgmt_contract_attr_default_type",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "contractmgmt_attr_type",
|
||||
"foreignKey": "contractmgmt_attr_type_id"
|
||||
},
|
||||
"contractmgmt_contract_attr_default_value": {
|
||||
"name": "contractmgmt_contract_attr_default_value",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "contractmgmt_attr_value",
|
||||
"foreignKey": "contractmgmt_attr_value_id"
|
||||
}
|
||||
}
|
||||
},
|
||||
"contractmgmt_contract_attr": {
|
||||
"name": "contractmgmt_contract_attr",
|
||||
"fields": {
|
||||
"contractmgmt_contract_attr_id": {
|
||||
"name": "contractmgmt_contract_attr_id",
|
||||
"type": "INT",
|
||||
"null": false,
|
||||
"primary": true,
|
||||
"autoincrement": true
|
||||
},
|
||||
"contractmgmt_contract_attr_contract": {
|
||||
"name": "contractmgmt_contract_attr_contract",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "contractmgmt_contract",
|
||||
"foreignKey": "contractmgmt_contract_id"
|
||||
},
|
||||
"contractmgmt_contract_attr_type": {
|
||||
"name": "contractmgmt_contract_attr_type",
|
||||
"type": "INT(11)",
|
||||
"null": false,
|
||||
"foreignTable": "contractmgmt_attr_type",
|
||||
"foreignKey": "contractmgmt_attr_type_id"
|
||||
},
|
||||
"contractmgmt_contract_attr_value": {
|
||||
"name": "contractmgmt_contract_attr_value",
|
||||
"type": "INT(11)",
|
||||
"null": true,
|
||||
"default": null,
|
||||
"foreignTable": "contractmgmt_attr_value",
|
||||
"foreignKey": "contractmgmt_attr_value_id"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
58
Admin/Install/types.json
Executable file
58
Admin/Install/types.json
Executable file
|
|
@ -0,0 +1,58 @@
|
|||
[
|
||||
{
|
||||
"name": "rent",
|
||||
"l11n": {
|
||||
"en": "Rent",
|
||||
"de": "Miete"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "it",
|
||||
"l11n": {
|
||||
"en": "IT",
|
||||
"de": "IT"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "utilities",
|
||||
"l11n": {
|
||||
"en": "Utilities",
|
||||
"de": "Nebenkosten"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "energy",
|
||||
"l11n": {
|
||||
"en": "Energy",
|
||||
"de": "Energie"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "procurement",
|
||||
"l11n": {
|
||||
"en": "Procurement",
|
||||
"de": "Einkauf"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sales",
|
||||
"l11n": {
|
||||
"en": "Sales",
|
||||
"de": "Vertrieb"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "sales_subscription",
|
||||
"l11n": {
|
||||
"en": "Sales subscription",
|
||||
"de": "Vertriebsabonnement"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "nda",
|
||||
"l11n": {
|
||||
"en": "NDA",
|
||||
"de": "NDA"
|
||||
}
|
||||
}
|
||||
]
|
||||
125
Admin/Installer.php
Executable file
125
Admin/Installer.php
Executable file
|
|
@ -0,0 +1,125 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\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\ContractManagement\Admin
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class Installer extends InstallerAbstract
|
||||
{
|
||||
/**
|
||||
* Path of the file
|
||||
*
|
||||
* @var string
|
||||
* @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);
|
||||
|
||||
/* Bill types */
|
||||
$fileContent = \file_get_contents(__DIR__ . '/Install/types.json');
|
||||
if ($fileContent === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var array $types */
|
||||
$types = \json_decode($fileContent, true);
|
||||
if ($types === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::createContractTypes($app, $types);
|
||||
}
|
||||
|
||||
/**
|
||||
* Install default contract types
|
||||
*
|
||||
* @param ApplicationAbstract $app Application
|
||||
* @param array $types Bill types
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static function createContractTypes(ApplicationAbstract $app, array $types) : array
|
||||
{
|
||||
$contractTypes = [];
|
||||
|
||||
/** @var \Modules\ContractManagement\Controller\ApiContractTypeController $module */
|
||||
$module = $app->moduleManager->getModuleInstance('ContractManagement', 'ApiContractType');
|
||||
|
||||
foreach ($types as $type) {
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('name', $type['name'] ?? '');
|
||||
$request->setData('title', \reset($type['l11n']));
|
||||
$request->setData('language', \array_keys($type['l11n'])[0] ?? 'en');
|
||||
|
||||
$module->apiContractTypeCreate($request, $response);
|
||||
|
||||
$responseData = $response->get('');
|
||||
if (!\is_array($responseData)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$billType = \is_array($responseData['response'])
|
||||
? $responseData['response']
|
||||
: $responseData['response']->toArray();
|
||||
|
||||
$contractTypes[] = $billType;
|
||||
|
||||
$isFirst = true;
|
||||
foreach ($type['l11n'] as $language => $l11n) {
|
||||
if ($isFirst) {
|
||||
$isFirst = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('title', $l11n);
|
||||
$request->setData('language', $language);
|
||||
$request->setData('type', $billType['id']);
|
||||
|
||||
$module->apiContractTypeL11nCreate($request, $response);
|
||||
}
|
||||
}
|
||||
|
||||
return $contractTypes;
|
||||
}
|
||||
}
|
||||
83
Admin/Routes/Web/Api.php
Normal file
83
Admin/Routes/Web/Api.php
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\ContractManagement\Controller\Controller;
|
||||
use Modules\ContractManagement\Models\PermissionCategory;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/contract/type.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\ContractManagement\Controller\ApiContractTypeController:apiContractTypeCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
'permission' => [
|
||||
'module' => Controller::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CONTRACT_TYPE,
|
||||
],
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\ContractManagement\Controller\ApiContractTypeController:apiContractTypeUpdate',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
'module' => Controller::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CONTRACT_TYPE,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'^.*/contract$' => [
|
||||
[
|
||||
'dest' => '\Modules\ContractManagement\Controller\ApiController:apiContractCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
'permission' => [
|
||||
'module' => Controller::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CONTRACT,
|
||||
],
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\ContractManagement\Controller\ApiController:apiContractUpdate',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
'module' => Controller::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CONTRACT,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'^.*/contract/attribute.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\ContractManagement\Controller\ApiAttributeController:apiContractAttributeCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
'permission' => [
|
||||
'module' => Controller::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CONTRACT,
|
||||
],
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\ContractManagement\Controller\ApiAttributeController:apiContractAttributeUpdate',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
'module' => Controller::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CONTRACT,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
65
Admin/Routes/Web/Backend.php
Executable file
65
Admin/Routes/Web/Backend.php
Executable file
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use Modules\ContractManagement\Controller\BackendController;
|
||||
use Modules\ContractManagement\Models\PermissionCategory;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/contract/list.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractList',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CONTRACT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/contract/single.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContract',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CONTRACT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/contract/type/list.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractTypeList',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CONTRACT_TYPE,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/contract/type/profile.*$' => [
|
||||
[
|
||||
'dest' => '\Modules\ContractManagement\Controller\BackendController:viewContractType',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::READ,
|
||||
'state' => PermissionCategory::CONTRACT_TYPE,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
36
Admin/Status.php
Executable file
36
Admin/Status.php
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Admin;
|
||||
|
||||
use phpOMS\Module\StatusAbstract;
|
||||
|
||||
/**
|
||||
* Status class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class Status extends StatusAbstract
|
||||
{
|
||||
/**
|
||||
* Path of the file
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PATH = __DIR__;
|
||||
}
|
||||
36
Admin/Uninstaller.php
Executable file
36
Admin/Uninstaller.php
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Admin;
|
||||
|
||||
use phpOMS\Module\UninstallerAbstract;
|
||||
|
||||
/**
|
||||
* Uninstaller class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class Uninstaller extends UninstallerAbstract
|
||||
{
|
||||
/**
|
||||
* Path of the file
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PATH = __DIR__;
|
||||
}
|
||||
36
Admin/Updater.php
Executable file
36
Admin/Updater.php
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Admin;
|
||||
|
||||
use phpOMS\Module\UpdaterAbstract;
|
||||
|
||||
/**
|
||||
* Updater class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Admin
|
||||
* @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__;
|
||||
}
|
||||
523
Controller/ApiAttributeController.php
Normal file
523
Controller/ApiAttributeController.php
Normal file
|
|
@ -0,0 +1,523 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Controller;
|
||||
|
||||
use Modules\Attribute\Models\Attribute;
|
||||
use Modules\Attribute\Models\AttributeType;
|
||||
use Modules\Attribute\Models\AttributeValue;
|
||||
use Modules\ContractManagement\Models\Attribute\ContractAttributeMapper;
|
||||
use Modules\ContractManagement\Models\Attribute\ContractAttributeTypeL11nMapper;
|
||||
use Modules\ContractManagement\Models\Attribute\ContractAttributeTypeMapper;
|
||||
use Modules\ContractManagement\Models\Attribute\ContractAttributeValueL11nMapper;
|
||||
use Modules\ContractManagement\Models\Attribute\ContractAttributeValueMapper;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
|
||||
/**
|
||||
* ContractManagement class.
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class ApiAttributeController extends Controller
|
||||
{
|
||||
use \Modules\Attribute\Controller\ApiAttributeTraitController;
|
||||
|
||||
/**
|
||||
* Api method to create item attribute
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$attribute = $this->createAttributeFromRequest($request);
|
||||
$this->createModel($request->header->account, $attribute, ContractAttributeMapper::class, 'attribute', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $attribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to create contract attribute l11n
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeTypeL11nCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeTypeL11nCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$attrL11n = $this->createAttributeTypeL11nFromRequest($request);
|
||||
$this->createModel($request->header->account, $attrL11n, ContractAttributeTypeL11nMapper::class, 'attr_type_l11n', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $attrL11n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to create contract attribute type
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeTypeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeTypeCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$attrType = $this->createAttributeTypeFromRequest($request);
|
||||
$this->createModel($request->header->account, $attrType, ContractAttributeTypeMapper::class, 'attr_type', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $attrType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to create contract attribute value
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeValueCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeValueCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var \Modules\Attribute\Models\AttributeType $type */
|
||||
$type = ContractAttributeTypeMapper::get()
|
||||
->where('id', $request->getDataInt('type') ?? 0)
|
||||
->execute();
|
||||
|
||||
$attrValue = $this->createAttributeValueFromRequest($request, $type);
|
||||
$this->createModel($request->header->account, $attrValue, ContractAttributeValueMapper::class, 'attr_value', $request->getOrigin());
|
||||
|
||||
if ($attrValue->isDefault) {
|
||||
$this->createModelRelation(
|
||||
$request->header->account,
|
||||
(int) $request->getData('type'),
|
||||
$attrValue->id,
|
||||
ContractAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
|
||||
);
|
||||
}
|
||||
|
||||
$this->createStandardCreateResponse($request, $response, $attrValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to create contract attribute l11n
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeValueL11nCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeValueL11nCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$attrL11n = $this->createAttributeValueL11nFromRequest($request);
|
||||
$this->createModel($request->header->account, $attrL11n, ContractAttributeValueL11nMapper::class, 'attr_value_l11n', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $attrL11n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to update ContractAttribute
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeUpdate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidUpdateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var Attribute $old */
|
||||
$old = ContractAttributeMapper::get()
|
||||
->with('type')
|
||||
->with('type/defaults')
|
||||
->with('value')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->execute();
|
||||
|
||||
$new = $this->updateAttributeFromRequest($request, clone $old);
|
||||
|
||||
if ($new->id === 0) {
|
||||
// Set response header to invalid request because of invalid data
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidUpdateResponse($request, $response, $new);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->updateModel($request->header->account, $old, $new, ContractAttributeMapper::class, 'contract_attribute', $request->getOrigin());
|
||||
|
||||
if ($new->value->getValue() !== $old->value->getValue()
|
||||
&& $new->type->custom
|
||||
) {
|
||||
$this->updateModel($request->header->account, $old->value, $new->value, ContractAttributeValueMapper::class, 'attribute_value', $request->getOrigin());
|
||||
}
|
||||
|
||||
$this->createStandardUpdateResponse($request, $response, $new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to delete ContractAttribute
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeDelete($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidDeleteResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$contractAttribute = ContractAttributeMapper::get()
|
||||
->with('type')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->execute();
|
||||
|
||||
if ($contractAttribute->type->isRequired) {
|
||||
$this->createInvalidDeleteResponse($request, $response, []);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->deleteModel($request->header->account, $contractAttribute, ContractAttributeMapper::class, 'contract_attribute', $request->getOrigin());
|
||||
$this->createStandardDeleteResponse($request, $response, $contractAttribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to update ContractAttributeTypeL11n
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeTypeL11nUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeTypeL11nUpdate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidUpdateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var BaseStringL11n $old */
|
||||
$old = ContractAttributeTypeL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$new = $this->updateAttributeTypeL11nFromRequest($request, clone $old);
|
||||
|
||||
$this->updateModel($request->header->account, $old, $new, ContractAttributeTypeL11nMapper::class, 'contract_attribute_type_l11n', $request->getOrigin());
|
||||
$this->createStandardUpdateResponse($request, $response, $new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to delete ContractAttributeTypeL11n
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeTypeL11nDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeTypeL11nDelete($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidDeleteResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var BaseStringL11n $contractAttributeTypeL11n */
|
||||
$contractAttributeTypeL11n = ContractAttributeTypeL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$this->deleteModel($request->header->account, $contractAttributeTypeL11n, ContractAttributeTypeL11nMapper::class, 'contract_attribute_type_l11n', $request->getOrigin());
|
||||
$this->createStandardDeleteResponse($request, $response, $contractAttributeTypeL11n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to update ContractAttributeType
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeTypeUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeTypeUpdate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidUpdateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var AttributeType $old */
|
||||
$old = ContractAttributeTypeMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$new = $this->updateAttributeTypeFromRequest($request, clone $old);
|
||||
|
||||
$this->updateModel($request->header->account, $old, $new, ContractAttributeTypeMapper::class, 'contract_attribute_type', $request->getOrigin());
|
||||
$this->createStandardUpdateResponse($request, $response, $new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to delete ContractAttributeType
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @todo: implement
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeTypeDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeTypeDelete($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidDeleteResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var AttributeType $contractAttributeType */
|
||||
$contractAttributeType = ContractAttributeTypeMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$this->deleteModel($request->header->account, $contractAttributeType, ContractAttributeTypeMapper::class, 'contract_attribute_type', $request->getOrigin());
|
||||
$this->createStandardDeleteResponse($request, $response, $contractAttributeType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to update ContractAttributeValue
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeValueUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeValueUpdate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidUpdateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var AttributeValue $old */
|
||||
$old = ContractAttributeValueMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
|
||||
/** @var \Modules\Attribute\Models\Attribute $attr */
|
||||
$attr = ContractAttributeMapper::get()
|
||||
->with('type')
|
||||
->where('id', $request->getDataInt('attribute') ?? 0)
|
||||
->execute();
|
||||
|
||||
$new = $this->updateAttributeValueFromRequest($request, clone $old, $attr);
|
||||
|
||||
$this->updateModel($request->header->account, $old, $new, ContractAttributeValueMapper::class, 'contract_attribute_value', $request->getOrigin());
|
||||
$this->createStandardUpdateResponse($request, $response, $new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to delete ContractAttributeValue
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeValueDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
// @todo: I don't think values can be deleted? Only Attributes
|
||||
// However, It should be possible to remove UNUSED default values
|
||||
// either here or other function?
|
||||
// if (!empty($val = $this->validateAttributeValueDelete($request))) {
|
||||
// $response->header->status = RequestStatusCode::R_400;
|
||||
// $this->createInvalidDeleteResponse($request, $response, $val);
|
||||
|
||||
// return;
|
||||
// }
|
||||
|
||||
// /** @var AttributeValue $contractAttributeValue */
|
||||
// $contractAttributeValue = ContractAttributeValueMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
// $this->deleteModel($request->header->account, $contractAttributeValue, ContractAttributeValueMapper::class, 'contract_attribute_value', $request->getOrigin());
|
||||
// $this->createStandardDeleteResponse($request, $response, $contractAttributeValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to update ContractAttributeValueL11n
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeValueL11nUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeValueL11nUpdate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidUpdateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var BaseStringL11n $old */
|
||||
$old = ContractAttributeValueL11nMapper::get()->where('id', (int) $request->getData('id'));
|
||||
$new = $this->updateAttributeValueL11nFromRequest($request, clone $old);
|
||||
|
||||
$this->updateModel($request->header->account, $old, $new, ContractAttributeValueL11nMapper::class, 'contract_attribute_value_l11n', $request->getOrigin());
|
||||
$this->createStandardUpdateResponse($request, $response, $new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to delete ContractAttributeValueL11n
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractAttributeValueL11nDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateAttributeValueL11nDelete($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidDeleteResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var BaseStringL11n $contractAttributeValueL11n */
|
||||
$contractAttributeValueL11n = ContractAttributeValueL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$this->deleteModel($request->header->account, $contractAttributeValueL11n, ContractAttributeValueL11nMapper::class, 'contract_attribute_value_l11n', $request->getOrigin());
|
||||
$this->createStandardDeleteResponse($request, $response, $contractAttributeValueL11n);
|
||||
}
|
||||
}
|
||||
403
Controller/ApiContractTypeController.php
Normal file
403
Controller/ApiContractTypeController.php
Normal file
|
|
@ -0,0 +1,403 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Controller;
|
||||
|
||||
use Modules\ContractManagement\Models\ContractTypeL11nMapper;
|
||||
use Modules\ContractManagement\Models\ContractTypeMapper;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
use phpOMS\Localization\BaseStringL11nType;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
|
||||
/**
|
||||
* ContractManagement class.
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class ApiContractTypeController extends Controller
|
||||
{
|
||||
/**
|
||||
* Api method to create item attribute type
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractTypeCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateContractTypeCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$contractType = $this->createContractTypeFromRequest($request);
|
||||
$this->createModel($request->header->account, $contractType, ContractTypeMapper::class, 'contract_type', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $contractType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create item attribute from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return BaseStringL11nType
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createContractTypeFromRequest(RequestAbstract $request) : BaseStringL11nType
|
||||
{
|
||||
$contractType = new BaseStringL11nType();
|
||||
$contractType->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN);
|
||||
$contractType->title = $request->getDataString('name') ?? '';
|
||||
|
||||
return $contractType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate item attribute create request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateContractTypeCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['title'] = !$request->hasData('title'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to create item attribute l11n
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractTypeL11nCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateContractTypeL11nCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$contractTypeL11n = $this->createContractTypeL11nFromRequest($request);
|
||||
$this->createModel($request->header->account, $contractTypeL11n, ContractTypeL11nMapper::class, 'contract_type_l11n', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $contractTypeL11n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create item attribute l11n from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return BaseStringL11n
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createContractTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
||||
{
|
||||
$contractTypeL11n = new BaseStringL11n();
|
||||
$contractTypeL11n->ref = $request->getDataInt('type') ?? 0;
|
||||
$contractTypeL11n->setLanguage(
|
||||
$request->getDataString('language') ?? $request->header->l11n->language
|
||||
);
|
||||
$contractTypeL11n->content = $request->getDataString('title') ?? '';
|
||||
|
||||
return $contractTypeL11n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate item attribute l11n create request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateContractTypeL11nCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['title'] = !$request->hasData('title'))
|
||||
|| ($val['type'] = !$request->hasData('type'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to update ContractType
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractTypeUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateContractTypeUpdate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidUpdateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var BaseStringL11nType $old */
|
||||
$old = ContractTypeMapper::get()->where('id', (int) $request->getData('id'));
|
||||
$new = $this->updateContractTypeFromRequest($request, clone $old);
|
||||
|
||||
$this->updateModel($request->header->account, $old, $new, ContractTypeMapper::class, 'contract_type', $request->getOrigin());
|
||||
$this->createStandardUpdateResponse($request, $response, $new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to update ContractType from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param BaseStringL11nType $new Model to modify
|
||||
*
|
||||
* @return BaseStringL11nType
|
||||
*
|
||||
* @todo: implement
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function updateContractTypeFromRequest(RequestAbstract $request, BaseStringL11nType $new) : BaseStringL11nType
|
||||
{
|
||||
$new->title = $request->getDataString('name') ?? $new->title;
|
||||
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate ContractType update request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @todo: implement
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateContractTypeUpdate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['id'] = !$request->hasData('id'))) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to delete ContractType
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractTypeDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateContractTypeDelete($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidDeleteResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var BaseStringL11nType $contractType */
|
||||
$contractType = ContractTypeMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$this->deleteModel($request->header->account, $contractType, ContractTypeMapper::class, 'contract_type', $request->getOrigin());
|
||||
$this->createStandardDeleteResponse($request, $response, $contractType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate ContractType delete request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateContractTypeDelete(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['id'] = !$request->hasData('id'))) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to update ContractTypeL11n
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractTypeL11nUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateContractTypeL11nUpdate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidUpdateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var BaseStringL11n $old */
|
||||
$old = ContractTypeL11nMapper::get()->where('id', (int) $request->getData('id'));
|
||||
$new = $this->updateContractTypeL11nFromRequest($request, clone $old);
|
||||
|
||||
$this->updateModel($request->header->account, $old, $new, ContractTypeL11nMapper::class, 'contract_type_l11n', $request->getOrigin());
|
||||
$this->createStandardUpdateResponse($request, $response, $new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to update ContractTypeL11n from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param BaseStringL11n $new Model to modify
|
||||
*
|
||||
* @return BaseStringL11n
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function updateContractTypeL11nFromRequest(RequestAbstract $request, BaseStringL11n $new) : BaseStringL11n
|
||||
{
|
||||
$new->setLanguage(
|
||||
$request->getDataString('language') ?? $new->language
|
||||
);
|
||||
$new->content = $request->getDataString('title') ?? $new->content;
|
||||
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate ContractTypeL11n update request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateContractTypeL11nUpdate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['id'] = !$request->hasData('id'))) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to delete ContractTypeL11n
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractTypeL11nDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateContractTypeL11nDelete($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidDeleteResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var BaseStringL11n $contractTypeL11n */
|
||||
$contractTypeL11n = ContractTypeL11nMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$this->deleteModel($request->header->account, $contractTypeL11n, ContractTypeL11nMapper::class, 'contract_type_l11n', $request->getOrigin());
|
||||
$this->createStandardDeleteResponse($request, $response, $contractTypeL11n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate ContractTypeL11n delete request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateContractTypeL11nDelete(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['id'] = !$request->hasData('id'))) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
326
Controller/ApiController.php
Executable file
326
Controller/ApiController.php
Executable file
|
|
@ -0,0 +1,326 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Controller;
|
||||
|
||||
use Modules\Admin\Models\NullAccount;
|
||||
use Modules\ContractManagement\Models\Contract;
|
||||
use Modules\ContractManagement\Models\ContractMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Media\Models\PathSettings;
|
||||
use Modules\Organization\Models\NullUnit;
|
||||
use phpOMS\Localization\NullBaseStringL11nType;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
|
||||
/**
|
||||
* Api controller for the contracts module.
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class ApiController extends Controller
|
||||
{
|
||||
/**
|
||||
* Api method to create a contract
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateContractCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$contract = $this->createContractFromRequest($request);
|
||||
$this->createModel($request->header->account, $contract, ContractMapper::class, 'contract', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $contract);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate contract create request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateContractCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['title'] = !$request->hasData('title'))
|
||||
|| ($val['duration'] = !$request->hasData('duration'))
|
||||
|| ($val['type'] = !$request->hasData('type'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Create media directory path
|
||||
*
|
||||
* @param Contract $contract Contract
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createContractDir(Contract $contract) : string
|
||||
{
|
||||
return '/Modules/ContractManagement/Contract/'
|
||||
. $contract->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create item l11n from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return Contract
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createContractFromRequest(RequestAbstract $request) : Contract
|
||||
{
|
||||
$contract = new Contract();
|
||||
$contract->title = $request->getDataString('title') ?? '';
|
||||
$contract->description = $request->getDataString('description') ?? '';
|
||||
$contract->type = new NullBaseStringL11nType($request->getDataInt('type') ?? 0);
|
||||
$contract->start = $request->getDataDateTime('start') ?? new \DateTime('now');
|
||||
$contract->account = new NullAccount($request->getDataInt('account') ?? 0);
|
||||
$contract->renewal = $request->getDataInt('renewal') ?? 0;
|
||||
$contract->autoRenewal = $request->getDataBool('autorenewal') ?? false;
|
||||
$contract->isTemplate = $request->getDataBool('template') ?? false;
|
||||
$contract->unit = new NullUnit($request->getDataInt('unit') ?? 0);
|
||||
$contract->end = $request->getDataDateTime('end');
|
||||
|
||||
return $contract;
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to create a contract document
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractDocumentCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
$uploadedFiles = $request->files;
|
||||
|
||||
if (empty($uploadedFiles)) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $uploadedFiles);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var \Modules\ContractManagement\Models\Contract */
|
||||
$contract = ContractMapper::get()
|
||||
->where('id', $request->getDataInt('contract'))
|
||||
->execute();
|
||||
|
||||
$path = $this->createContractDir($contract);
|
||||
|
||||
$uploaded = $this->app->moduleManager->get('Media')->uploadFiles(
|
||||
names: $request->getDataList('names'),
|
||||
fileNames: $request->getDataList('filenames'),
|
||||
files: $uploadedFiles,
|
||||
account: $request->header->account,
|
||||
basePath: __DIR__ . '/../../../Modules/Media/Files' . $path,
|
||||
virtualPath: $path,
|
||||
pathSettings: PathSettings::FILE_PATH,
|
||||
readContent: true
|
||||
);
|
||||
|
||||
if ($request->hasData('type')) {
|
||||
foreach ($uploaded as $file) {
|
||||
$this->createModelRelation(
|
||||
$request->header->account,
|
||||
$file->id,
|
||||
$request->getDataInt('type'),
|
||||
MediaMapper::class,
|
||||
'types',
|
||||
'',
|
||||
$request->getOrigin()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($uploaded)) {
|
||||
$this->createInvalidAddResponse($request, $response, []);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->createModelRelation(
|
||||
$request->header->account,
|
||||
(int) $request->getData('contract'),
|
||||
\reset($uploaded)->id,
|
||||
ContractMapper::class, 'files', '', $request->getOrigin()
|
||||
);
|
||||
|
||||
$this->createStandardUpdateResponse($request, $response, $uploaded);
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to update Contract
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractUpdate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateContractUpdate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidUpdateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var \Modules\ContractManagement\Models\Contract $old */
|
||||
$old = ContractMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$new = $this->updateContractFromRequest($request, clone $old);
|
||||
|
||||
$this->updateModel($request->header->account, $old, $new, ContractMapper::class, 'contract', $request->getOrigin());
|
||||
$this->createStandardUpdateResponse($request, $response, $new);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to update Contract from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param Contract $new Model to modify
|
||||
*
|
||||
* @return Contract
|
||||
*
|
||||
* @todo: implement
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function updateContractFromRequest(RequestAbstract $request, Contract $new) : Contract
|
||||
{
|
||||
$new->title = $request->getDataString('title') ?? $new->title;
|
||||
$new->description = $request->getDataString('description') ?? $new->description;
|
||||
$new->type = $request->hasData('type') ? new NullBaseStringL11nType($request->getDataInt('type') ?? 0) : $new->type;
|
||||
$new->start = $request->getDataDateTime('start') ?? $new->start;
|
||||
$new->account = $request->hasData('account') ? new NullAccount($request->getDataInt('account') ?? 0) : $new->account;
|
||||
$new->renewal = $request->getDataInt('renewal') ?? $new->renewal;
|
||||
$new->autoRenewal = $request->getDataBool('autorenewal') ?? $new->autoRenewal;
|
||||
$new->unit = $request->hasData('unit') ? new NullUnit($request->getDataInt('unit') ?? 0) : $new->unit;
|
||||
$new->end = $request->getDataDateTime('end') ?? $new->end;
|
||||
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Contract update request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @todo: implement
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateContractUpdate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['id'] = !$request->hasData('id'))) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Api method to delete Contract
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @api
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function apiContractDelete(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateContractDelete($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidDeleteResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var \Modules\ContractManagement\Models\Contract $contract */
|
||||
$contract = ContractMapper::get()->where('id', (int) $request->getData('id'))->execute();
|
||||
$this->deleteModel($request->header->account, $contract, ContractMapper::class, 'contract', $request->getOrigin());
|
||||
$this->createStandardDeleteResponse($request, $response, $contract);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate Contract delete request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @todo: implement
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateContractDelete(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['id'] = !$request->hasData('id'))) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
182
Controller/BackendController.php
Executable file
182
Controller/BackendController.php
Executable file
|
|
@ -0,0 +1,182 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Controller;
|
||||
|
||||
use Modules\ContractManagement\Models\ContractMapper;
|
||||
use Modules\ContractManagement\Models\ContractTypeMapper;
|
||||
use Modules\Organization\Models\UnitMapper;
|
||||
use phpOMS\Contract\RenderableInterface;
|
||||
use phpOMS\Message\RequestAbstract;
|
||||
use phpOMS\Message\ResponseAbstract;
|
||||
use phpOMS\Views\View;
|
||||
|
||||
/**
|
||||
* Backend controller for the contracts module.
|
||||
*
|
||||
* @property \Web\WebApplication $app
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
final class BackendController extends Controller
|
||||
{
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewContractList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
|
||||
|
||||
$mapper = ContractMapper::getAll()
|
||||
->with('account')
|
||||
->limit(25);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->data['contracts'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '<')->execute();
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->data['contracts'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '>')->execute();
|
||||
} else {
|
||||
$view->data['contracts'] = $mapper->where('id', 0, '>')->execute();
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewContractTypeList(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-type-list');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
|
||||
|
||||
$mapper = ContractTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->limit(25);
|
||||
|
||||
if ($request->getData('ptype') === 'p') {
|
||||
$view->data['types'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '<')->execute();
|
||||
} elseif ($request->getData('ptype') === 'n') {
|
||||
$view->data['types'] = $mapper->where('id', $request->getDataInt('id') ?? 0, '>')->execute();
|
||||
} else {
|
||||
$view->data['types'] = $mapper->where('id', 0, '>')->execute();
|
||||
}
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewContractType(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-type');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
|
||||
|
||||
$type = ContractTypeMapper::get()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->execute();
|
||||
|
||||
$view->data['type'] = $type;
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behaviour.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewContract(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
|
||||
$view->setTemplate('/Modules/ContractManagement/Theme/Backend/contract-single');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1007901001, $request, $response);
|
||||
|
||||
$contract = ContractMapper::get()
|
||||
->with('account')
|
||||
->with('files')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->sort('files/id', 'DESC')
|
||||
->execute();
|
||||
|
||||
$view->data['contract'] = $contract;
|
||||
|
||||
$contractTypes = ContractTypeMapper::getAll()
|
||||
->with('l11n')
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->execute();
|
||||
|
||||
$view->data['contractTypes'] = $contractTypes;
|
||||
|
||||
$units = UnitMapper::getAll()
|
||||
->execute();
|
||||
|
||||
$view->data['units'] = $units;
|
||||
|
||||
$view->data['editor'] = new \Modules\Editor\Theme\Backend\Components\Editor\BaseView($this->app->l11nManager, $request, $response);
|
||||
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
|
||||
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
76
Controller/Controller.php
Executable file
76
Controller/Controller.php
Executable file
|
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Controller;
|
||||
|
||||
use phpOMS\Module\ModuleAbstract;
|
||||
|
||||
/**
|
||||
* Contract controller class.
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Controller extends ModuleAbstract
|
||||
{
|
||||
/**
|
||||
* Module path.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PATH = __DIR__ . '/../';
|
||||
|
||||
/**
|
||||
* Module version.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const VERSION = '1.0.0';
|
||||
|
||||
/**
|
||||
* Module name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const NAME = 'ContractManagement';
|
||||
|
||||
/**
|
||||
* Module id.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const ID = 1007900000;
|
||||
|
||||
/**
|
||||
* Providing.
|
||||
*
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static array $providing = [];
|
||||
|
||||
/**
|
||||
* Dependencies.
|
||||
*
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static array $dependencies = [];
|
||||
}
|
||||
3
Docs/Dev/en/SUMMARY.md
Executable file
3
Docs/Dev/en/SUMMARY.md
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
# Developer Content
|
||||
|
||||
* [Structure]({%}&page=Dev/structure)
|
||||
5
Docs/Dev/en/structure.md
Executable file
5
Docs/Dev/en/structure.md
Executable file
|
|
@ -0,0 +1,5 @@
|
|||
# Structure
|
||||
|
||||
## ER
|
||||
|
||||

|
||||
BIN
Docs/Dev/img/er.png
Normal file
BIN
Docs/Dev/img/er.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 113 KiB |
49
ICAL.txt
Executable file
49
ICAL.txt
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
# Individual Contributor License Agreement ("CLA") 1.0
|
||||
|
||||
Thank you for your interest in Karaka-Management (the "Company"). In order to clarify the intellectual property license granted with Contributions from any person or entity, the Company must provide a Contributor License Agreement ("CLA") on file that has been made available to each Contributor. This license is for your protection as a Contributor as well as the protection of the Company and its users; it does not change your rights to use your own Contributions for any other purpose.
|
||||
|
||||
By contributing to the Company You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Company. In return, the Company shall not use Your Contributions in a way that is contrary to the public benefit or inconsistent with its bylaws in effect at the time of the Contribution. Except for the license granted herein to the Company and recipients of software distributed by the Company, You reserve all right, title, and interest in and to Your Contributions.
|
||||
|
||||
## Definitions
|
||||
|
||||
**"You" (or "Your")**
|
||||
|
||||
"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with the Company. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. 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.
|
||||
|
||||
**"Contribution"**
|
||||
|
||||
"Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to the Company for inclusion in, or documentation of, any of the products owned or managed by the Company (the "Work"). This includes but is not limited to technical material, techniques, articles, sketches, drawings, images, models, inventions, know-how, processes, apparatus, equipment, algorithms, software programs, software source documents, and formula related to the current, future and proposed products and services regarding the Company". For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Company 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 Company for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
|
||||
|
||||
## Grant of Copyright License
|
||||
|
||||
Subject to the terms and conditions of this Agreement, You hereby grant to the Company and to recipients of software distributed by the Company a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sub license, and distribute Your Contributions and such derivative works.
|
||||
|
||||
## Grant of Patent License
|
||||
|
||||
Subject to the terms and conditions of this Agreement, You hereby grant to the Company and to recipients of software distributed by the Company a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
## Authorization
|
||||
|
||||
You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to the Company, or that your employer has executed a separate Corporate CLA with the Company.
|
||||
|
||||
You represent that each of Your Contributions is Your original creation (see "Third-party Contribution" for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
|
||||
|
||||
## Support
|
||||
|
||||
You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your 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.
|
||||
|
||||
## Third-party Contribution
|
||||
|
||||
Should You wish to submit work that is not Your original creation, You may submit it to the Company separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".
|
||||
|
||||
## Survival
|
||||
|
||||
This Agreement shall govern all communications between the parties. You understand that this Agreement stays active even if the connection with You gets terminated unless the project the Company gets officially canceled by the project manager "Dennis Eichhorn".
|
||||
|
||||
## Governing Law and Jurisdiction
|
||||
|
||||
This Agreement shall be governed exclusively by German law. The courts of Hessen, Germany shall have exclusive jurisdiction.
|
||||
|
||||
## Entire Agreement
|
||||
|
||||
This agreement constitutes the entire agreement and supersedes all prior or contemporaneous oral or written agreements concerning such Contribution. This agreement may only be changed by mutual agreement of authorized representatives of the parties in writing. You agree to notify the Company of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
|
||||
86
Models/Attribute/ContractAttributeMapper.php
Normal file
86
Models/Attribute/ContractAttributeMapper.php
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models\Attribute
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models\Attribute;
|
||||
|
||||
use Modules\Attribute\Models\Attribute;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
/**
|
||||
* Fleet mapper class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models\Attribute
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of Attribute
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class ContractAttributeMapper 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 = [
|
||||
'contractmgmt_contract_attr_id' => ['name' => 'contractmgmt_contract_attr_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'contractmgmt_contract_attr_contract' => ['name' => 'contractmgmt_contract_attr_contract', 'type' => 'int', 'internal' => 'ref'],
|
||||
'contractmgmt_contract_attr_type' => ['name' => 'contractmgmt_contract_attr_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'contractmgmt_contract_attr_value' => ['name' => 'contractmgmt_contract_attr_value', 'type' => 'int', 'internal' => 'value'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const OWNS_ONE = [
|
||||
'type' => [
|
||||
'mapper' => ContractAttributeTypeMapper::class,
|
||||
'external' => 'contractmgmt_attr_type',
|
||||
],
|
||||
'value' => [
|
||||
'mapper' => ContractAttributeValueMapper::class,
|
||||
'external' => 'contractmgmt_attr_value',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = Attribute::class;
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const TABLE = 'contractmgmt_contract_attr';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'contractmgmt_contract_attr_id';
|
||||
}
|
||||
69
Models/Attribute/ContractAttributeTypeL11nMapper.php
Normal file
69
Models/Attribute/ContractAttributeTypeL11nMapper.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models\Attribute
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models\Attribute;
|
||||
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
|
||||
/**
|
||||
* Contract mapper class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models\Attribute
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of BaseStringL11n
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class ContractAttributeTypeL11nMapper 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 = [
|
||||
'contractmgmt_attr_type_l11n_id' => ['name' => 'contractmgmt_attr_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'contractmgmt_attr_type_l11n_title' => ['name' => 'contractmgmt_attr_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
||||
'contractmgmt_attr_type_l11n_type' => ['name' => 'contractmgmt_attr_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
|
||||
'contractmgmt_attr_type_l11n_lang' => ['name' => 'contractmgmt_attr_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const TABLE = 'contractmgmt_attr_type_l11n';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'contractmgmt_attr_type_l11n_id';
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
}
|
||||
94
Models/Attribute/ContractAttributeTypeMapper.php
Normal file
94
Models/Attribute/ContractAttributeTypeMapper.php
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models\Attribute
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models\Attribute;
|
||||
|
||||
use Modules\Attribute\Models\AttributeType;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
/**
|
||||
* Contract mapper class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models\Attribute
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of AttributeType
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class ContractAttributeTypeMapper 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 = [
|
||||
'contractmgmt_attr_type_id' => ['name' => 'contractmgmt_attr_type_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'contractmgmt_attr_type_name' => ['name' => 'contractmgmt_attr_type_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
|
||||
'contractmgmt_attr_type_datatype' => ['name' => 'contractmgmt_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
|
||||
'contractmgmt_attr_type_fields' => ['name' => 'contractmgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
|
||||
'contractmgmt_attr_type_custom' => ['name' => 'contractmgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
|
||||
'contractmgmt_attr_type_pattern' => ['name' => 'contractmgmt_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
|
||||
'contractmgmt_attr_type_required' => ['name' => 'contractmgmt_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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' => ContractAttributeTypeL11nMapper::class,
|
||||
'table' => 'contractmgmt_attr_type_l11n',
|
||||
'self' => 'contractmgmt_attr_type_l11n_type',
|
||||
'column' => 'content',
|
||||
'external' => null,
|
||||
],
|
||||
'defaults' => [
|
||||
'mapper' => ContractAttributeValueMapper::class,
|
||||
'table' => 'contractmgmt_contract_attr_default',
|
||||
'self' => 'contractmgmt_contract_attr_default_type',
|
||||
'external' => 'contractmgmt_contract_attr_default_value',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = AttributeType::class;
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const TABLE = 'contractmgmt_attr_type';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'contractmgmt_attr_type_id';
|
||||
}
|
||||
69
Models/Attribute/ContractAttributeValueL11nMapper.php
Normal file
69
Models/Attribute/ContractAttributeValueL11nMapper.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models\Attribute
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models\Attribute;
|
||||
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
|
||||
/**
|
||||
* Contract mapper class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models\Attribute
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of BaseStringL11n
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class ContractAttributeValueL11nMapper 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 = [
|
||||
'contractmgmt_attr_value_l11n_id' => ['name' => 'contractmgmt_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'contractmgmt_attr_value_l11n_title' => ['name' => 'contractmgmt_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
||||
'contractmgmt_attr_value_l11n_value' => ['name' => 'contractmgmt_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
|
||||
'contractmgmt_attr_value_l11n_lang' => ['name' => 'contractmgmt_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const TABLE = 'contractmgmt_attr_value_l11n';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'contractmgmt_attr_value_l11n_id';
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
}
|
||||
89
Models/Attribute/ContractAttributeValueMapper.php
Normal file
89
Models/Attribute/ContractAttributeValueMapper.php
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models\Attribute
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models\Attribute;
|
||||
|
||||
use Modules\Attribute\Models\AttributeValue;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
/**
|
||||
* Contract mapper class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models\Attribute
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of AttributeValue
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class ContractAttributeValueMapper 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 = [
|
||||
'contractmgmt_attr_value_id' => ['name' => 'contractmgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'contractmgmt_attr_value_default' => ['name' => 'contractmgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
|
||||
'contractmgmt_attr_value_valueStr' => ['name' => 'contractmgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
|
||||
'contractmgmt_attr_value_valueInt' => ['name' => 'contractmgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
|
||||
'contractmgmt_attr_value_valueDec' => ['name' => 'contractmgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
|
||||
'contractmgmt_attr_value_valueDat' => ['name' => 'contractmgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
|
||||
'contractmgmt_attr_value_unit' => ['name' => 'contractmgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
|
||||
'contractmgmt_attr_value_deptype' => ['name' => 'contractmgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
|
||||
'contractmgmt_attr_value_depvalue' => ['name' => 'contractmgmt_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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' => ContractAttributeValueL11nMapper::class,
|
||||
'table' => 'contractmgmt_attr_value_l11n',
|
||||
'self' => 'contractmgmt_attr_value_l11n_value',
|
||||
'external' => null,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = AttributeValue::class;
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const TABLE = 'contractmgmt_attr_value';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'contractmgmt_attr_value_id';
|
||||
}
|
||||
132
Models/Contract.php
Executable file
132
Models/Contract.php
Executable file
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models;
|
||||
|
||||
use Modules\Admin\Models\Account;
|
||||
use Modules\Admin\Models\NullAccount;
|
||||
use Modules\Organization\Models\Unit;
|
||||
use phpOMS\Localization\BaseStringL11nType;
|
||||
use phpOMS\Localization\Money;
|
||||
|
||||
/**
|
||||
* Contract class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
class Contract
|
||||
{
|
||||
/**
|
||||
* ID.
|
||||
*
|
||||
* @var int
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public int $id = 0;
|
||||
|
||||
public ?int $parent = null;
|
||||
|
||||
public bool $isTemplate = false;
|
||||
|
||||
public string $title = '';
|
||||
|
||||
public string $description = '';
|
||||
|
||||
// The original start of the contract ignoring renewals
|
||||
public ?\DateTime $originalStart = null;
|
||||
|
||||
// Start of the contract considering renewals
|
||||
public ?\DateTime $start = null;
|
||||
|
||||
// End of the contract considering renewals
|
||||
public ?\DateTime $end = null;
|
||||
|
||||
/**
|
||||
* Months until end of contract
|
||||
*
|
||||
* The renewal sometimes can be done up until the end of the contract and sometimes x-months prior to the contract end.
|
||||
*/
|
||||
public int $renewal = 0;
|
||||
|
||||
public bool $autoRenewal = false;
|
||||
|
||||
public int $duration = 0;
|
||||
|
||||
public int $warning = 0;
|
||||
|
||||
public ?int $responsible = null;
|
||||
|
||||
// Contract with
|
||||
public Account $account;
|
||||
|
||||
/**
|
||||
* Created at.
|
||||
*
|
||||
* @var \DateTimeImmutable
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public \DateTimeImmutable $createdAt;
|
||||
|
||||
public ?Money $costs = null;
|
||||
|
||||
public ?BaseStringL11nType $type = null;
|
||||
|
||||
public ?Unit $unit = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->createdAt = new \DateTimeImmutable('now');
|
||||
$this->account = new NullAccount();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'title' => $this->title,
|
||||
'description' => $this->description,
|
||||
'start' => $this->start,
|
||||
'end' => $this->end,
|
||||
'duration' => $this->duration,
|
||||
'warning' => $this->warning,
|
||||
'responsible' => $this->responsible,
|
||||
'createdAt' => $this->createdAt,
|
||||
'costs' => $this->costs,
|
||||
'type' => $this->type,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
use \Modules\Media\Models\MediaListTrait;
|
||||
use \Modules\Editor\Models\EditorDocListTrait;
|
||||
use \Modules\Attribute\Models\AttributeHolderTrait;
|
||||
}
|
||||
136
Models/ContractMapper.php
Executable file
136
Models/ContractMapper.php
Executable file
|
|
@ -0,0 +1,136 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models;
|
||||
|
||||
use Modules\Admin\Models\AccountMapper;
|
||||
use Modules\ContractManagement\Models\Attribute\ContractAttributeMapper;
|
||||
use Modules\Editor\Models\EditorDocMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Organization\Models\UnitMapper;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
/**
|
||||
* Contract mapper class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of Contract
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class ContractMapper 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 = [
|
||||
'contractmgmt_contract_id' => ['name' => 'contractmgmt_contract_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'contractmgmt_contract_parent' => ['name' => 'contractmgmt_contract_parent', 'type' => 'int', 'internal' => 'parent'],
|
||||
'contractmgmt_contract_template' => ['name' => 'contractmgmt_contract_template', 'type' => 'bool', 'internal' => 'isTemplate'],
|
||||
'contractmgmt_contract_title' => ['name' => 'contractmgmt_contract_title', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
|
||||
'contractmgmt_contract_description' => ['name' => 'contractmgmt_contract_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'contractmgmt_contract_account' => ['name' => 'contractmgmt_contract_account', 'type' => 'int', 'internal' => 'account'],
|
||||
'contractmgmt_contract_costs' => ['name' => 'contractmgmt_contract_costs', 'type' => 'Serializable', 'internal' => 'costs'],
|
||||
'contractmgmt_contract_renewal' => ['name' => 'contractmgmt_contract_renewal', 'type' => 'int', 'internal' => 'renewal'],
|
||||
'contractmgmt_contract_autorenewal' => ['name' => 'contractmgmt_contract_autorenewal', 'type' => 'bool', 'internal' => 'autoRenewal'],
|
||||
'contractmgmt_contract_duration' => ['name' => 'contractmgmt_contract_duration', 'type' => 'int', 'internal' => 'duration'],
|
||||
'contractmgmt_contract_warning' => ['name' => 'contractmgmt_contract_warning', 'type' => 'int', 'internal' => 'warning'],
|
||||
'contractmgmt_contract_startoriginal' => ['name' => 'contractmgmt_contract_startoriginal', 'type' => 'DateTime', 'internal' => 'originalStart'],
|
||||
'contractmgmt_contract_start' => ['name' => 'contractmgmt_contract_start', 'type' => 'DateTime', 'internal' => 'start'],
|
||||
'contractmgmt_contract_end' => ['name' => 'contractmgmt_contract_end', 'type' => 'DateTime', 'internal' => 'end'],
|
||||
'contractmgmt_contract_responsible' => ['name' => 'contractmgmt_contract_responsible', 'type' => 'int', 'internal' => 'responsible'],
|
||||
'contractmgmt_contract_unit' => ['name' => 'contractmgmt_contract_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||
'contractmgmt_contract_type' => ['name' => 'contractmgmt_contract_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'contractmgmt_contract_created_at' => ['name' => 'contractmgmt_contract_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const TABLE = 'contractmgmt_contract';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'contractmgmt_contract_id';
|
||||
|
||||
/**
|
||||
* Created at.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const CREATED_AT = 'contractmgmt_contract_created_at';
|
||||
|
||||
/**
|
||||
* Has one relation.
|
||||
*
|
||||
* @var array<string, array{mapper:class-string, external:string, by?:string, column?:string, conditional?:bool}>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const OWNS_ONE = [
|
||||
'type' => [
|
||||
'mapper' => ContractTypeMapper::class,
|
||||
'external' => 'contractmgmt_contract_type',
|
||||
],
|
||||
'account' => [
|
||||
'mapper' => AccountMapper::class,
|
||||
'external' => 'contractmgmt_contract_account',
|
||||
],
|
||||
'unit' => [
|
||||
'mapper' => UnitMapper::class,
|
||||
'external' => 'contractmgmt_contract_unit',
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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 = [
|
||||
'files' => [
|
||||
'mapper' => MediaMapper::class, /* mapper of the related object */
|
||||
'table' => 'contractmgmt_contract_media', /* table of the related object, null if no relation table is used (many->1) */
|
||||
'external' => 'contractmgmt_contract_media_media',
|
||||
'self' => 'contractmgmt_contract_media_contract',
|
||||
],
|
||||
'notes' => [
|
||||
'mapper' => EditorDocMapper::class, /* mapper of the related object */
|
||||
'table' => 'contractmgmt_contract_note', /* table of the related object, null if no relation table is used (many->1) */
|
||||
'external' => 'contractmgmt_contract_note_doc',
|
||||
'self' => 'contractmgmt_contract_note_contract',
|
||||
],
|
||||
'attributes' => [
|
||||
'mapper' => ContractAttributeMapper::class,
|
||||
'table' => 'contractmgmt_contract_attr',
|
||||
'self' => 'contractmgmt_contract_attr_contract',
|
||||
'external' => null,
|
||||
],
|
||||
];
|
||||
}
|
||||
69
Models/ContractTypeL11nMapper.php
Executable file
69
Models/ContractTypeL11nMapper.php
Executable file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\Localization\BaseStringL11n;
|
||||
|
||||
/**
|
||||
* Contract type l11n mapper class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of BaseStringL11n
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class ContractTypeL11nMapper 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 = [
|
||||
'contractmgmt_type_l11n_id' => ['name' => 'contractmgmt_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'contractmgmt_type_l11n_title' => ['name' => 'contractmgmt_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
||||
'contractmgmt_type_l11n_type' => ['name' => 'contractmgmt_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
|
||||
'contractmgmt_type_l11n_lang' => ['name' => 'contractmgmt_type_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
||||
];
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const TABLE = 'contractmgmt_type_l11n';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'contractmgmt_type_l11n_id';
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
}
|
||||
83
Models/ContractTypeMapper.php
Executable file
83
Models/ContractTypeMapper.php
Executable file
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models;
|
||||
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
use phpOMS\Localization\BaseStringL11nType;
|
||||
|
||||
/**
|
||||
* Contract type mapper class.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of BaseStringL11nType
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class ContractTypeMapper 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 = [
|
||||
'contractmgmt_type_id' => ['name' => 'contractmgmt_type_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'contractmgmt_type_name' => ['name' => 'contractmgmt_type_name', 'type' => 'string', 'internal' => 'title'],
|
||||
];
|
||||
|
||||
/**
|
||||
* 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' => ContractTypeL11nMapper::class,
|
||||
'table' => 'contractmgmt_type_l11n',
|
||||
'self' => 'contractmgmt_type_l11n_type',
|
||||
'column' => 'content',
|
||||
'external' => null,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11nType::class;
|
||||
|
||||
/**
|
||||
* Primary table.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const TABLE = 'contractmgmt_type';
|
||||
|
||||
/**
|
||||
* Primary field name.
|
||||
*
|
||||
* @var string
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const PRIMARYFIELD = 'contractmgmt_type_id';
|
||||
}
|
||||
47
Models/NullContract.php
Executable file
47
Models/NullContract.php
Executable file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models;
|
||||
|
||||
/**
|
||||
* Contract model.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullContract extends Contract
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param int $id Model id
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public function __construct(int $id = 0)
|
||||
{
|
||||
$this->id = $id;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return ['id' => $this->id];
|
||||
}
|
||||
}
|
||||
32
Models/PermissionCategory.php
Executable file
32
Models/PermissionCategory.php
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models;
|
||||
|
||||
use phpOMS\Stdlib\Base\Enum;
|
||||
|
||||
/**
|
||||
* Permision state enum.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract class PermissionCategory extends Enum
|
||||
{
|
||||
public const CONTRACT = 1;
|
||||
|
||||
public const CONTRACT_TYPE = 2;
|
||||
}
|
||||
30
Models/SettingsEnum.php
Executable file
30
Models/SettingsEnum.php
Executable file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\Models;
|
||||
|
||||
use phpOMS\Stdlib\Base\Enum;
|
||||
|
||||
/**
|
||||
* Module settings enum.
|
||||
*
|
||||
* @package Modules\ContractManagement\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract class SettingsEnum extends Enum
|
||||
{
|
||||
public const CONTRACT_RENEWAL_WARNING = '1007900001';
|
||||
}
|
||||
21
Theme/Backend/Lang/Navigation.ar.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.ar.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'اتفافية',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'انكماش',
|
||||
'Create' => 'يخلق',
|
||||
'List' => 'قائمة',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.cs.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.cs.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Smlouva',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Smlouvy',
|
||||
'Create' => 'Vytvořit',
|
||||
'List' => 'Seznam',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.da.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.da.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Kontrakt',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Kontrakter',
|
||||
'Create' => 'skab',
|
||||
'List' => 'Liste',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.de.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.de.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Vertrag',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Verträge',
|
||||
'Create' => 'Erstellen',
|
||||
'List' => 'Aufführen',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.el.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.el.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Σύμβαση',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Συμβάσεις',
|
||||
'Create' => 'Δημιουργώ',
|
||||
'List' => 'Λίστα',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.en.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.en.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Contract',
|
||||
'ContractTypes' => 'Types',
|
||||
'Contracts' => 'Contracts',
|
||||
'Create' => 'Create',
|
||||
'List' => 'List',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.es.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.es.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Contrato',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Contrato',
|
||||
'Create' => 'Crear',
|
||||
'List' => 'Lista',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.fi.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.fi.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Sopimus',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Sopimukset',
|
||||
'Create' => 'Luoda',
|
||||
'List' => 'Lista',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.fr.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.fr.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Contracter',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Contrats',
|
||||
'Create' => 'Créer',
|
||||
'List' => 'Lister',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.hu.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.hu.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Szerződés',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Szerződések',
|
||||
'Create' => 'Teremt',
|
||||
'List' => 'Lista',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.it.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.it.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Contrarre',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Contratti',
|
||||
'Create' => 'Creare',
|
||||
'List' => 'Elenco',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.ja.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.ja.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => '契約',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => '契約',
|
||||
'Create' => '作成',
|
||||
'List' => 'リスト',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.ko.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.ko.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => '계약',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => '계약서',
|
||||
'Create' => '만들다',
|
||||
'List' => '목록',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.no.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.no.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Kontrakt',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Kontrakter',
|
||||
'Create' => 'Skape',
|
||||
'List' => 'Liste',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.pl.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.pl.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Kontrakt',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Kontrakty',
|
||||
'Create' => 'Tworzyć',
|
||||
'List' => 'Lista',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.pt.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.pt.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Contrato',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Contratos',
|
||||
'Create' => 'Crio',
|
||||
'List' => 'Lista',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.ru.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.ru.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Договор',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Контракты',
|
||||
'Create' => 'Создавать',
|
||||
'List' => 'Список',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.sv.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.sv.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Avtal',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Kontrakt',
|
||||
'Create' => 'Skapa',
|
||||
'List' => 'Lista',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.th.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.th.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'สัญญา',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'สัญญา',
|
||||
'Create' => 'สร้าง',
|
||||
'List' => 'รายการ',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.tr.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.tr.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Sözleşme',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Sözleşme',
|
||||
'Create' => 'Yaratmak',
|
||||
'List' => 'Liste',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.uk.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.uk.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => 'Договір',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Контракти',
|
||||
'Create' => 'Створювати',
|
||||
'List' => 'Список',
|
||||
]];
|
||||
21
Theme/Backend/Lang/Navigation.zh.lang.php
Executable file
21
Theme/Backend/Lang/Navigation.zh.lang.php
Executable file
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['Navigation' => [
|
||||
'Contract' => '合同',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => '合同',
|
||||
'Create' => '创建',
|
||||
'List' => '列表',
|
||||
]];
|
||||
34
Theme/Backend/Lang/ar.lang.php
Executable file
34
Theme/Backend/Lang/ar.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'اتفافية',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'انكماش',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'عنوان',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/cs.lang.php
Executable file
34
Theme/Backend/Lang/cs.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Smlouva',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Smlouvy',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Titul',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/da.lang.php
Executable file
34
Theme/Backend/Lang/da.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Kontrakt',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Kontrakter',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Titel',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/de.lang.php
Executable file
34
Theme/Backend/Lang/de.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => 'Account',
|
||||
'AutoRenewal' => 'Automatische Verlängerung',
|
||||
'Contract' => 'Vertrag',
|
||||
'ContractTypes' => 'Vertragstypen',
|
||||
'Contracts' => 'Verträge',
|
||||
'Costs' => 'Kosten',
|
||||
'Description' => 'Beschreibung',
|
||||
'End' => 'Ende',
|
||||
'Files' => 'Dateien',
|
||||
'Name' => '',
|
||||
'Overview' => 'Übersicht',
|
||||
'Parties' => 'Parteien',
|
||||
'Start' => 'Start',
|
||||
'Termination' => 'Beendigung',
|
||||
'Title' => 'Titel',
|
||||
'Type' => 'Typ',
|
||||
'Unit' => 'Unit',
|
||||
'With' => 'Mit',
|
||||
]];
|
||||
34
Theme/Backend/Lang/el.lang.php
Executable file
34
Theme/Backend/Lang/el.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Σύμβαση',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Συμβάσεις',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Τίτλος',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/en.lang.php
Executable file
34
Theme/Backend/Lang/en.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => 'Account',
|
||||
'AutoRenewal' => 'Auto Renewal',
|
||||
'Contract' => 'Contract',
|
||||
'ContractTypes' => 'Contract Types',
|
||||
'Contracts' => 'Contracts',
|
||||
'Costs' => 'Costs',
|
||||
'Description' => 'Description',
|
||||
'End' => 'End',
|
||||
'Files' => 'Files',
|
||||
'Name' => '',
|
||||
'Overview' => 'Overview',
|
||||
'Parties' => 'Parties',
|
||||
'Start' => 'Start',
|
||||
'Termination' => 'Termination',
|
||||
'Title' => 'Title',
|
||||
'Type' => 'Type',
|
||||
'Unit' => 'Unit',
|
||||
'With' => 'With',
|
||||
]];
|
||||
34
Theme/Backend/Lang/es.lang.php
Executable file
34
Theme/Backend/Lang/es.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Contrato',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Contrato',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Título',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/fi.lang.php
Executable file
34
Theme/Backend/Lang/fi.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Sopimus',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Sopimukset',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Otsikko',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/fr.lang.php
Executable file
34
Theme/Backend/Lang/fr.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Contracter',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Contrats',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Titre',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/hu.lang.php
Executable file
34
Theme/Backend/Lang/hu.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Szerződés',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Szerződések',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Cím',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/it.lang.php
Executable file
34
Theme/Backend/Lang/it.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Contrarre',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Contratti',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Titolo',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/ja.lang.php
Executable file
34
Theme/Backend/Lang/ja.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => '契約',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => '契約',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'タイトル',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/ko.lang.php
Executable file
34
Theme/Backend/Lang/ko.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => '계약',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => '계약서',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => '제목',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/no.lang.php
Executable file
34
Theme/Backend/Lang/no.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Kontrakt',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Kontrakter',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Tittel',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/pl.lang.php
Executable file
34
Theme/Backend/Lang/pl.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Kontrakt',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Kontrakty',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Tytuł',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/pt.lang.php
Executable file
34
Theme/Backend/Lang/pt.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Contrato',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Contratos',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Título',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/ru.lang.php
Executable file
34
Theme/Backend/Lang/ru.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Договор',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Контракты',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Заголовок',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/sv.lang.php
Executable file
34
Theme/Backend/Lang/sv.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Avtal',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Kontrakt',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Titel',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/th.lang.php
Executable file
34
Theme/Backend/Lang/th.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'สัญญา',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'สัญญา',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'ชื่อ',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/tr.lang.php
Executable file
34
Theme/Backend/Lang/tr.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Sözleşme',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Sözleşme',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Başlık',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/uk.lang.php
Executable file
34
Theme/Backend/Lang/uk.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => 'Договір',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => 'Контракти',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => 'Заголовок',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
34
Theme/Backend/Lang/zh.lang.php
Executable file
34
Theme/Backend/Lang/zh.lang.php
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Localization
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
return ['ContractManagement' => [
|
||||
'Account' => '#VALUE!',
|
||||
'AutoRenewal' => '',
|
||||
'Contract' => '合同',
|
||||
'ContractTypes' => '',
|
||||
'Contracts' => '合同',
|
||||
'Costs' => '',
|
||||
'Description' => '',
|
||||
'End' => '#VALUE!',
|
||||
'Files' => '#VALUE!',
|
||||
'Name' => '',
|
||||
'Overview' => '#VALUE!',
|
||||
'Parties' => '',
|
||||
'Start' => '',
|
||||
'Termination' => '',
|
||||
'Title' => '标题',
|
||||
'Type' => '',
|
||||
'Unit' => '',
|
||||
'With' => '',
|
||||
]];
|
||||
102
Theme/Backend/contract-list.tpl.php
Executable file
102
Theme/Backend/contract-list.tpl.php
Executable file
|
|
@ -0,0 +1,102 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\ContractManagement\Models\Contract[] $contracts
|
||||
*/
|
||||
$contracts = $this->data['contracts'] ?? [];
|
||||
|
||||
$previous = empty($contracts) ? '{/base}/contract/list' : '{/base}/contract/list?{?}&id=' . \reset($contracts)->id . '&ptype=p';
|
||||
$next = empty($contracts) ? '{/base}/contract/list' : '{/base}/contract/list?{?}&id=' . \end($contracts)->id . '&ptype=n';
|
||||
|
||||
$now = new \DateTime('now');
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Contracts'); ?><i class="lni lni-download download btn end-xs"></i></div>
|
||||
<div class="slider">
|
||||
<table id="contractList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="wf-100"><?= $this->getHtml('Title'); ?>
|
||||
<label for="contractList-sort-1">
|
||||
<input type="radio" name="contractList-sort" id="contractList-sort-1">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="contractList-sort-2">
|
||||
<input type="radio" name="contractList-sort" id="contractList-sort-2">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td class="wf-100"><?= $this->getHtml('With'); ?>
|
||||
<label for="contractList-sort-3">
|
||||
<input type="radio" name="contractList-sort" id="contractList-sort-3">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="contractList-sort-4">
|
||||
<input type="radio" name="contractList-sort" id="contractList-sort-4">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td><?= $this->getHtml('End'); ?>
|
||||
<label for="contractList-sort-5">
|
||||
<input type="radio" name="contractList-sort" id="contractList-sort-5">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="contractList-sort-6">
|
||||
<input type="radio" name="contractList-sort" id="contractList-sort-6">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<tbody>
|
||||
<?php foreach ($contracts as $key => $value) :
|
||||
$url = UriFactory::build('{/base}/contract/single?{?}&id=' . $value->id);
|
||||
|
||||
$type = 'ok';
|
||||
if (($value->end->getTimestamp() < $now->getTimestamp() && $value->end->getTimestamp() + 7776000 > $now->getTimestamp())
|
||||
|| ($value->end->getTimestamp() > $now->getTimestamp() && $value->end->getTimestamp() - 7776000 < $now->getTimestamp())
|
||||
) {
|
||||
$type = 'error';
|
||||
} elseif ($value->end->getTimestamp() < $now->getTimestamp()) {
|
||||
$type = 'info';
|
||||
} elseif ($value->end->getTimestamp() + 7776000 < $now->getTimestamp()) {
|
||||
$type = 'warning';
|
||||
}
|
||||
?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('Title'); ?>"><a href="<?= $url; ?>"><?= $this->printHtml($value->title); ?></a>
|
||||
<td data-label="<?= $this->getHtml('Account'); ?>"><a class="content" href="<?= UriFactory::build('{/base}/profile/single?{?}&for=' . $value->account->id); ?>"><?= $this->printHtml($value->account->name1); ?> <?= $this->printHtml($value->account->name2); ?></a>
|
||||
<td data-label="<?= $this->getHtml('End'); ?>"><a href="<?= $url; ?>"><span class="tag <?= $type; ?>"><?= $value->end !== null ? $value->end->format('Y-m-d') : ''; ?></span></a>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($previous); ?>"><?= $this->getHtml('Previous', '0', '0'); ?></a>
|
||||
<a tabindex="0" class="button" href="<?= UriFactory::build($next); ?>"><?= $this->getHtml('Next', '0', '0'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
120
Theme/Backend/contract-single.tpl.php
Executable file
120
Theme/Backend/contract-single.tpl.php
Executable file
|
|
@ -0,0 +1,120 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ContractManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* @var \phpOMS\Views\View $this
|
||||
* @var \Modules\ContractManagement\Models\Contract $contract
|
||||
*/
|
||||
$contract = $this->data['contract'];
|
||||
$contractFile = $contract->files;
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
||||
<div class="tabview tab-2">
|
||||
<div class="box">
|
||||
<ul class="tab-links">
|
||||
<li><label for="c-tab-1"><?= $this->getHtml('Overview'); ?></label></li>
|
||||
<li><label for="c-tab-2"><?= $this->getHtml('Files'); ?></label></li>
|
||||
<li><label for="c-tab-3"><?= $this->getHtml('Notes', 'Editor', 'Backend'); ?></label></li>
|
||||
<!-- if parrent contract show all parties that use this template/parent contract (e.g. show all customers who have this contract)
|
||||
<li><label for="c-tab-4"><?= $this->getHtml('Parties'); ?></label></li>
|
||||
-->
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-content">
|
||||
<input type="radio" id="c-tab-1" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-1' ? ' checked' : ''; ?>>
|
||||
<div class="tab">
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('Contract'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<input type="text" id="iId" name="id" value="<?= $contract->id; ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iTitle"><?= $this->getHtml('Title'); ?></label>
|
||||
<input type="text" id="iTitle" name="title" value="<?= $this->printHtml($contract->title); ?>" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iType"><?= $this->getHtml('Type'); ?></label>
|
||||
<select id="iType" name="type" data-tpl-text="/type" data-tpl-value="/type">
|
||||
<?php
|
||||
$types = $this->data['contractTypes'] ?? [];
|
||||
foreach ($types as $type) : ?>
|
||||
<option value="<?= $type->id; ?>" <?= $type->id === $contract->type->id ? ' selected' : ''; ?>><?= $this->printHtml($type->getL11n()); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iDescription"><?= $this->getHtml('Description'); ?></label>
|
||||
<pre id="iDescription" class="textarea contenteditable" name="description" contenteditable="true"><?= $this->printHtml($contract->description); ?></pre>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iStart"><?= $this->getHtml('Start'); ?></label>
|
||||
<input type="datetime-local" id="iStart" name="start" value="<?= $this->printHtml($contract->start->format('Y-m-d\TH:i:s')); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iEnd"><?= $this->getHtml('End'); ?></label>
|
||||
<input type="datetime-local" id="iEnd" name="end" value="<?= $this->printHtml($contract->end->format('Y-m-d\TH:i:s')); ?>">
|
||||
</div>
|
||||
|
||||
<label class="checkbox" for="iAutoRenewal">
|
||||
<input id="iAutoRenewal" type="checkbox" name="auto_renewal" value="1"<?= $contract->autoRenewal ? ' checked' : ''; ?>>
|
||||
<span class="checkmark"></span>
|
||||
<?= $this->getHtml('AutoRenewal'); ?>
|
||||
</label>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iTermination"><?= $this->getHtml('Termination'); ?></label>
|
||||
<input type="number" min="0" step="1" id="iTermination" name="termination" value="<?= $this->printHtml((string) $contract->renewal); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iCosts"><?= $this->getHtml('Costs'); ?></label>
|
||||
<input type="number" id="iCosts" name="Costs" value="<?= $contract->costs === null ? '0' : $this->getCurrency($contract->costs, symbol: ''); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iUnit"><?= $this->getHtml('Unit'); ?></label>
|
||||
<select id="iUnit" name="unit">
|
||||
<option value="">
|
||||
<?php
|
||||
$units = $this->data['units'] ?? [];
|
||||
foreach ($units as $unit) : ?>
|
||||
<option value="<?= $unit->id; ?>"<?= $contract->unit->id === $unit->id ? ' selected' : ''; ?>><?= $this->printHtml($unit->name); ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
|
||||
<div class="tab col-simple">
|
||||
<?= $this->data['media-upload']->render('contract-file', 'files', '', $contract->files); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
71
Theme/Backend/contract-type-list.tpl.php
Normal file
71
Theme/Backend/contract-type-list.tpl.php
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\ItemManagement
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
$types = $this->data['types'];
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<section class="portlet">
|
||||
<div class="portlet-head"><?= $this->getHtml('ContractTypes', 'Contract', 'Backend'); ?><i class="lni lni-download download btn end-xs"></i></div>
|
||||
<div class="slider">
|
||||
<table id="iContractTypeList" class="default sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
||||
<label for="iContractTypeList-sort-1">
|
||||
<input type="radio" name="iContractTypeList-sort" id="iContractTypeList-sort-1">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="iContractTypeList-sort-2">
|
||||
<input type="radio" name="iContractTypeList-sort" id="iContractTypeList-sort-2">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
||||
<label for="iContractTypeList-sort-2">
|
||||
<input type="radio" name="iContractTypeList-sort" id="iContractTypeList-sort-2">
|
||||
<i class="sort-asc fa fa-chevron-up"></i>
|
||||
</label>
|
||||
<label for="iContractTypeList-sort-3">
|
||||
<input type="radio" name="iContractTypeList-sort" id="iContractTypeList-sort-3">
|
||||
<i class="sort-desc fa fa-chevron-down"></i>
|
||||
</label>
|
||||
<label>
|
||||
<i class="filter fa fa-filter"></i>
|
||||
</label>
|
||||
<tbody>
|
||||
<?php
|
||||
$count = 0;
|
||||
foreach ($types as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/base}/contract/type/profile?{?}&id=' . $value->id);
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td><a href="<?= $url; ?>"><?= $value->id; ?></a>
|
||||
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n()); ?></a>
|
||||
<?php endforeach; ?>
|
||||
<?php if ($count === 0) : ?>
|
||||
<tr><td colspan="2" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
|
||||
<?php endif; ?>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
0
Theme/Backend/contract-type.tpl.php
Normal file
0
Theme/Backend/contract-type.tpl.php
Normal file
23
composer.json
Normal file
23
composer.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "karaka/module",
|
||||
"description": "Module for Jingga.",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Dennis Eichhorn",
|
||||
"email": "spl1nes.com@googlemail.com"
|
||||
}
|
||||
],
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": ">=9.4",
|
||||
"friendsofphp/php-cs-fixer": ">=3.8",
|
||||
"squizlabs/php_codesniffer": ">=3.6",
|
||||
"phpmd/phpmd": ">=2.9",
|
||||
"phpstan/phpstan": ">=1.8.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
|
||||
}
|
||||
4856
composer.lock
generated
Normal file
4856
composer.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
52
info.json
Executable file
52
info.json
Executable file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": {
|
||||
"id": 1007900000,
|
||||
"internal": "ContractManagement",
|
||||
"external": "ContractManagement"
|
||||
},
|
||||
"category": "Tools",
|
||||
"version": "1.0.0",
|
||||
"requirements": {
|
||||
"phpOMS": "1.0.0",
|
||||
"phpOMS-db": "1.0.0"
|
||||
},
|
||||
"creator": {
|
||||
"name": "Jingga",
|
||||
"website": "jingga.app"
|
||||
},
|
||||
"description": "ContractManagement module.",
|
||||
"directory": "ContractManagement",
|
||||
"dependencies": {
|
||||
"Admin": "1.0.0",
|
||||
"Calendar": "1.0.0",
|
||||
"Media": "1.0.0",
|
||||
"Editor": "1.0.0",
|
||||
"Tag": "1.0.0"
|
||||
},
|
||||
"providing": {
|
||||
"Navigation": "*",
|
||||
"Admin": "*",
|
||||
"Media": "*",
|
||||
"Search": "*"
|
||||
},
|
||||
"load": [
|
||||
{
|
||||
"pid": [
|
||||
"/contract"
|
||||
],
|
||||
"type": 4,
|
||||
"for": 0,
|
||||
"from": "ContractManagement",
|
||||
"file": "ContractManagement"
|
||||
},
|
||||
{
|
||||
"pid": [
|
||||
"/"
|
||||
],
|
||||
"type": 5,
|
||||
"from": "ContractManagement",
|
||||
"for": "Navigation",
|
||||
"file": "Navigation"
|
||||
}
|
||||
]
|
||||
}
|
||||
27
tests/Admin/AdminTest.php
Executable file
27
tests/Admin/AdminTest.php
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\tests\Admin;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
final class AdminTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
protected const NAME = 'ContractManagement';
|
||||
|
||||
protected const URI_LOAD = 'http://127.0.0.1/en/backend/contract';
|
||||
|
||||
use \tests\Modules\ModuleTestTrait;
|
||||
}
|
||||
111
tests/Autoloader.php
Normal file
111
tests/Autoloader.php
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules/tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\tests;
|
||||
|
||||
\spl_autoload_register('\Modules\ContractManagement\tests\Autoloader::defaultAutoloader');
|
||||
|
||||
/**
|
||||
* Autoloader class.
|
||||
*
|
||||
* @package tests
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class Autoloader
|
||||
{
|
||||
/**
|
||||
* Base paths for autoloading
|
||||
*
|
||||
* @var string[]
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private static $paths = [
|
||||
__DIR__ . '/../',
|
||||
__DIR__ . '/../MainRepository/',
|
||||
__DIR__ . '/../../',
|
||||
];
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Add base path for autoloading
|
||||
*
|
||||
* @param string $path Absolute base path with / at the end
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function addPath(string $path) : void
|
||||
{
|
||||
self::$paths[] = \rtrim($path, '/\\') . '/';
|
||||
}
|
||||
|
||||
/**
|
||||
* Loading classes by namespace + class name.
|
||||
*
|
||||
* @param string $class Class path
|
||||
*
|
||||
* @example Autoloader::defaultAutoloader('\phpOMS\Autoloader') // void
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public static function defaultAutoloader(string $class) : void
|
||||
{
|
||||
$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/', '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) {
|
||||
if (($file = \realpath($path . $class2 . '.php')) !== false && \stripos($file, $class3) !== false) {
|
||||
include_once $file;
|
||||
|
||||
return;
|
||||
} elseif (\is_file($file = $path . $class . '.php')) {
|
||||
include_once $file;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
490
tests/Bootstrap.php
Normal file
490
tests/Bootstrap.php
Normal file
|
|
@ -0,0 +1,490 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
\ini_set('memory_limit', '2048M');
|
||||
\ini_set('display_errors', '1');
|
||||
\ini_set('display_startup_errors', '1');
|
||||
\error_reporting(\E_ALL);
|
||||
\setlocale(\LC_ALL, 'en_US.UTF-8');
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
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' => [
|
||||
'core' => [
|
||||
'masters' => [
|
||||
'admin' => [
|
||||
'db' => 'mysql', /* db type */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '3306', /* db host port */
|
||||
'login' => 'root', /* db login name */
|
||||
'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 */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '3306', /* db host port */
|
||||
'login' => 'root', /* db login name */
|
||||
'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 */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '3306', /* db host port */
|
||||
'login' => 'root', /* db login name */
|
||||
'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 */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '3306', /* db host port */
|
||||
'login' => 'root', /* db login name */
|
||||
'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 */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '3306', /* db host port */
|
||||
'login' => 'root', /* db login name */
|
||||
'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 */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '3306', /* db host port */
|
||||
'login' => 'root', /* db login name */
|
||||
'password' => 'root', /* db login password */
|
||||
'database' => 'oms', /* db name */
|
||||
'weight' => 1000, /* db table prefix */
|
||||
'datetimeformat' => 'Y-m-d H:i:s',
|
||||
],
|
||||
],
|
||||
'postgresql' => [
|
||||
'admin' => [
|
||||
'db' => 'pgsql', /* db type */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '5432', /* db host port */
|
||||
'login' => 'postgres', /* db login name */
|
||||
'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 */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '5432', /* db host port */
|
||||
'login' => 'postgres', /* db login name */
|
||||
'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 */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '5432', /* db host port */
|
||||
'login' => 'postgres', /* db login name */
|
||||
'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 */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '5432', /* db host port */
|
||||
'login' => 'postgres', /* db login name */
|
||||
'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 */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '5432', /* db host port */
|
||||
'login' => 'postgres', /* db login name */
|
||||
'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 */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '5432', /* db host port */
|
||||
'login' => 'postgres', /* db login name */
|
||||
'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__ . '/../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__ . '/../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__ . '/../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__ . '/../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__ . '/../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__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||
'weight' => 1000, /* db table prefix */
|
||||
'datetimeformat' => 'Y-m-d H:i:s',
|
||||
],
|
||||
],
|
||||
'mssql' => [
|
||||
'admin' => [
|
||||
'db' => 'mssql', /* db type */
|
||||
'host' => '127.0.0.1', /* db host address */
|
||||
'port' => '1433', /* db host port */
|
||||
'login' => 'sa', /* db login name */
|
||||
'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' => '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' => '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' => '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' => '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' => 'c0MplicatedP@ssword', /* db login password */
|
||||
'database' => 'oms', /* db name */
|
||||
'weight' => 1000, /* db table prefix */
|
||||
'datetimeformat' => 'Y-m-d H:i:s',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
'cache' => [
|
||||
'redis' => [
|
||||
'db' => 1,
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 6379,
|
||||
],
|
||||
'memcached' => [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 11211,
|
||||
],
|
||||
],
|
||||
'mail' => [
|
||||
'imap' => [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 143,
|
||||
'ssl' => false,
|
||||
'user' => 'test',
|
||||
'password' => '123456',
|
||||
],
|
||||
'pop3' => [
|
||||
'host' => '127.0.0.1',
|
||||
'port' => 25,
|
||||
'ssl' => false,
|
||||
'user' => 'test',
|
||||
'password' => '123456',
|
||||
],
|
||||
],
|
||||
'log' => [
|
||||
'file' => [
|
||||
'path' => __DIR__ . '/Logs',
|
||||
],
|
||||
],
|
||||
'page' => [
|
||||
'root' => '/',
|
||||
'https' => false,
|
||||
],
|
||||
'app' => [
|
||||
'path' => __DIR__,
|
||||
'default' => [
|
||||
'app' => 'Backend',
|
||||
'id' => 'backend',
|
||||
'lang' => 'en',
|
||||
'theme' => 'Backend',
|
||||
'org' => 1,
|
||||
],
|
||||
'domains' => [
|
||||
'127.0.0.1' => [
|
||||
'app' => 'Backend',
|
||||
'id' => 'backend',
|
||||
'lang' => 'en',
|
||||
'theme' => 'Backend',
|
||||
'org' => 1,
|
||||
],
|
||||
],
|
||||
],
|
||||
'socket' => [
|
||||
'master' => [
|
||||
'host' => '127.0.0.1',
|
||||
'limit' => 300,
|
||||
'port' => 4310,
|
||||
],
|
||||
],
|
||||
'language' => [
|
||||
'en',
|
||||
],
|
||||
'apis' => [
|
||||
],
|
||||
];
|
||||
|
||||
// Reset database
|
||||
if (\defined('RESET') && RESET === '1') {
|
||||
if (\extension_loaded('pdo_mysql')) {
|
||||
try {
|
||||
$db = new \PDO('mysql:host=' .
|
||||
$CONFIG['db']['core']['masters']['admin']['host'],
|
||||
$CONFIG['db']['core']['masters']['admin']['login'],
|
||||
$CONFIG['db']['core']['masters']['admin']['password']
|
||||
);
|
||||
$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 $_) {
|
||||
echo "\nCouldn't connect to MYSQL DB\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (\extension_loaded('pdo_pgsql')) {
|
||||
try {
|
||||
$db = new \PDO('pgsql:host=' .
|
||||
$CONFIG['db']['core']['postgresql']['admin']['host'],
|
||||
$CONFIG['db']['core']['postgresql']['admin']['login'],
|
||||
$CONFIG['db']['core']['postgresql']['admin']['password']
|
||||
);
|
||||
$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 $_) {
|
||||
echo "\nCouldn't connect to POSTGRESQL DB\n";
|
||||
}
|
||||
}
|
||||
|
||||
if (\extension_loaded('pdo_sqlsrv')) {
|
||||
try {
|
||||
$db = new \PDO('sqlsrv:Server=' .
|
||||
$CONFIG['db']['core']['mssql']['admin']['host'],
|
||||
$CONFIG['db']['core']['mssql']['admin']['login'],
|
||||
$CONFIG['db']['core']['mssql']['admin']['password']
|
||||
);
|
||||
$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 $_) {
|
||||
echo "\nCouldn't connect to MSSQL DB\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$httpSession = new HttpSession();
|
||||
$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('schema', $CONFIG['db']['core']['masters']['schema']);
|
||||
|
||||
DataMapperFactory::db($GLOBALS['dbpool']->get());
|
||||
|
||||
$GLOBALS['frameworkpath'] = '/phpOMS/';
|
||||
|
||||
function phpServe() : void
|
||||
{
|
||||
// OS detection
|
||||
$isWindows = \stristr(\php_uname('s'), 'Windows') !== false;
|
||||
|
||||
// Command that starts the built-in web server
|
||||
if ($isWindows) {
|
||||
$command = \sprintf(
|
||||
'wmic process call create "php -S %s:%d -t %s" | find "ProcessId"',
|
||||
WEB_SERVER_HOST,
|
||||
WEB_SERVER_PORT,
|
||||
__DIR__ . '/../' . WEB_SERVER_DOCROOT
|
||||
);
|
||||
|
||||
$killCommand = 'taskkill /f /pid ';
|
||||
} else {
|
||||
$command = \sprintf(
|
||||
'php -S %s:%d -t %s >/dev/null 2>&1 & echo $!',
|
||||
WEB_SERVER_HOST,
|
||||
WEB_SERVER_PORT,
|
||||
WEB_SERVER_DOCROOT
|
||||
);
|
||||
|
||||
$killCommand = 'kill ';
|
||||
}
|
||||
|
||||
// Execute the command and store the process ID
|
||||
$output = [];
|
||||
echo 'Starting server...' . \PHP_EOL;
|
||||
echo \sprintf(' Current directory: %s', \getcwd()) . \PHP_EOL;
|
||||
echo \sprintf(' %s', $command);
|
||||
\exec($command, $output);
|
||||
|
||||
// Get PID
|
||||
if ($isWindows) {
|
||||
$pid = \explode('=', $output[0]);
|
||||
$pid = \str_replace(' ', '', $pid[1]);
|
||||
$pid = \str_replace(';', '', $pid);
|
||||
} else {
|
||||
$pid = (int) $output[0];
|
||||
}
|
||||
|
||||
// Log
|
||||
echo \sprintf(
|
||||
' %s - Web server started on %s:%d with PID %d',
|
||||
\date('r'),
|
||||
WEB_SERVER_HOST,
|
||||
WEB_SERVER_PORT,
|
||||
$pid
|
||||
) . \PHP_EOL;
|
||||
|
||||
// Kill the web server when the process ends
|
||||
\register_shutdown_function(function() use ($killCommand, $pid) : void {
|
||||
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();
|
||||
}
|
||||
220
tests/Controller/Api/ApiControllerAttributeTrait.php
Normal file
220
tests/Controller/Api/ApiControllerAttributeTrait.php
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\tests\Controller\Api;
|
||||
|
||||
use phpOMS\Localization\ISO3166TwoEnum;
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Uri\HttpUri;
|
||||
|
||||
trait ApiControllerAttributeTrait
|
||||
{
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractAttributeTypeCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('title', 'EN:1');
|
||||
$request->setData('name', 'test_name');
|
||||
$request->setData('language', ISO639x1Enum::_EN);
|
||||
|
||||
$this->attrModule->apiContractAttributeTypeCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractAttributeTypeL11nCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('title', 'DE:2');
|
||||
$request->setData('type', '1');
|
||||
$request->setData('language', ISO639x1Enum::_DE);
|
||||
|
||||
$this->attrModule->apiContractAttributeTypeL11nCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractAttributeValueIntCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('default', '1');
|
||||
$request->setData('type', '1');
|
||||
$request->setData('value', '1');
|
||||
$request->setData('language', ISO639x1Enum::_DE);
|
||||
$request->setData('country', ISO3166TwoEnum::_DEU);
|
||||
|
||||
$this->attrModule->apiContractAttributeValueCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractAttributeValueStrCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('value', '1');
|
||||
$request->setData('type', '1');
|
||||
$request->setData('language', ISO639x1Enum::_DE);
|
||||
$request->setData('country', ISO3166TwoEnum::_DEU);
|
||||
|
||||
$this->attrModule->apiContractAttributeValueCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractAttributeValueFloatCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('value', '1.1');
|
||||
$request->setData('type', '1');
|
||||
$request->setData('language', ISO639x1Enum::_DE);
|
||||
$request->setData('country', ISO3166TwoEnum::_DEU);
|
||||
|
||||
$this->attrModule->apiContractAttributeValueCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractAttributeValueDatCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('value', '2020-08-02');
|
||||
$request->setData('type', '1');
|
||||
$request->setData('language', ISO639x1Enum::_DE);
|
||||
$request->setData('country', ISO3166TwoEnum::_DEU);
|
||||
|
||||
$this->attrModule->apiContractAttributeValueCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractAttributeCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('ref', '1');
|
||||
$request->setData('value', '1');
|
||||
$request->setData('type', '1');
|
||||
|
||||
$this->attrModule->apiContractAttributeCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractAttributeValueCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('invalid', '1');
|
||||
|
||||
$this->attrModule->apiContractAttributeValueCreate($request, $response);
|
||||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractAttributeTypeCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('invalid', '1');
|
||||
|
||||
$this->attrModule->apiContractAttributeTypeCreate($request, $response);
|
||||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractAttributeTypeL11nCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('invalid', '1');
|
||||
|
||||
$this->attrModule->apiContractAttributeTypeL11nCreate($request, $response);
|
||||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractAttributeCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('invalid', '1');
|
||||
|
||||
$this->attrModule->apiContractAttributeCreate($request, $response);
|
||||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
}
|
||||
107
tests/Controller/Api/ApiControllerContractTrait.php
Normal file
107
tests/Controller/Api/ApiControllerContractTrait.php
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\tests\Controller\Api;
|
||||
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Uri\HttpUri;
|
||||
use phpOMS\Utils\TestUtils;
|
||||
|
||||
trait ApiControllerContractTrait
|
||||
{
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('title', 'Title');
|
||||
$request->setData('start', '2010-10-09');
|
||||
$request->setData('end', '2011-10-09');
|
||||
$request->setData('duration', '2');
|
||||
$request->setData('type', '1');
|
||||
|
||||
$this->module->apiContractCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('invalid', '1');
|
||||
|
||||
$this->module->apiContractCreate($request, $response);
|
||||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractDocCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
if (!\is_file(__DIR__ . '/test_tmp.pdf')) {
|
||||
\copy(__DIR__ . '/test.pdf', __DIR__ . '/test_tmp.pdf');
|
||||
}
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('contract', 1);
|
||||
$request->setData('contract_title', 'Test title');
|
||||
|
||||
TestUtils::setMember($request, 'files', [
|
||||
'file1' => [
|
||||
'name' => 'test.pdf',
|
||||
'type' => 'pdf',
|
||||
'tmp_name' => __DIR__ . '/test_tmp.pdf',
|
||||
'error' => \UPLOAD_ERR_OK,
|
||||
'size' => \filesize(__DIR__ . '/test_tmp.pdf'),
|
||||
],
|
||||
]);
|
||||
|
||||
$this->module->apiContractDocumentCreate($request, $response);
|
||||
self::assertCount(1, $response->get('')['response']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractDocCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('invalid', '1');
|
||||
|
||||
$this->module->apiContractCreate($request, $response);
|
||||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
}
|
||||
91
tests/Controller/Api/ApiControllerContractTypeTrait.php
Normal file
91
tests/Controller/Api/ApiControllerContractTypeTrait.php
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package tests
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\ContractManagement\tests\Controller\Api;
|
||||
|
||||
use phpOMS\Localization\ISO639x1Enum;
|
||||
use phpOMS\Message\Http\HttpRequest;
|
||||
use phpOMS\Message\Http\HttpResponse;
|
||||
use phpOMS\Message\Http\RequestStatusCode;
|
||||
use phpOMS\Uri\HttpUri;
|
||||
|
||||
trait ApiControllerContractTypeTrait
|
||||
{
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractTypeCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('title', 'Test');
|
||||
$request->setData('language', ISO639x1Enum::_EN);
|
||||
|
||||
$this->typeModule->apiContractTypeCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractTypeCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('invalid', '1');
|
||||
|
||||
$this->typeModule->apiContractTypeCreate($request, $response);
|
||||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractTypeL11nCreate() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('title', 'Test');
|
||||
$request->setData('type', '1');
|
||||
$request->setData('language', ISO639x1Enum::_DE);
|
||||
|
||||
$this->typeModule->apiContractTypeL11nCreate($request, $response);
|
||||
self::assertGreaterThan(0, $response->get('')['response']->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Modules\ContractManagement\Controller\ApiController
|
||||
* @group module
|
||||
*/
|
||||
public function testApiContractTypeL11nCreateInvalidData() : void
|
||||
{
|
||||
$response = new HttpResponse();
|
||||
$request = new HttpRequest(new HttpUri(''));
|
||||
|
||||
$request->header->account = 1;
|
||||
$request->setData('invalid', '1');
|
||||
|
||||
$this->typeModule->apiContractTypeL11nCreate($request, $response);
|
||||
self::assertEquals(RequestStatusCode::R_400, $response->header->status);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user