This commit is contained in:
Dennis Eichhorn 2024-02-04 20:34:11 +00:00
parent ce57535b7b
commit b97f1df466
4 changed files with 16 additions and 17 deletions

View File

@ -12,8 +12,7 @@
"accounting_account_code": { "accounting_account_code": {
"name": "accounting_account_code", "name": "accounting_account_code",
"type": "VARCHAR(50)", "type": "VARCHAR(50)",
"null": false, "null": false
"unique": true
}, },
"accounting_account_type": { "accounting_account_type": {
"name": "accounting_account_type", "name": "accounting_account_type",

View File

@ -148,13 +148,13 @@ final class Installer extends InstallerAbstract
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(); $request = new HttpRequest();
// @todo define default account number format for clients, if number -> consider number as starting value // @feature Create a way to let admins create a default account format for clients/suppliers
// @todo define default account number format for suppliers, if number -> consider number as starting value // https://github.com/Karaka-Management/oms-Accounting/issues/8
$request->header->account = 1; $request->header->account = 1;
$request->setData('code', $person->number); $request->setData('code', $person->number);
$request->setData('content', \rtrim($person->account->name1 . ' ' . $person->account->name2)); $request->setData('content', \rtrim($person->account->name1 . ' ' . $person->account->name2));
$request->setData('language', ISO639x1Enum::_EN); // @todo personal accounts shouldn't have a translation?! $request->setData('language', ISO639x1Enum::_EN);
$request->setData('type', $accountType); $request->setData('type', $accountType);
$request->setData('account', $person->account->id); $request->setData('account', $person->account->id);
$module->apiAccountCreate($request, $response); $module->apiAccountCreate($request, $response);

View File

@ -137,9 +137,11 @@ final class ApiController extends Controller
$posting->elements[] = $firstElement; $posting->elements[] = $firstElement;
// Second side // Second side
// @todo Implement automatic posting of archived bill
// https://github.com/Karaka-Management/oms-Accounting/issues/10
foreach ($new->elements as $element) { foreach ($new->elements as $element) {
// @todo handle pl account from bill // handle pl account from bill
// @todo handle taxes // handle taxes
$postingElement = new PostingElement(); $postingElement = new PostingElement();
$postingElement->createdBy = new NullAccount($account); $postingElement->createdBy = new NullAccount($account);
$postingElement->unit = $posting->unit; $postingElement->unit = $posting->unit;
@ -152,10 +154,10 @@ final class ApiController extends Controller
$posting->elements[] = $postingElement; $posting->elements[] = $postingElement;
} }
// @todo check debit === credit // check debit === credit
// @todo check bill tax = sum(element.tax) // check bill tax = sum(element.tax)
// @todo check bill net = sum(element.net) // check bill net = sum(element.net)
// @todo check bill gross = sum(element.gross) // check bill gross = sum(element.gross)
$this->createModel($account, $posting, PostingMapper::class, 'posting-bill', $ip); $this->createModel($account, $posting, PostingMapper::class, 'posting-bill', $ip);
} }
@ -183,8 +185,8 @@ final class ApiController extends Controller
$response = new HttpResponse(); $response = new HttpResponse();
$request = new HttpRequest(); $request = new HttpRequest();
// @todo define default account number format for clients, if number -> consider number as starting value // @feature Create a way to let admins create a default account format for clients/suppliers
// @todo define default account number format for suppliers, if number -> consider number as starting value // https://github.com/Karaka-Management/oms-Accounting/issues/8
$request->header->account = $account; $request->header->account = $account;
$request->setData('code', $new->number); $request->setData('code', $new->number);

View File

@ -527,10 +527,8 @@ final class BackendController extends Controller
$view->data['attributeTypes'] = $attributeTypes; $view->data['attributeTypes'] = $attributeTypes;
// Get item profile image // Get item profile image
// It might not be part of the 5 newest item files from above // @feature Create a new read mapper function that returns relation models instead of its own model
// @todo It would be nice to have something like this as a default method in the model e.g. // https://github.com/Karaka-Management/phpOMS/issues/320
// ItemManagement::getRelations()->with('types')->where(...);
// This should return the relations and NOT the model itself
$query = new Builder($this->app->dbPool->get()); $query = new Builder($this->app->dbPool->get());
$results = $query->selectAs(ClientMapper::HAS_MANY['files']['external'], 'file') $results = $query->selectAs(ClientMapper::HAS_MANY['files']['external'], 'file')
->from(ClientMapper::TABLE) ->from(ClientMapper::TABLE)