This commit is contained in:
Dennis Eichhorn 2024-02-28 05:09:09 +00:00
parent b97f1df466
commit 899971b1e3
15 changed files with 78 additions and 92 deletions

View File

@ -1,35 +0,0 @@
---
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.

View File

@ -1,18 +0,0 @@
---
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.

View File

@ -19,7 +19,7 @@
"type": 2, "type": 2,
"subtype": 1, "subtype": 1,
"name": "CostCenters", "name": "CostCenters",
"uri": "{/base}/accounting/costcenter/list", "uri": "{/base}/accounting/costcenter/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 5, "order": 5,
@ -33,7 +33,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "List", "name": "List",
"uri": "{/base}/accounting/costcenter/list", "uri": "{/base}/accounting/costcenter/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 1, "order": 1,
@ -65,7 +65,7 @@
"type": 2, "type": 2,
"subtype": 1, "subtype": 1,
"name": "CostObjects", "name": "CostObjects",
"uri": "{/base}/accounting/costobject/list", "uri": "{/base}/accounting/costobject/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 5, "order": 5,
@ -79,7 +79,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "List", "name": "List",
"uri": "{/base}/accounting/costobject/list", "uri": "{/base}/accounting/costobject/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 1, "order": 1,
@ -111,7 +111,7 @@
"type": 2, "type": 2,
"subtype": 1, "subtype": 1,
"name": "Accounts", "name": "Accounts",
"uri": "{/base}/accounting/coa/list", "uri": "{/base}/accounting/coa/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 5, "order": 5,
@ -125,7 +125,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "List", "name": "List",
"uri": "{/base}/accounting/coa/list", "uri": "{/base}/accounting/coa/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 1, "order": 1,
@ -157,7 +157,7 @@
"type": 2, "type": 2,
"subtype": 1, "subtype": 1,
"name": "BatchPostings", "name": "BatchPostings",
"uri": "{/base}/accounting/stack/list", "uri": "{/base}/accounting/stack/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 10, "order": 10,
@ -171,7 +171,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "List", "name": "List",
"uri": "{/base}/accounting/stack/list", "uri": "{/base}/accounting/stack/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 5, "order": 5,
@ -186,7 +186,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "Archive", "name": "Archive",
"uri": "{/base}/accounting/stack/archive/list", "uri": "{/base}/accounting/stack/archive/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 10, "order": 10,
@ -201,7 +201,7 @@
"type": 3, "type": 3,
"subtype": 1, "subtype": 1,
"name": "Predefined", "name": "Predefined",
"uri": "{/base}/accounting/stack/predefined/list", "uri": "{/base}/accounting/stack/predefined/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 10, "order": 10,
@ -249,7 +249,7 @@
"type": 2, "type": 2,
"subtype": 1, "subtype": 1,
"name": "Suppliers", "name": "Suppliers",
"uri": "{/base}/accounting/supplier/list", "uri": "{/base}/accounting/supplier/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 1, "order": 1,
@ -265,7 +265,7 @@
"type": 2, "type": 2,
"subtype": 1, "subtype": 1,
"name": "Clients", "name": "Clients",
"uri": "{/base}/accounting/client/list", "uri": "{/base}/accounting/client/list?{?}",
"target": "self", "target": "self",
"icon": null, "icon": null,
"order": 1, "order": 1,

View File

@ -32,6 +32,14 @@
"null": true, "null": true,
"foreignTable": "account", "foreignTable": "account",
"foreignKey": "account_id" "foreignKey": "account_id"
},
"accounting_account_unit": {
"name": "accounting_account_unit",
"type": "INT",
"null": true,
"default": null,
"foreignTable": "unit",
"foreignKey": "unit_id"
} }
} }
}, },
@ -90,7 +98,8 @@
"accounting_costcenter_unit": { "accounting_costcenter_unit": {
"name": "accounting_costcenter_unit", "name": "accounting_costcenter_unit",
"type": "INT", "type": "INT",
"null": false, "null": true,
"default": null,
"foreignTable": "unit", "foreignTable": "unit",
"foreignKey": "unit_id" "foreignKey": "unit_id"
} }
@ -157,7 +166,8 @@
"accounting_costobject_unit": { "accounting_costobject_unit": {
"name": "accounting_costobject_unit", "name": "accounting_costobject_unit",
"type": "INT", "type": "INT",
"null": false, "null": true,
"default": null,
"foreignTable": "unit", "foreignTable": "unit",
"foreignKey": "unit_id" "foreignKey": "unit_id"
} }

View File

@ -63,7 +63,7 @@ final class Installer extends InstallerAbstract
private static function importAccounts(ApplicationAbstract $app) : void private static function importAccounts(ApplicationAbstract $app) : void
{ {
/** @var \Modules\Accounting\Controller\ApiController $module */ /** @var \Modules\Accounting\Controller\ApiController $module */
$module = $app->moduleManager->getModuleInstance('Accounting', 'Api'); $module = $app->moduleManager->get('Accounting', 'Api');
$fp = \fopen(__DIR__ . '/Install/Coa/SKR03_DE_GAAP.csv', 'r'); $fp = \fopen(__DIR__ . '/Install/Coa/SKR03_DE_GAAP.csv', 'r');
if ($fp === false) { if ($fp === false) {
@ -134,7 +134,7 @@ final class Installer extends InstallerAbstract
public static function importPersonalAccounts(ApplicationAbstract $app, string $type) : void public static function importPersonalAccounts(ApplicationAbstract $app, string $type) : void
{ {
/** @var \Modules\Accounting\Controller\ApiController $module */ /** @var \Modules\Accounting\Controller\ApiController $module */
$module = $app->moduleManager->getModuleInstance('Accounting', 'Api'); $module = $app->moduleManager->get('Accounting', 'Api');
$mapper = $type === 'client' $mapper = $type === 'client'
? \Modules\ClientManagement\Models\ClientMapper::class ? \Modules\ClientManagement\Models\ClientMapper::class

View File

@ -28,6 +28,7 @@ use Modules\Accounting\Models\PostingMapper;
use Modules\Accounting\Models\PostingSide; use Modules\Accounting\Models\PostingSide;
use Modules\Admin\Models\AccountMapper; use Modules\Admin\Models\AccountMapper;
use Modules\Admin\Models\NullAccount; use Modules\Admin\Models\NullAccount;
use Modules\Billing\Models\BillStatus;
use Modules\ItemManagement\Models\Attribute\ItemAttributeTypeMapper; use Modules\ItemManagement\Models\Attribute\ItemAttributeTypeMapper;
use Modules\ItemManagement\Models\Attribute\ItemAttributeValueMapper; use Modules\ItemManagement\Models\Attribute\ItemAttributeValueMapper;
use phpOMS\Localization\BaseStringL11n; use phpOMS\Localization\BaseStringL11n;
@ -82,7 +83,27 @@ final class ApiController extends Controller
?string $ip = null ?string $ip = null
) : void ) : void
{ {
if (!$new->type->isAccounting) { if (!$new->type->isAccounting
|| $new->status !== BillStatus::ARCHIVED
) {
return;
}
$posting = PostingMapper::get()
->where('bill', $new->id)
->limit(1)
->execute();
// Posting already created
if ($posting->id !== 0) {
\phpOMS\Log\FileLogger::getInstance()->warning(
\phpOMS\Log\FileLogger::MSG_FULL, [
'message' => 'Posting for bill "' . $new->id . '" already created',
'line' => __LINE__,
'file' => self::class,
]
);
return; return;
} }
@ -111,6 +132,7 @@ final class ApiController extends Controller
->execute(); ->execute();
$posting = new Posting(); $posting = new Posting();
$posting->bill = $new->id;
$posting->createdBy = new NullAccount($account); $posting->createdBy = new NullAccount($account);
$posting->unit = $new->unit; $posting->unit = $new->unit;
$posting->account = AccountAbstractMapper::get() $posting->account = AccountAbstractMapper::get()
@ -470,7 +492,7 @@ final class ApiController extends Controller
$request->getDataString('content') ?? '', $request->getDataString('content') ?? '',
ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN
); );
$costcenter->unit = $request->getDataInt('unit') ?? 1; $costcenter->unit = $request->getDataInt('unit');
return $costcenter; return $costcenter;
} }
@ -587,7 +609,7 @@ final class ApiController extends Controller
$request->getDataString('content') ?? '', $request->getDataString('content') ?? '',
ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN
); );
$costobject->unit = $request->getDataInt('unit') ?? 1; $costobject->unit = $request->getDataInt('unit');
return $costobject; return $costobject;
} }

View File

@ -429,10 +429,10 @@ final class BackendController extends Controller
$head = $response->data['Content']->head; $head = $response->data['Content']->head;
$nonce = $this->app->appSettings->getOption('script-nonce'); $nonce = $this->app->appSettings->getOption('script-nonce');
$head->addAsset(AssetType::CSS, 'Resources/chartjs/chart.css'); $head->addAsset(AssetType::CSS, 'Resources/chartjs/chart.css?v=' . $this->app->version);
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/chart.js', ['nonce' => $nonce]); $head->addAsset(AssetType::JSLATE, 'Resources/chartjs/chart.js?v=' . $this->app->version, ['nonce' => $nonce]);
$head->addAsset(AssetType::JSLATE, 'Resources/OpenLayers/OpenLayers.js', ['nonce' => $nonce]); $head->addAsset(AssetType::JSLATE, 'Resources/OpenLayers/OpenLayers.js?v=' . $this->app->version, ['nonce' => $nonce]);
$head->addAsset(AssetType::JSLATE, 'Modules/Accounting/Controller.js', ['nonce' => $nonce, 'type' => 'module']); $head->addAsset(AssetType::JSLATE, 'Modules/Accounting/Controller.js?v=' . self::VERSION, ['nonce' => $nonce, 'type' => 'module']);
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Accounting/Theme/Backend/personal-view'); $view->setTemplate('/Modules/Accounting/Theme/Backend/personal-view');
@ -494,10 +494,10 @@ final class BackendController extends Controller
$head = $response->data['Content']->head; $head = $response->data['Content']->head;
$nonce = $this->app->appSettings->getOption('script-nonce'); $nonce = $this->app->appSettings->getOption('script-nonce');
$head->addAsset(AssetType::CSS, 'Resources/chartjs/chart.css'); $head->addAsset(AssetType::CSS, 'Resources/chartjs/chart.css?v=' . $this->app->version);
$head->addAsset(AssetType::JSLATE, 'Resources/chartjs/chart.js', ['nonce' => $nonce]); $head->addAsset(AssetType::JSLATE, 'Resources/chartjs/chart.js?v=' . $this->app->version, ['nonce' => $nonce]);
$head->addAsset(AssetType::JSLATE, 'Resources/OpenLayers/OpenLayers.js', ['nonce' => $nonce]); $head->addAsset(AssetType::JSLATE, 'Resources/OpenLayers/OpenLayers.js?v=' . $this->app->version, ['nonce' => $nonce]);
$head->addAsset(AssetType::JSLATE, 'Modules/Accounting/Controller.js', ['nonce' => $nonce, 'type' => 'module']); $head->addAsset(AssetType::JSLATE, 'Modules/Accounting/Controller.js?v=' . self::VERSION, ['nonce' => $nonce, 'type' => 'module']);
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Accounting/Theme/Backend/personal-view'); $view->setTemplate('/Modules/Accounting/Theme/Backend/personal-view');

View File

@ -73,6 +73,8 @@ class AccountAbstract
*/ */
public array $entries = []; public array $entries = [];
public ?int $unit = null;
/** /**
* Get entry. * Get entry.
* *

View File

@ -41,6 +41,7 @@ class AccountAbstractMapper extends DataMapperFactory
'accounting_account_type' => ['name' => 'accounting_account_type', 'type' => 'int', 'internal' => 'type'], 'accounting_account_type' => ['name' => 'accounting_account_type', 'type' => 'int', 'internal' => 'type'],
'accounting_account_parent' => ['name' => 'accounting_account_parent', 'type' => 'int', 'internal' => 'parent'], 'accounting_account_parent' => ['name' => 'accounting_account_parent', 'type' => 'int', 'internal' => 'parent'],
'accounting_account_account' => ['name' => 'accounting_account_account', 'type' => 'int', 'internal' => 'account'], 'accounting_account_account' => ['name' => 'accounting_account_account', 'type' => 'int', 'internal' => 'account'],
'accounting_account_unit' => ['name' => 'accounting_account_unit', 'type' => 'int', 'internal' => 'unit'],
]; ];
/** /**

View File

@ -59,7 +59,7 @@ class CostCenter
*/ */
public $parent = null; public $parent = null;
public int $unit = 0; public ?int $unit = null;
/** /**
* Set l11n * Set l11n

View File

@ -59,7 +59,7 @@ class CostObject
*/ */
public $parent = null; public $parent = null;
public int $unit = 0; public ?int $unit = null;
/** /**
* Set l11n * Set l11n

View File

@ -24,4 +24,6 @@ return ['Navigation' => [
'Entries' => 'Einträge', 'Entries' => 'Einträge',
'Postings' => 'Buchungen', 'Postings' => 'Buchungen',
'Predefined' => 'Vordefiniert', 'Predefined' => 'Vordefiniert',
'Suppliers' => 'Lieferanten',
'Clients' => 'Kunden',
]]; ]];

View File

@ -24,4 +24,6 @@ return ['Navigation' => [
'Entries' => 'Entries', 'Entries' => 'Entries',
'Postings' => 'Postings', 'Postings' => 'Postings',
'Predefined' => 'Predefined', 'Predefined' => 'Predefined',
'Suppliers' => 'Suppliers',
'Clients' => 'Clients',
]]; ]];

View File

@ -189,7 +189,7 @@ echo $this->data['nav']->render(); ?>
</div> </div>
</section> </section>
<section class="portlet highlight-4"> <section class="portlet hl-4">
<div class="portlet-body"> <div class="portlet-body">
<textarea class="undecorated"><?= $this->printHtml($account->info); ?></textarea> <textarea class="undecorated"><?= $this->printHtml($account->info); ?></textarea>
</div> </div>
@ -200,7 +200,7 @@ echo $this->data['nav']->render(); ?>
<!-- If note warning exists --> <!-- If note warning exists -->
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<section class="portlet highlight-1"> <section class="portlet hl-1">
<div class="portlet-body"><?= $this->printHtml($warning->plain); ?></div> <div class="portlet-body"><?= $this->printHtml($warning->plain); ?></div>
</section> </section>
</div> </div>
@ -210,7 +210,7 @@ echo $this->data['nav']->render(); ?>
<?php if ($this->data['hasBilling']) : ?> <?php if ($this->data['hasBilling']) : ?>
<div class="row"> <div class="row">
<div class="col-xs-12 col-lg-4"> <div class="col-xs-12 col-lg-4">
<section class="portlet highlight-7"> <section class="portlet hl-7">
<div class="portlet-body"> <div class="portlet-body">
<table class="wf-100"> <table class="wf-100">
<tr><td><?= $this->getHtml('YTDSales'); ?>: <tr><td><?= $this->getHtml('YTDSales'); ?>:
@ -225,7 +225,7 @@ echo $this->data['nav']->render(); ?>
</div> </div>
<div class="col-xs-12 col-lg-4"> <div class="col-xs-12 col-lg-4">
<section class="portlet highlight-2"> <section class="portlet hl-2">
<div class="portlet-body"> <div class="portlet-body">
<table class="wf-100"> <table class="wf-100">
<tr><td><?= $this->getHtml('LastContact'); ?>: <tr><td><?= $this->getHtml('LastContact'); ?>:
@ -240,7 +240,7 @@ echo $this->data['nav']->render(); ?>
</div> </div>
<div class="col-xs-12 col-lg-4"> <div class="col-xs-12 col-lg-4">
<section class="portlet highlight-3"> <section class="portlet hl-3">
<div class="portlet-body"> <div class="portlet-body">
<table class="wf-100"> <table class="wf-100">
<tr><td><?= $this->getHtml('DSO'); ?>: <tr><td><?= $this->getHtml('DSO'); ?>:

View File

@ -189,7 +189,7 @@ echo $this->data['nav']->render(); ?>
</div> </div>
</section> </section>
<section class="portlet highlight-4"> <section class="portlet hl-4">
<div class="portlet-body"> <div class="portlet-body">
<textarea class="undecorated"><?= $this->printHtml($account->info); ?></textarea> <textarea class="undecorated"><?= $this->printHtml($account->info); ?></textarea>
</div> </div>
@ -200,7 +200,7 @@ echo $this->data['nav']->render(); ?>
<!-- If note warning exists --> <!-- If note warning exists -->
<div class="row"> <div class="row">
<div class="col-xs-12"> <div class="col-xs-12">
<section class="portlet highlight-1"> <section class="portlet hl-1">
<div class="portlet-body"><?= $this->printHtml($warning->plain); ?></div> <div class="portlet-body"><?= $this->printHtml($warning->plain); ?></div>
</section> </section>
</div> </div>
@ -210,7 +210,7 @@ echo $this->data['nav']->render(); ?>
<?php if ($this->data['hasBilling']) : ?> <?php if ($this->data['hasBilling']) : ?>
<div class="row"> <div class="row">
<div class="col-xs-12 col-lg-4"> <div class="col-xs-12 col-lg-4">
<section class="portlet highlight-7"> <section class="portlet hl-7">
<div class="portlet-body"> <div class="portlet-body">
<table class="wf-100"> <table class="wf-100">
<tr><td><?= $this->getHtml('YTDSales'); ?>: <tr><td><?= $this->getHtml('YTDSales'); ?>:
@ -225,7 +225,7 @@ echo $this->data['nav']->render(); ?>
</div> </div>
<div class="col-xs-12 col-lg-4"> <div class="col-xs-12 col-lg-4">
<section class="portlet highlight-2"> <section class="portlet hl-2">
<div class="portlet-body"> <div class="portlet-body">
<table class="wf-100"> <table class="wf-100">
<tr><td><?= $this->getHtml('LastContact'); ?>: <tr><td><?= $this->getHtml('LastContact'); ?>:
@ -240,7 +240,7 @@ echo $this->data['nav']->render(); ?>
</div> </div>
<div class="col-xs-12 col-lg-4"> <div class="col-xs-12 col-lg-4">
<section class="portlet highlight-3"> <section class="portlet hl-3">
<div class="portlet-body"> <div class="portlet-body">
<table class="wf-100"> <table class="wf-100">
<tr><td><?= $this->getHtml('DSO'); ?>: <tr><td><?= $this->getHtml('DSO'); ?>: