mirror of
https://github.com/Karaka-Management/oms-Accounting.git
synced 2026-01-11 13:28:40 +00:00
bump
This commit is contained in:
parent
899971b1e3
commit
20a23ae678
143
Admin/Routes/Web/Api.php
Normal file
143
Admin/Routes/Web/Api.php
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
<?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\Accounting\Controller\ApiController;
|
||||
use Modules\Accounting\Models\PermissionCategory;
|
||||
use phpOMS\Account\PermissionType;
|
||||
use phpOMS\Router\RouteVerb;
|
||||
|
||||
return [
|
||||
'^.*/accounting/coa(\?.*|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiAccountCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::ACCOUNT,
|
||||
],
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiAccountUpdate',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::ACCOUNT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/coa/l11n(\?.*|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiAccountL11nCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::ACCOUNT,
|
||||
],
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiAccountL11nUpdate',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::ACCOUNT,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'^.*/accounting/costcenter(\?.*|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiCostCenterCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::COST_CENTER,
|
||||
],
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiCostCenterUpdate',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::COST_CENTER,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/costcenter/l11n(\?.*|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiCostCenterL11nCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::COST_CENTER,
|
||||
],
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiCostCenterL11nUpdate',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::COST_CENTER,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'^.*/accounting/costobject(\?.*|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiCostObjectCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::COST_OBJECT,
|
||||
],
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiCostObjectUpdate',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::COST_OBJECT,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/costobject/l11n(\?.*|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiCostObjectL11nCreate',
|
||||
'verb' => RouteVerb::PUT,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::COST_OBJECT,
|
||||
],
|
||||
],
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\ApiController:apiCostObjectL11nUpdate',
|
||||
'verb' => RouteVerb::SET,
|
||||
'permission' => [
|
||||
'module' => ApiController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::COST_OBJECT,
|
||||
],
|
||||
],
|
||||
],
|
||||
];
|
||||
|
|
@ -195,6 +195,17 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/costcenter/create(\?.*$|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewCostCenterCreate',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::COST_CENTER,
|
||||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/costobject/view(\?.*$|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewCostObjectView',
|
||||
|
|
@ -206,6 +217,17 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^.*/accounting/costobject/create(\?.*$|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Accounting\Controller\BackendController:viewCostObjectCreate',
|
||||
'verb' => RouteVerb::GET,
|
||||
'permission' => [
|
||||
'module' => BackendController::NAME,
|
||||
'type' => PermissionType::CREATE,
|
||||
'state' => PermissionCategory::COST_OBJECT,
|
||||
],
|
||||
],
|
||||
],
|
||||
|
||||
'^.*/accounting/supplier/list(\?.*$|$)' => [
|
||||
[
|
||||
|
|
|
|||
|
|
@ -19,8 +19,10 @@ use Modules\Accounting\Models\AccountAbstractMapper;
|
|||
use Modules\Accounting\Models\AccountL11nMapper;
|
||||
use Modules\Accounting\Models\AccountType;
|
||||
use Modules\Accounting\Models\CostCenter;
|
||||
use Modules\Accounting\Models\CostCenterL11nMapper;
|
||||
use Modules\Accounting\Models\CostCenterMapper;
|
||||
use Modules\Accounting\Models\CostObject;
|
||||
use Modules\Accounting\Models\CostObjectL11nMapper;
|
||||
use Modules\Accounting\Models\CostObjectMapper;
|
||||
use Modules\Accounting\Models\Posting;
|
||||
use Modules\Accounting\Models\PostingElement;
|
||||
|
|
@ -111,7 +113,7 @@ final class ApiController extends Controller
|
|||
$person = null;
|
||||
|
||||
/** @var \Modules\Billing\Models\Bill $new */
|
||||
if ($new->client !== null) {
|
||||
if (($new->client?->id ?? 0) !== 0) {
|
||||
$new->client = \Modules\ClientManagement\Models\ClientMapper::get()
|
||||
->where('id', $new->client->id)
|
||||
->execute();
|
||||
|
|
@ -1020,4 +1022,138 @@ final class ApiController extends Controller
|
|||
|
||||
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 apiCostCenterL11nCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateCostCenterL11nCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$l11n = $this->createCostCenterL11nFromRequest($request);
|
||||
$this->createModel($request->header->account, $l11n, CostCenterL11nMapper::class, 'account_l11n', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $l11n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create item attribute l11n from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return BaseStringL11n
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createCostCenterL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
||||
{
|
||||
$l11n = new BaseStringL11n();
|
||||
$l11n->ref = $request->getDataInt('ref') ?? 0;
|
||||
$l11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
|
||||
$l11n->content = $request->getDataString('content') ?? '';
|
||||
|
||||
return $l11n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate item attribute l11n create request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateCostCenterL11nCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['content'] = !$request->hasData('content'))
|
||||
|| ($val['ref'] = !$request->hasData('ref'))
|
||||
) {
|
||||
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 apiCostObjectL11nCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
if (!empty($val = $this->validateCostObjectL11nCreate($request))) {
|
||||
$response->header->status = RequestStatusCode::R_400;
|
||||
$this->createInvalidCreateResponse($request, $response, $val);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$l11n = $this->createCostObjectL11nFromRequest($request);
|
||||
$this->createModel($request->header->account, $l11n, CostObjectL11nMapper::class, 'account_l11n', $request->getOrigin());
|
||||
$this->createStandardCreateResponse($request, $response, $l11n);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method to create item attribute l11n from request.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return BaseStringL11n
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function createCostObjectL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
||||
{
|
||||
$l11n = new BaseStringL11n();
|
||||
$l11n->ref = $request->getDataInt('ref') ?? 0;
|
||||
$l11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
|
||||
$l11n->content = $request->getDataString('content') ?? '';
|
||||
|
||||
return $l11n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate item attribute l11n create request
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
*
|
||||
* @return array<string, bool>
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
private function validateCostObjectL11nCreate(RequestAbstract $request) : array
|
||||
{
|
||||
$val = [];
|
||||
if (($val['content'] = !$request->hasData('content'))
|
||||
|| ($val['ref'] = !$request->hasData('ref'))
|
||||
) {
|
||||
return $val;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,14 @@ declare(strict_types=1);
|
|||
namespace Modules\Accounting\Controller;
|
||||
|
||||
use Modules\Accounting\Models\AccountAbstractMapper;
|
||||
use Modules\Accounting\Models\AccountL11nMapper;
|
||||
use Modules\Accounting\Models\CostCenterL11nMapper;
|
||||
use Modules\Accounting\Models\CostCenterMapper;
|
||||
use Modules\Accounting\Models\CostObjectL11nMapper;
|
||||
use Modules\Accounting\Models\CostObjectMapper;
|
||||
use Modules\Accounting\Models\NullAccountAbstract;
|
||||
use Modules\Accounting\Models\NullCostCenter;
|
||||
use Modules\Accounting\Models\NullCostObject;
|
||||
use Modules\Auditor\Models\AuditMapper;
|
||||
use Modules\ClientManagement\Models\Attribute\ClientAttributeTypeMapper;
|
||||
use Modules\ClientManagement\Models\ClientMapper;
|
||||
|
|
@ -217,6 +223,43 @@ final class BackendController extends Controller
|
|||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewAccountView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/Accounting/Theme/Backend/coa-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response);
|
||||
|
||||
$view->data['account'] = AccountAbstractMapper::get()
|
||||
->with('parent')
|
||||
->with('l11n')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->execute();
|
||||
|
||||
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
|
||||
|
||||
/** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */
|
||||
$l11nValues = AccountL11nMapper::getAll()
|
||||
->where('ref', $view->data['account']->id)
|
||||
->execute();
|
||||
|
||||
$view->data['l11nValues'] = $l11nValues;
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
|
|
@ -232,9 +275,57 @@ final class BackendController extends Controller
|
|||
public function viewCOACreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/Accounting/Theme/Backend/coa-create');
|
||||
$view->setTemplate('/Modules/Accounting/Theme/Backend/coa-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response);
|
||||
|
||||
$view->data['account'] = new NullAccountAbstract();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewCostObjectCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/Accounting/Theme/Backend/costobject-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002603001, $request, $response);
|
||||
|
||||
$view->data['costobject'] = new NullCostObject();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Routing end-point for application behavior.
|
||||
*
|
||||
* @param RequestAbstract $request Request
|
||||
* @param ResponseAbstract $response Response
|
||||
* @param array $data Generic data
|
||||
*
|
||||
* @return RenderableInterface
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function viewCostCenterCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/Accounting/Theme/Backend/costcenter-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002602001, $request, $response);
|
||||
|
||||
$view->data['costcenter'] = new NullCostCenter();
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
||||
|
|
@ -254,7 +345,23 @@ final class BackendController extends Controller
|
|||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/Accounting/Theme/Backend/costcenter-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response);
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002602001, $request, $response);
|
||||
|
||||
$view->data['costcenter'] = CostCenterMapper::get()
|
||||
->with('parent')
|
||||
->with('l11n')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->execute();
|
||||
|
||||
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
|
||||
|
||||
/** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */
|
||||
$l11nValues = CostCenterL11nMapper::getAll()
|
||||
->where('ref', $view->data['costcenter']->id)
|
||||
->execute();
|
||||
|
||||
$view->data['l11nValues'] = $l11nValues;
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
@ -275,7 +382,25 @@ final class BackendController extends Controller
|
|||
{
|
||||
$view = new View($this->app->l11nManager, $request, $response);
|
||||
$view->setTemplate('/Modules/Accounting/Theme/Backend/costobject-view');
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002604001, $request, $response);
|
||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1002603001, $request, $response);
|
||||
|
||||
$view->data['costobject'] = CostObjectMapper::get()
|
||||
->with('parent')
|
||||
->with('l11n')
|
||||
->where('id', (int) $request->getData('id'))
|
||||
->where('l11n/language', $response->header->l11n->language)
|
||||
->execute();
|
||||
|
||||
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
|
||||
|
||||
/** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */
|
||||
$l11nValues = CostObjectL11nMapper::getAll()
|
||||
->where('ref', $view->data['costobject']->id)
|
||||
->execute();
|
||||
|
||||
$view->data['l11nValues'] = $l11nValues;
|
||||
|
||||
return $view;
|
||||
|
||||
return $view;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,49 @@ class AccountAbstract
|
|||
*/
|
||||
public ?int $summaryAccount = null;
|
||||
|
||||
// Tax accounts can be defined in:
|
||||
// 1. Account (gross postings are automatically split)
|
||||
// 2. Tax code
|
||||
// 3. Tax combination
|
||||
public ?int $taxAccount1 = null;
|
||||
|
||||
public ?int $taxAccount2 = null;
|
||||
|
||||
public int $taxCodeRequirement = RequirementType::ALLOWED;
|
||||
public ?int $defaultTaxCode = null;
|
||||
public ?int $mandatoryTaxCode = null;
|
||||
|
||||
public int $costCenterRequirement = RequirementType::ALLOWED;
|
||||
public ?int $defaultCostCenter = null;
|
||||
public ?int $mandatoryCostCenter = null;
|
||||
|
||||
public int $costObjectRequirement = RequirementType::ALLOWED;
|
||||
public ?int $defaultCostObject = null;
|
||||
public ?int $mandatoryCostObject = null;
|
||||
|
||||
// Indicators and report position for different reports (e.g. EÜR, ZM, UVA, OSS)
|
||||
public array $reportIndicators = [];
|
||||
|
||||
public bool $manualPosting = true;
|
||||
|
||||
public string $currency = '';
|
||||
|
||||
public bool $isConfidential = false;
|
||||
|
||||
public bool $isMoneyAccount = false;
|
||||
|
||||
public bool $isCashflowAccount = false;
|
||||
|
||||
public bool $hasOpenPositions = false;
|
||||
|
||||
public bool $createOpeningBalancePosting = false;
|
||||
|
||||
public int $status = AccountStatus::ACTIVE;
|
||||
|
||||
public ?\DateTime $start = null;
|
||||
|
||||
public ?\DateTime $end = null;
|
||||
|
||||
/**
|
||||
* Type.
|
||||
*
|
||||
|
|
|
|||
32
Models/AccountStatus.php
Normal file
32
Models/AccountStatus.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Accounting\Models;
|
||||
|
||||
use phpOMS\Stdlib\Base\Enum;
|
||||
|
||||
/**
|
||||
* Account type enum.
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract class AccountStatus extends Enum
|
||||
{
|
||||
public const ACTIVE = 1;
|
||||
|
||||
public const INACTIVE = 2;
|
||||
}
|
||||
47
Models/NullPosting.php
Normal file
47
Models/NullPosting.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Accounting\Models;
|
||||
|
||||
/**
|
||||
* Null model
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
final class NullPosting extends Posting
|
||||
{
|
||||
/**
|
||||
* 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];
|
||||
}
|
||||
}
|
||||
34
Models/RequirementType.php
Normal file
34
Models/RequirementType.php
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
/**
|
||||
* Jingga
|
||||
*
|
||||
* PHP Version 8.1
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 2.0
|
||||
* @version 1.0.0
|
||||
* @link https://jingga.app
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Modules\Accounting\Models;
|
||||
|
||||
use phpOMS\Stdlib\Base\Enum;
|
||||
|
||||
/**
|
||||
* Time range type enum.
|
||||
*
|
||||
* @package Modules\Accounting\Models
|
||||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*/
|
||||
abstract class RequirementType extends Enum
|
||||
{
|
||||
public const DISALLOWED = 0;
|
||||
|
||||
public const ALLOWED = 1;
|
||||
|
||||
public const REQUIRED = 2;
|
||||
}
|
||||
54
Theme/Backend/coa-view.tpl.php
Normal file
54
Theme/Backend/coa-view.tpl.php
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
$account = $this->data['account'];
|
||||
|
||||
$isNew = $account->id === 0;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
echo $this->data['nav']->render(); ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="portlet">
|
||||
<form method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}accounting/coa'); ?>">
|
||||
<div class="portlet-head"><?= $this->getHtml('Account'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<input type="text" name="id" id="iId" value="<?= $this->printHtml($account->id); ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iCode"><?= $this->getHtml('Code'); ?></label>
|
||||
<input type="text" name="code" id="iCode" value="<?= $this->printHtml($account->code); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iParent"><?= $this->getHtml('Parent'); ?></label>
|
||||
<input type="text" name="parent" id="iParent" value="<?= $this->printHtml($account->parent?->code); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iName"><?= $this->getHtml('Name'); ?></label>
|
||||
<input type="text" name="Name" id="iName" value="<?= $this->printHtml($account->getL11n()); ?>" disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<input id="iSubmit" name="submit" type="submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="row">
|
||||
<?= $this->data['l11nView']->render(
|
||||
$this->data['l11nValues'],
|
||||
[],
|
||||
'{/api}accounting/coa/l11n'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
@ -20,8 +20,8 @@ use phpOMS\Uri\UriFactory;
|
|||
*/
|
||||
$costcenter = $this->data['costcenter'];
|
||||
|
||||
$previous = empty($costcenter) ? '{/base}/tag/list' : '{/base}/tag/list?{?}&id=' . \reset($costcenter)->id . '&ptype=p';
|
||||
$next = empty($costcenter) ? '{/base}/tag/list' : '{/base}/tag/list?{?}&id=' . \end($costcenter)->id . '&ptype=n';
|
||||
$previous = empty($costcenter) ? '{/base}/accounting/costcenter/list' : '{/base}/accounting/costcenter/list?{?}&id=' . \reset($costcenter)->id . '&ptype=p';
|
||||
$next = empty($costcenter) ? '{/base}/accounting/costcenter/list' : '{/base}/accounting/costcenter/list?{?}&id=' . \end($costcenter)->id . '&ptype=n';
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
<div class="row">
|
||||
|
|
@ -35,7 +35,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach ($costcenter as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/base}/tag/view?{?}&id=' . $value->id); ?>
|
||||
$url = UriFactory::build('{/base}/accounting/costcenter/view?{?}&id=' . $value->id); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('Code'); ?>"><a href="<?= $url; ?>">
|
||||
<?= $this->printHtml($value->code); ?></a>
|
||||
|
|
|
|||
59
Theme/Backend/costcenter-view.tpl.php
Normal file
59
Theme/Backend/costcenter-view.tpl.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
$costcenter = $this->data['costcenter'];
|
||||
|
||||
$isNew = $costcenter->id === 0;
|
||||
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
echo $this->data['nav']->render(); ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="portlet">
|
||||
<form method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}accounting/costcenter'); ?>">
|
||||
<div class="portlet-head"><?= $this->getHtml('CostCenter'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<input type="text" name="id" id="iId" value="<?= $this->printHtml($costcenter->id); ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iCode"><?= $this->getHtml('Code'); ?></label>
|
||||
<input type="text" name="code" id="iCode" value="<?= $this->printHtml($costcenter->code); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iParent"><?= $this->getHtml('Parent'); ?></label>
|
||||
<input type="text" name="parent" id="iParent" value="<?= $this->printHtml($costcenter->parent?->code); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iName"><?= $this->getHtml('Name'); ?></label>
|
||||
<input type="text" name="Name" id="iName" value="<?= $this->printHtml($costcenter->getL11n()); ?>" disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($isNew) : ?>
|
||||
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
|
||||
<?php else : ?>
|
||||
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="row">
|
||||
<?= $this->data['l11nView']->render(
|
||||
$this->data['l11nValues'],
|
||||
[],
|
||||
'{/api}accounting/costcenter/l11n'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
|
@ -20,8 +20,8 @@ use phpOMS\Uri\UriFactory;
|
|||
*/
|
||||
$costobject = $this->data['costobject'];
|
||||
|
||||
$previous = empty($costobject) ? '{/base}/tag/list' : '{/base}/tag/list?{?}&id=' . \reset($costobject)->id . '&ptype=p';
|
||||
$next = empty($costobject) ? '{/base}/tag/list' : '{/base}/tag/list?{?}&id=' . \end($costobject)->id . '&ptype=n';
|
||||
$previous = empty($costobject) ? '{/base}/accounting/costobject/list' : '{/base}/accounting/costobject/list?{?}&id=' . \reset($costobject)->id . '&ptype=p';
|
||||
$next = empty($costobject) ? '{/base}/accounting/costobject/list' : '{/base}/accounting/costobject/list?{?}&id=' . \end($costobject)->id . '&ptype=n';
|
||||
|
||||
echo $this->data['nav']->render(); ?>
|
||||
<div class="row">
|
||||
|
|
@ -35,7 +35,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach ($costobject as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/base}/tag/view?{?}&id=' . $value->id); ?>
|
||||
$url = UriFactory::build('{/base}/accounting/costobject/view?{?}&id=' . $value->id); ?>
|
||||
<tr tabindex="0" data-href="<?= $url; ?>">
|
||||
<td data-label="<?= $this->getHtml('Code'); ?>"><a href="<?= $url; ?>">
|
||||
<?= $this->printHtml($value->code); ?></a>
|
||||
|
|
|
|||
58
Theme/Backend/costobject-view.tpl.php
Normal file
58
Theme/Backend/costobject-view.tpl.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
$costobject = $this->data['costobject'];
|
||||
|
||||
$isNew = $costobject->id === 0;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
echo $this->data['nav']->render(); ?>
|
||||
<div class="row">
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<section class="portlet">
|
||||
<form method="<?= $isNew ? 'PUT' : 'POST'; ?>" action="<?= UriFactory::build('{/api}accounting/costobject'); ?>">
|
||||
<div class="portlet-head"><?= $this->getHtml('CostCenter'); ?></div>
|
||||
<div class="portlet-body">
|
||||
<div class="form-group">
|
||||
<label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
|
||||
<input type="text" name="id" id="iId" value="<?= $this->printHtml($costobject->id); ?>" disabled>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iCode"><?= $this->getHtml('Code'); ?></label>
|
||||
<input type="text" name="code" id="iCode" value="<?= $this->printHtml($costobject->code); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iParent"><?= $this->getHtml('Parent'); ?></label>
|
||||
<input type="text" name="parent" id="iParent" value="<?= $this->printHtml($costobject->parent?->code); ?>">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="iName"><?= $this->getHtml('Name'); ?></label>
|
||||
<input type="text" name="Name" id="iName" value="<?= $this->printHtml($costobject->getL11n()); ?>" disabled>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-foot">
|
||||
<?php if ($isNew) : ?>
|
||||
<input id="iCreateSubmit" type="Submit" value="<?= $this->getHtml('Create', '0', '0'); ?>">
|
||||
<?php else : ?>
|
||||
<input id="iSaveSubmit" type="Submit" value="<?= $this->getHtml('Save', '0', '0'); ?>">
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!$isNew) : ?>
|
||||
<div class="row">
|
||||
<?= $this->data['l11nView']->render(
|
||||
$this->data['l11nValues'],
|
||||
[],
|
||||
'{/api}accounting/costobject/l11n'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
Loading…
Reference in New Issue
Block a user