auto fixes + some impl.

This commit is contained in:
Dennis Eichhorn 2024-01-26 22:53:59 +00:00
parent e95dcdbd2a
commit a5ce0aea7d
44 changed files with 952 additions and 938 deletions

View File

@ -93,7 +93,7 @@
"type": 3,
"subtype": 1,
"name": "Item",
"uri": "{/base}/item/profile?{?}",
"uri": "{/base}/item/view?{?}",
"target": "self",
"icon": null,
"order": 1,
@ -172,7 +172,7 @@
"type": 3,
"subtype": 1,
"name": "Item",
"uri": "{/base}/sales/item/single?{?}",
"uri": "{/base}/sales/item/view?{?}",
"target": "self",
"icon": null,
"order": 1,
@ -234,7 +234,7 @@
"type": 3,
"subtype": 1,
"name": "Item",
"uri": "{/base}/purchase/item/single?{?}",
"uri": "{/base}/purchase/item/view?{?}",
"target": "self",
"icon": null,
"order": 1,
@ -296,7 +296,7 @@
"type": 3,
"subtype": 1,
"name": "Item",
"uri": "{/base}/warehouse/item/single?{?}",
"uri": "{/base}/warehouse/item/view?{?}",
"target": "self",
"icon": null,
"order": 1,
@ -358,7 +358,7 @@
"type": 3,
"subtype": 1,
"name": "Item",
"uri": "{/base}/production/item/single?{?}",
"uri": "{/base}/production/item/view?{?}",
"target": "self",
"icon": null,
"order": 1,

View File

@ -1,4 +1,30 @@
[
{
"name": "default_sales_container",
"l11n": {
"en": "Default sales container",
"de": "Standard Verkaufsgebinde"
},
"value_type": 1,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": true,
"default_value": "",
"values": []
},
{
"name": "default_purchase_container",
"l11n": {
"en": "Default purchase container",
"de": "Standard Einkaufsgebinde"
},
"value_type": 1,
"is_custom_allowed": true,
"validation_pattern": "",
"is_required": true,
"default_value": "",
"values": []
},
{
"name": "primary_supplier",
"l11n": {
@ -1373,5 +1399,33 @@
"value": "III"
}
]
},
{
"name": "costcenter",
"l11n": {
"en": "Cost Center",
"de": "Kostenstelle"
},
"value_type": 2,
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"internal": true,
"default_value": "",
"values": []
},
{
"name": "costobject",
"l11n": {
"en": "Cost Center",
"de": "Kostenstelle"
},
"value_type": 2,
"is_custom_allowed": false,
"validation_pattern": "",
"is_required": false,
"internal": true,
"default_value": "",
"values": []
}
]

View File

@ -128,11 +128,21 @@
"type": "VARCHAR(255)",
"null": false
},
"itemmgmt_item_container_unit": {
"name": "itemmgmt_item_container_unit",
"type": "VARCHAR(255)",
"null": false
},
"itemmgmt_item_container_quantity": {
"name": "itemmgmt_item_container_quantity",
"type": "INT",
"null": false
},
"itemmgmt_item_container_decimals": {
"name": "itemmgmt_item_container_decimals",
"type": "TINYINT(1)",
"null": false
},
"itemmgmt_item_container_weight": {
"name": "itemmgmt_item_container_weight",
"type": "INT",
@ -362,6 +372,11 @@
"type": "TINYINT(1)",
"null": false
},
"itemmgmt_attr_type_internal": {
"name": "itemmgmt_attr_type_internal",
"type": "TINYINT(1)",
"null": false
},
"itemmgmt_attr_type_required": {
"description": "Every item must have this attribute type if set to true.",
"name": "itemmgmt_attr_type_required",

View File

@ -23,7 +23,6 @@ use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Module\InstallerAbstract;
use phpOMS\Module\ModuleInfo;
use phpOMS\Uri\HttpUri;
/**
* Installer class.
@ -50,8 +49,6 @@ final class Installer extends InstallerAbstract
{
parent::install($app, $info, $cfgHandler);
\Modules\Admin\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Install/Admin.install.json']);
/* Attributes */
$fileContent = \file_get_contents(__DIR__ . '/Install/attributes.json');
if ($fileContent === false) {
@ -63,6 +60,16 @@ final class Installer extends InstallerAbstract
$attrTypes = self::createAttributeTypes($app, $attributes);
$attrValues = self::createAttributeValues($app, $attrTypes, $attributes);
$data = \json_decode(\file_get_contents(__DIR__ . '/Install/Admin.install.json'), true);
$content = \json_decode($data[0]['content'], true);
foreach ($content as $type => $_) {
$content[$type] = \reset($attrValues[$type])['id'];
}
$data[0]['content'] = \json_encode($content);
\Modules\Admin\Admin\Installer::createSettings($app, $data[0]);
/* Localizations */
$fileContent = \file_get_contents(__DIR__ . '/Install/localizations.json');
if ($fileContent === false) {
@ -100,7 +107,7 @@ final class Installer extends InstallerAbstract
}
/** @var array $types */
$types = \json_decode($fileContent, true);
$types = \json_decode($fileContent, true);
$materialTypeArray = self::createMaterialTypes($app, $types);
}
@ -141,7 +148,7 @@ final class Installer extends InstallerAbstract
foreach ($items as $item) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('number', (string) $item['number']);
@ -164,13 +171,13 @@ final class Installer extends InstallerAbstract
foreach ($l11ns as $language => $l11n) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('item', $itemId);
$request->setData('type', $l11nType->id);
$request->setData('content', (string) $l11n);
$request->setData('language', (string) $language);
$request->setData('description', (string) $l11n);
$module->apiItemL11nCreate($request, $response);
}
@ -180,7 +187,7 @@ final class Installer extends InstallerAbstract
$attrType = $attributeTypes[$attribute['type']];
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('ref', $itemId);
@ -243,7 +250,7 @@ final class Installer extends InstallerAbstract
foreach ($l11ns as $l11n) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('title', $l11n['name']);
@ -284,7 +291,7 @@ final class Installer extends InstallerAbstract
foreach ($rels as $rel) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('title', $rel['name']);
@ -325,12 +332,14 @@ final class Installer extends InstallerAbstract
/** @var array $attribute */
foreach ($attributes as $attribute) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('name', $attribute['name'] ?? '');
$request->setData('title', \reset($attribute['l11n']));
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
$request->setData('repeatable', $attribute['repeatable'] ?? false);
$request->setData('internal', $attribute['internal'] ?? false);
$request->setData('is_required', $attribute['is_required'] ?? false);
$request->setData('custom', $attribute['is_custom_allowed'] ?? false);
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
@ -355,7 +364,7 @@ final class Installer extends InstallerAbstract
}
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('title', $l11n);
@ -394,7 +403,7 @@ final class Installer extends InstallerAbstract
/** @var array $value */
foreach ($attribute['values'] as $value) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('value', $value['value'] ?? '');
@ -428,7 +437,7 @@ final class Installer extends InstallerAbstract
}
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('title', $l11n);
@ -464,7 +473,7 @@ final class Installer extends InstallerAbstract
/** @var array $type */
foreach ($types as $type) {
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('name', $type['name'] ?? '');
@ -489,7 +498,7 @@ final class Installer extends InstallerAbstract
}
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('title', $l11n);

View File

@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/item/find.*$' => [
'^.*/item/find(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\ApiController:apiItemFind',
'verb' => RouteVerb::GET,

View File

@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType;
use phpOMS\Router\RouteVerb;
return [
'^.*/item/attribute/type/list.*$' => [
'^.*/item/attribute/type/list(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementAttributeTypeList',
'verb' => RouteVerb::GET,
@ -29,7 +29,7 @@ return [
],
],
],
'^.*/item/attribute/type\?.*$' => [
'^.*/item/attribute/type(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementAttributeType',
'verb' => RouteVerb::GET,
@ -40,7 +40,7 @@ return [
],
],
],
'^.*/item/attribute/value.*$' => [
'^.*/item/attribute/value(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementAttributeValues',
'verb' => RouteVerb::GET,
@ -51,7 +51,7 @@ return [
],
],
],
'^/item/list.*$' => [
'^/item/list(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementItemList',
'verb' => RouteVerb::GET,
@ -62,7 +62,7 @@ return [
],
],
],
'^/item/create.*$' => [
'^/item/create(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementItemCreate',
'verb' => RouteVerb::GET,
@ -73,7 +73,7 @@ return [
],
],
],
'^/item/profile.*$' => [
'^/item/view(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementItem',
'verb' => RouteVerb::GET,
@ -85,7 +85,7 @@ return [
],
],
'^.*/sales/item/list.*$' => [
'^.*/sales/item/list(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementSalesList',
'verb' => RouteVerb::GET,
@ -96,7 +96,7 @@ return [
],
],
],
'^.*/sales/item/create.*$' => [
'^.*/sales/item/create(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementSalesCreate',
'verb' => RouteVerb::GET,
@ -107,7 +107,7 @@ return [
],
],
],
'^.*/sales/item/profile.*$' => [
'^.*/sales/item/view(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementSalesItem',
'verb' => RouteVerb::GET,
@ -119,7 +119,7 @@ return [
],
],
'^.*/purchase/item/list.*$' => [
'^.*/purchase/item/list(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementPurchaseList',
'verb' => RouteVerb::GET,
@ -130,7 +130,7 @@ return [
],
],
],
'^.*/purchase/item/create.*$' => [
'^.*/purchase/item/create(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementPurchaseCreate',
'verb' => RouteVerb::GET,
@ -141,7 +141,7 @@ return [
],
],
],
'^.*/purchase/item/profile.*$' => [
'^.*/purchase/item/view(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementPurchaseItem',
'verb' => RouteVerb::GET,
@ -153,7 +153,7 @@ return [
],
],
'^.*/warehouse/item/list.*$' => [
'^.*/warehouse/item/list(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementWarehousingList',
'verb' => RouteVerb::GET,
@ -164,7 +164,7 @@ return [
],
],
],
'.*/warehouse/item/create.*$' => [
'.*/warehouse/item/create(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementWarehousingCreate',
'verb' => RouteVerb::GET,
@ -175,7 +175,7 @@ return [
],
],
],
'^.*/warehouse/item/profile.*$' => [
'^.*/warehouse/item/view(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemManagementWarehouseItem',
'verb' => RouteVerb::GET,
@ -186,7 +186,7 @@ return [
],
],
],
'^.*/purchase/analysis/item(\?.*|$)$' => [
'^.*/purchase/analysis/item(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemPurchaseAnalysis',
'verb' => RouteVerb::GET,
@ -197,7 +197,7 @@ return [
],
],
],
'^.*/item/material/list\?.*$' => [
'^.*/item/material/list(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemMaterialList',
'verb' => RouteVerb::GET,
@ -208,7 +208,7 @@ return [
],
],
],
'^.*/item/material/view\?.*$' => [
'^.*/item/material/view(\?.*$|$)' => [
[
'dest' => '\Modules\ItemManagement\Controller\BackendController:viewItemMaterialView',
'verb' => RouteVerb::GET,

View File

@ -61,12 +61,15 @@ final class ApiAttributeController extends Controller
return;
}
$type = ItemAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute();
$type = ItemAttributeTypeMapper::get()
->with('defaults')
->where('id', (int) $request->getData('type'))
->execute();
if (!$type->repeatable) {
$attr = ItemAttributeMapper::count()
->with('type')
->where('type/id', (int) $request->getData('type'))
->where('type/id', $type->id)
->where('ref', (int) $request->getData('ref'))
->execute();
@ -164,13 +167,20 @@ final class ApiAttributeController extends Controller
->where('id', $request->getDataInt('type') ?? 0)
->execute();
if ($type->isInternal) {
$response->header->status = RequestStatusCode::R_403;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$attrValue = $this->createAttributeValueFromRequest($request, $type);
$this->createModel($request->header->account, $attrValue, ItemAttributeValueMapper::class, 'attr_value', $request->getOrigin());
if ($attrValue->isDefault) {
$this->createModelRelation(
$request->header->account,
(int) $request->getData('type'),
$type->id,
$attrValue->id,
ItemAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
);

View File

@ -15,13 +15,13 @@ declare(strict_types=1);
namespace Modules\ItemManagement\Controller;
use Modules\Admin\Models\NullAccount;
use Modules\Billing\Models\Price\PriceType;
use Modules\ItemManagement\Models\Attribute\ItemAttributeTypeMapper;
use Modules\ItemManagement\Models\Container;
use Modules\ItemManagement\Models\Item;
use Modules\ItemManagement\Models\ItemL11nMapper;
use Modules\ItemManagement\Models\ItemL11nTypeMapper;
use Modules\ItemManagement\Models\ItemMapper;
use Modules\ItemManagement\Models\ItemPrice;
use Modules\ItemManagement\Models\ItemPriceStatus;
use Modules\ItemManagement\Models\ItemRelationType;
use Modules\ItemManagement\Models\ItemRelationTypeMapper;
use Modules\ItemManagement\Models\ItemStatus;
@ -38,7 +38,6 @@ use Modules\Media\Models\PathSettings;
use phpOMS\Account\PermissionType;
use phpOMS\Localization\BaseStringL11n;
use phpOMS\Localization\BaseStringL11nType;
use phpOMS\Localization\ISO4217CharEnum;
use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Localization\NullBaseStringL11nType;
use phpOMS\Message\Http\HttpRequest;
@ -50,7 +49,6 @@ use phpOMS\Message\ResponseAbstract;
use phpOMS\Model\Message\FormValidation;
use phpOMS\Stdlib\Base\FloatInt;
use phpOMS\System\MimeType;
use phpOMS\Uri\HttpUri;
/**
* ItemManagement class.
@ -165,22 +163,52 @@ final class ApiController extends Controller
$this->createModel($request->header->account, $item, ItemMapper::class, 'item', $request->getOrigin());
$this->app->dbPool->get()->con->commit();
if ($this->app->moduleManager->isActive('Billing')) {
$billing = $this->app->moduleManager->get('Billing');
// Define default item containers
$types = ItemAttributeTypeMapper::getAll()
->where('name', ['default_sales_container', 'default_purchase_container'], 'IN')
->execute();
$internalRequest = new HttpRequest(new HttpUri(''));
foreach ($types as $type) {
$internalResponse = clone $response;
$internalRequest = new HttpRequest();
$internalRequest->header->account = $request->header->account;
$internalRequest->setData('ref', $item->id);
$internalRequest->setData('type', $type->id);
$internalRequest->setData('value', \reset($item->container)->id);
$this->app->moduleManager->get('ItemManagement', 'ApiAttribute')->apiItemAttributeCreate($internalRequest, $internalResponse);
}
if ($this->app->moduleManager->isActive('Billing')) {
$billing = $this->app->moduleManager->get('Billing', 'ApiPrice');
// Sales price
$internalRequest = new HttpRequest();
$internalResponse = new HttpResponse();
$internalRequest->header->account = $request->header->account;
$internalRequest->setData('name', 'base');
$internalRequest->setData('name', 'default');
$internalRequest->setData('type', PriceType::SALES);
$internalRequest->setData('item', $item->id);
$internalRequest->setData('price_new', $request->getDataInt('salesprice') ?? 0);
$internalRequest->setData('price_new', $request->getDataString('salesprice') ?? 0);
$billing->apiPriceCreate($internalRequest, $internalResponse);
// Purchase price
$internalRequest = new HttpRequest();
$internalResponse = new HttpResponse();
$internalRequest->header->account = $request->header->account;
$internalRequest->setData('name', 'default');
$internalRequest->setData('type', PriceType::PURCHASE);
$internalRequest->setData('item', $item->id);
$internalRequest->setData('price_new', $request->getDataString('purchaseprice') ?? 0);
$billing->apiPriceCreate($internalRequest, $internalResponse);
}
$this->createMediaDirForItem($item->number, $request->header->account);
$path = $this->createItemDir($item);
$uploadedFiles = $request->files['item_profile_image'] ?? [];
@ -239,13 +267,13 @@ final class ApiController extends Controller
return;
}
$types = ItemAttributeTypeMapper::get()
$types = ItemAttributeTypeMapper::getAll()
->where('name', \array_keys($segmentation), 'IN')
->execute();
foreach ($types as $type) {
$internalResponse = clone $response;
$internalRequest = new HttpRequest(new HttpUri(''));
$internalRequest = new HttpRequest();
$internalRequest->header->account = $request->header->account;
$internalRequest->setData('ref', $item->id);
@ -290,15 +318,21 @@ final class ApiController extends Controller
*/
private function createItemFromRequest(RequestAbstract $request) : Item
{
$item = new Item();
$item->number = $request->getDataString('number') ?? '';
$item->stockIdentifier = $request->getDataInt('stockidentifier') ?? StockIdentifierType::NONE;
$item->salesPrice = new FloatInt($request->getDataInt('salesprice') ?? 0);
$item->purchasePrice = new FloatInt($request->getDataInt('purchaseprice') ?? 0);
$item->info = $request->getDataString('info') ?? '';
$item->parent = $request->getDataInt('parent');
$item->unit = $request->getDataInt('unit');
$item->setStatus($request->getDataInt('status') ?? ItemStatus::ACTIVE);
$item = new Item();
$item->number = $request->getDataString('number') ?? '';
$item->stockIdentifier = $request->getDataInt('stockidentifier') ?? StockIdentifierType::NONE;
$item->salesPrice = new FloatInt($request->getDataString('salesprice') ?? 0);
$item->purchasePrice = new FloatInt($request->getDataString('purchaseprice') ?? 0);
$item->info = $request->getDataString('info') ?? '';
$item->parent = $request->getDataInt('parent');
$item->unit = $request->getDataInt('unit');
$item->status = ItemStatus::tryFromValue($request->getDataInt('status')) ?? ItemStatus::ACTIVE;
$container = new Container();
$container->name = 'default';
$container->quantity = \pow(10, FloatInt::MAX_DECIMALS);
$item->container[] = $container;
return $item;
}
@ -322,81 +356,6 @@ final class ApiController extends Controller
return [];
}
/**
* Api method to create item
*
* @param RequestAbstract $request Request
* @param ResponseAbstract $response Response
* @param array $data Generic data
*
* @return void
*
* @api
*
* @since 1.0.0
*/
public function apiItemPriceCreate(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
{
if (!empty($val = $this->validateItemPriceCreate($request))) {
$response->header->status = RequestStatusCode::R_400;
$this->createInvalidCreateResponse($request, $response, $val);
return;
}
$item = $this->createItemPriceFromRequest($request);
$this->createModel($request->header->account, $item, ItemMapper::class, 'item', $request->getOrigin());
$this->createStandardCreateResponse($request, $response, $item);
}
/**
* Method to create item from request.
*
* @param RequestAbstract $request Request
*
* @return ItemPrice
*
* @since 1.0.0
*/
private function createItemPriceFromRequest(RequestAbstract $request) : ItemPrice
{
$item = new ItemPrice();
$item->currency = $request->getDataString('currency') ?? '';
$item->price = new FloatInt($request->getDataInt('price') ?? 0);
$item->minQuantity = $request->getDataInt('minquantity') ?? 0;
$item->relativeDiscount = $request->getDataInt('relativediscount') ?? 0;
$item->absoluteDiscount = $request->getDataInt('absolutediscount') ?? 0;
$item->relativeUnitDiscount = $request->getDataInt('relativeunitdiscount') ?? 0;
$item->absoluteUnitDiscount = $request->getDataInt('absoluteunitdiscount') ?? 0;
$item->promocode = $request->getDataString('promocode') ?? '';
$item->start = $request->getDataDateTime('start');
$item->end = $request->getDataDateTime('end');
$item->setStatus($request->getDataInt('status') ?? ItemPriceStatus::ACTIVE);
return $item;
}
/**
* Validate item create request
*
* @param RequestAbstract $request Request
*
* @return array<string, bool>
*
* @since 1.0.0
*/
private function validateItemPriceCreate(RequestAbstract $request) : array
{
$val = [];
if (($val['price_new'] = !$request->hasData('price_new'))
|| ($val['currency'] = !ISO4217CharEnum::isValidValue($request->getData('currency')))
) {
return $val;
}
return [];
}
/**
* Api method to create item attribute
*
@ -648,13 +607,11 @@ final class ApiController extends Controller
*/
private function createItemL11nFromRequest(RequestAbstract $request) : BaseStringL11n
{
$itemL11n = new BaseStringL11n();
$itemL11n->ref = $request->getDataInt('item') ?? 0;
$itemL11n->type = new NullBaseStringL11nType($request->getDataInt('type') ?? 0);
$itemL11n->setLanguage(
$request->getDataString('language') ?? $request->header->l11n->language
);
$itemL11n->content = $request->getDataString('content') ?? '';
$itemL11n = new BaseStringL11n();
$itemL11n->ref = $request->getDataInt('item') ?? 0;
$itemL11n->type = new NullBaseStringL11nType($request->getDataInt('type') ?? 0);
$itemL11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
$itemL11n->content = $request->getDataString('content') ?? '';
return $itemL11n;
}
@ -952,8 +909,11 @@ final class ApiController extends Controller
*/
private function createMaterialTypeFromRequest(RequestAbstract $request) : BaseStringL11nType
{
$materialType = new BaseStringL11nType($request->getDataString('name') ?? '');
$materialType->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN);
$materialType = new BaseStringL11nType($request->getDataString('name') ?? '');
$materialType->setL11n(
$request->getDataString('title') ?? '',
ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN
);
return $materialType;
}
@ -1017,12 +977,10 @@ final class ApiController extends Controller
*/
private function createMaterialTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
{
$materialL11n = new BaseStringL11n();
$materialL11n->ref = $request->getDataInt('type') ?? 0;
$materialL11n->setLanguage(
$request->getDataString('language') ?? $request->header->l11n->language
);
$materialL11n->content = $request->getDataString('title') ?? '';
$materialL11n = new BaseStringL11n();
$materialL11n->ref = $request->getDataInt('type') ?? 0;
$materialL11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
$materialL11n->content = $request->getDataString('title') ?? '';
return $materialL11n;
}

View File

@ -14,22 +14,20 @@ declare(strict_types=1);
namespace Modules\ItemManagement\Controller;
use Modules\Admin\Models\LocalizationMapper;
use Modules\Admin\Models\SettingsEnum;
use Modules\Auditor\Models\AuditMapper;
use Modules\Billing\Models\Price\PriceMapper;
use Modules\Billing\Models\Price\PriceType;
use Modules\ClientManagement\Models\Attribute\ClientAttributeTypeMapper;
use Modules\ClientManagement\Models\Attribute\ClientAttributeValueL11nMapper;
use Modules\ItemManagement\Models\Attribute\ItemAttributeTypeL11nMapper;
use Modules\ItemManagement\Models\Attribute\ItemAttributeTypeMapper;
use Modules\ItemManagement\Models\Attribute\ItemAttributeValueL11nMapper;
use Modules\ItemManagement\Models\Attribute\ItemAttributeValueMapper;
use Modules\ItemManagement\Models\Item;
use Modules\ItemManagement\Models\ItemL11nMapper;
use Modules\ItemManagement\Models\ItemL11nTypeMapper;
use Modules\ItemManagement\Models\ItemMapper;
use Modules\ItemManagement\Models\MaterialTypeL11nMapper;
use Modules\ItemManagement\Models\MaterialTypeMapper;
use Modules\ItemManagement\Models\StockIdentifierType;
use Modules\Media\Models\MediaMapper;
use Modules\Media\Models\MediaTypeMapper;
use Modules\Organization\Models\Attribute\UnitAttributeMapper;
@ -200,6 +198,7 @@ final class BackendController extends Controller
/** @var \Modules\ItemManagement\Models\Item[] $items */
$items = ItemMapper::getAll()
->with('container') // @todo change to only get the default sales container
->with('l11n')
->with('l11n/type')
->with('files')
@ -212,6 +211,73 @@ final class BackendController extends Controller
$view->data['items'] = $items;
// Stock distribution
$dists = [];
$reserved = [];
$ordered = [];
if ($this->app->moduleManager->isActive('WarehouseManagement')) {
$itemIds = \array_map(function (Item $item) { return $item->id;
}, $items);
$itemIdsString = \implode(',', $itemIds);
// @todo only select sales stock. Therefore we need a place to define the sales stock(s)
$temp = \Modules\WarehouseManagement\Models\StockDistributionMapper::getAll()
->where('item', $itemIds, 'IN')
->execute();
foreach ($temp as $t) {
if (!isset($dists[$t->item])) {
$dists[$t->item] = [];
}
// @todo These numbers might need adjustments for delivery notes/invoices depending on
// how we implement them in the warehouse management (maybe flag them in the transaction protocol as reserved?)
// also remember the SD issue where delivery notes can be technically still in stock -> stock value still belongs to company
// solution: "just" do a soft adjust of the available numbers?! but don't change the actual stock in the db
// the SD solution where actually delivered delivery notes can be adjusted after "archiving" will not be allowed
// to allow them to see what happened with such a delivery note maybe we can implement a view shows how many of the items are
// actually still outstanding. This shouldn't be anything special since we need importing of delivery notes anyways and marking
// old delivery note elements in a way to show which line items or even sub-line items got invoiced/returned etc.
$dists[$t->item][] = $t;
}
$stockIdentifier = StockIdentifierType::NONE;
$sql = <<<SQL
SELECT billing_bill_element.billing_bill_element_item,
billing_type.billing_type_name,
SUM(billing_bill_element.billing_bill_element_quantity) AS quantity
FROM billing_bill_element
LEFT JOIN itemmgmt_item ON billing_bill_element.billing_bill_element_item = itemmgmt_item.itemmgmt_item_id
LEFT JOIN billing_bill ON billing_bill_element.billing_bill_element_bill = billing_bill.billing_bill_id
LEFT JOIN billing_type ON billing_bill.billing_bill_type = billing_type.billing_type_id
WHERE billing_bill_element.billing_bill_element_item IN ({$itemIdsString})
AND itemmgmt_item.itemmgmt_item_stockidentifier != {$stockIdentifier}
AND billing_type.billing_type_name IN ('sales_order_confirmation', 'purchase_order')
GROUP BY billing_bill_element.billing_bill_element_item, billing_type.billing_type_name;
SQL;
$query = new Builder($this->app->dbPool->get());
$results = $query->raw($sql)->execute()->fetchAll(\PDO::FETCH_ASSOC);
foreach ($results as $result) {
if (!isset($reserved[(int) $result['billing_bill_element_item']])) {
$reserved[$t->item] = 0;
$ordered[$t->item] = 0;
}
if ($result['billing_type_name'] === 'sales_order_confirmation') {
$reserved[(int) $result['billing_bill_element_item']] += (int) $result['quantity'];
} else {
$ordered[(int) $result['billing_bill_element_item']] += (int) $result['quantity'];
}
}
}
$view->data['dists'] = $dists;
$view->data['reserved'] = $reserved;
$view->data['ordered'] = $ordered;
return $view;
}
@ -368,11 +434,11 @@ final class BackendController extends Controller
$head->addAsset(AssetType::JSLATE, 'Modules/ItemManagement/Controller.js', ['nonce' => $nonce, 'type' => 'module']);
$view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/item-profile');
$view->setTemplate('/Modules/ItemManagement/Theme/Backend/item-view');
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1004803001, $request, $response);
/** @var \Modules\ItemManagement\Models\Item $item */
$item = ItemMapper::get()
/** @var \Modules\ItemManagement\Models\Item */
$view->data['item'] = ItemMapper::get()
->with('l11n')
->with('l11n/type')
->with('files')->limit(5, 'files')->sort('files/id', OrderType::DESC)
@ -382,14 +448,14 @@ final class BackendController extends Controller
->with('attributes/type')
->with('attributes/type/l11n')
->with('attributes/value')
//->with('attributes/value/l11n')
->where('id', (int) $request->getData('id'))
->where('l11n/language', $response->header->l11n->language)
->where('l11n/type/title', ['name1', 'name2', 'name3'], 'IN')
->where('attributes/type/l11n/language', $response->header->l11n->language)
//->where('attributes/value/l11n/language', $response->header->l11n->language)
->execute();
$view->data['item'] = $item;
// Get item profile image
// It might not be part of the 5 newest item files from above
// @todo It would be nice to have something like this as a default method in the model e.g.
@ -406,18 +472,16 @@ final class BackendController extends Controller
->on(MediaMapper::TABLE . '.' . MediaMapper::PRIMARYFIELD, '=', MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['self'])
->leftJoin(MediaTypeMapper::TABLE)
->on(MediaMapper::HAS_MANY['types']['table'] . '.' . MediaMapper::HAS_MANY['types']['external'], '=', MediaTypeMapper::TABLE . '.' . MediaTypeMapper::PRIMARYFIELD)
->where(ItemMapper::HAS_MANY['files']['self'], '=', $item->id)
->where(ItemMapper::HAS_MANY['files']['self'], '=', $view->data['item']->id)
->where(MediaTypeMapper::TABLE . '.' . MediaTypeMapper::getColumnByMember('name'), '=', 'item_profile_image');
/** @var \Modules\Media\Models\Media $itemImage */
$itemImage = MediaMapper::get()
/** @var \Modules\Media\Models\Media */
$view->data['itemImage'] = MediaMapper::get()
->with('types')
->where('id', $results)
->limit(1)
->execute();
$view->data['itemImage'] = $itemImage;
$businessStart = UnitAttributeMapper::get()
->with('type')
->with('value')
@ -427,61 +491,40 @@ final class BackendController extends Controller
$view->data['business_start'] = $businessStart->id === 0 ? 1 : $businessStart->value->getValue();
// @todo this one should already be loaded in the backend application no?????????
/** @var \Model\Setting $settings */
$settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_LOCALIZATION);
$view->data['default_localization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['default_localization'] = $view->data['default_localization'];
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
$view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
$view->data['l11nView'] = new \Web\Backend\Views\L11nView($this->app->l11nManager, $request, $response);
/** @var \phpOMS\Localization\BaseStringL11nType[] $l11nTypes */
$l11nTypes = ItemL11nTypeMapper::getAll()
/** @var \phpOMS\Localization\BaseStringL11nType[] */
$view->data['l11nTypes'] = ItemL11nTypeMapper::getAll()
->execute();
$view->data['l11nTypes'] = $l11nTypes;
/** @var \phpOMS\Localization\BaseStringL11n[] $l11nValues */
$l11nValues = ItemL11nMapper::getAll()
/** @var \phpOMS\Localization\BaseStringL11n[] */
$view->data['l11nValues'] = ItemL11nMapper::getAll()
->with('type')
->where('ref', $item->id)
->where('ref', $view->data['item']->id)
->execute();
$view->data['l11nValues'] = $l11nValues;
/** @var \Modules\Attribute\Models\AttributeType[] $attributeTypes */
$attributeTypes = ItemAttributeTypeMapper::getAll()
/** @var \Modules\Attribute\Models\AttributeType[] */
$view->data['attributeTypes'] = ItemAttributeTypeMapper::getAll()
->with('l11n')
->where('l11n/language', $response->header->l11n->language)
->execute();
$view->data['attributeTypes'] = $attributeTypes;
/** @var \Modules\Organization\Models\Unit[] $units */
$units = UnitMapper::getAll()
/** @var \Modules\Organization\Models\Unit[] */
$view->data['units'] = UnitMapper::getAll()
->execute();
$view->data['units'] = $units;
$view->data['hasBilling'] = $this->app->moduleManager->isActive('Billing');
/** @var \Modules\Billing\Models\Price\Price[] $prices */
$prices = PriceMapper::getAll()
->where('item', $item->id)
->where('type', PriceType::SALES)
->where('client', null)
->execute();
$view->data['prices'] = $prices;
/** @var \Modules\Billing\Models\Price\Price[] $prices */
$prices = PriceMapper::getAll()
->where('item', $item->id)
->where('type', PriceType::PURCHASE)
->execute();
$view->data['purchase_prices'] = $prices;
/** @var \Modules\Billing\Models\Price\Price[] */
$view->data['prices'] = $view->data['hasBilling']
? \Modules\Billing\Models\Price\PriceMapper::getAll()
->where('item', $view->data['item']->id)
->where('client', null)
->execute()
: [];
$tmp = ItemAttributeTypeMapper::getAll()
->with('defaults')
@ -519,30 +562,24 @@ final class BackendController extends Controller
$view->data['clientSegmentationTypes'] = $clientSegmentationTypes;
/** @var \Modules\Auditor\Models\Audit[] $audits */
$audits = AuditMapper::getAll()
/** @var \Modules\Auditor\Models\Audit[] */
$view->data['audits'] = AuditMapper::getAll()
->where('type', StringUtils::intHash(ItemMapper::class))
->where('module', 'ItemManagement')
->where('ref', (string) $item->id)
->where('ref', (string) $view->data['item']->id)
->execute();
// @todo join audit with files, attributes, localization, prices, notes, ...
$view->data['audits'] = $audits;
/** @var \Modules\Media\Models\Media[] $files */
$files = MediaMapper::getAll()
/** @var \Modules\Media\Models\Media[] */
$view->data['files'] = MediaMapper::getAll()
->with('types')
->join('id', ItemMapper::class, 'files') // id = media id, files = item relations
->on('id', $item->id, relation: 'files') // id = item id
->on('id', $view->data['item']->id, relation: 'files') // id = item id
->execute();
$view->data['files'] = $files;
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
$view->data['note'] = new \Modules\Editor\Theme\Backend\Components\Note\BaseView($this->app->l11nManager, $request, $response);
$view->data['hasBilling'] = $this->app->moduleManager->isActive('Billing');
$view->data['note'] = new \Modules\Editor\Theme\Backend\Components\Note\BaseView($this->app->l11nManager, $request, $response);
return $view;
}

View File

@ -42,7 +42,8 @@ final class ItemAttributeTypeMapper extends DataMapperFactory
'itemmgmt_attr_type_datatype' => ['name' => 'itemmgmt_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
'itemmgmt_attr_type_fields' => ['name' => 'itemmgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
'itemmgmt_attr_type_custom' => ['name' => 'itemmgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
'itemmgmt_attr_type_repeatable' => ['name' => 'itemmgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
'itemmgmt_attr_type_repeatable' => ['name' => 'itemmgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
'itemmgmt_attr_type_internal' => ['name' => 'itemmgmt_attr_type_internal', 'type' => 'bool', 'internal' => 'isInternal'],
'itemmgmt_attr_type_pattern' => ['name' => 'itemmgmt_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
'itemmgmt_attr_type_required' => ['name' => 'itemmgmt_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
];

View File

@ -37,10 +37,10 @@ final class ItemAttributeValueL11nMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'itemmgmt_attr_value_l11n_id' => ['name' => 'itemmgmt_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_attr_value_l11n_title' => ['name' => 'itemmgmt_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'itemmgmt_attr_value_l11n_value' => ['name' => 'itemmgmt_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
'itemmgmt_attr_value_l11n_lang' => ['name' => 'itemmgmt_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
'itemmgmt_attr_value_l11n_id' => ['name' => 'itemmgmt_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_attr_value_l11n_title' => ['name' => 'itemmgmt_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'itemmgmt_attr_value_l11n_value' => ['name' => 'itemmgmt_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
'itemmgmt_attr_value_l11n_lang' => ['name' => 'itemmgmt_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
];
/**

View File

@ -37,15 +37,15 @@ final class ItemAttributeValueMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'itemmgmt_attr_value_id' => ['name' => 'itemmgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_attr_value_default' => ['name' => 'itemmgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
'itemmgmt_attr_value_valueStr' => ['name' => 'itemmgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
'itemmgmt_attr_value_valueInt' => ['name' => 'itemmgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
'itemmgmt_attr_value_valueDec' => ['name' => 'itemmgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
'itemmgmt_attr_value_valueDat' => ['name' => 'itemmgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
'itemmgmt_attr_value_unit' => ['name' => 'itemmgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
'itemmgmt_attr_value_deptype' => ['name' => 'itemmgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
'itemmgmt_attr_value_depvalue' => ['name' => 'itemmgmt_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
'itemmgmt_attr_value_id' => ['name' => 'itemmgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_attr_value_default' => ['name' => 'itemmgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
'itemmgmt_attr_value_valueStr' => ['name' => 'itemmgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
'itemmgmt_attr_value_valueInt' => ['name' => 'itemmgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
'itemmgmt_attr_value_valueDec' => ['name' => 'itemmgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
'itemmgmt_attr_value_valueDat' => ['name' => 'itemmgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
'itemmgmt_attr_value_unit' => ['name' => 'itemmgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
'itemmgmt_attr_value_deptype' => ['name' => 'itemmgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
'itemmgmt_attr_value_depvalue' => ['name' => 'itemmgmt_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
];
/**

View File

@ -34,8 +34,12 @@ class Container implements \JsonSerializable
public string $name = '';
public string $unit = 'pcs';
public int $quantity = 0;
public int $quantityDecimals = 0;
public int $weight = 0;
public int $width = 0;

View File

@ -36,15 +36,17 @@ final class ContainerMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'itemmgmt_item_container_id' => ['name' => 'itemmgmt_item_container_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_item_container_name' => ['name' => 'itemmgmt_item_container_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
'itemmgmt_item_container_quantity' => ['name' => 'itemmgmt_item_container_quantity', 'type' => 'int', 'internal' => 'quantity'],
'itemmgmt_item_container_weight' => ['name' => 'itemmgmt_item_container_weight', 'type' => 'int', 'internal' => 'weight'],
'itemmgmt_item_container_width' => ['name' => 'itemmgmt_item_container_width', 'type' => 'int', 'internal' => 'width'],
'itemmgmt_item_container_height' => ['name' => 'itemmgmt_item_container_height', 'type' => 'int', 'internal' => 'height'],
'itemmgmt_item_container_length' => ['name' => 'itemmgmt_item_container_length', 'type' => 'int', 'internal' => 'length'],
'itemmgmt_item_container_volume' => ['name' => 'itemmgmt_item_container_volume', 'type' => 'int', 'internal' => 'volume'],
'itemmgmt_item_container_item' => ['name' => 'itemmgmt_item_container_item', 'type' => 'int', 'internal' => 'item'],
'itemmgmt_item_container_id' => ['name' => 'itemmgmt_item_container_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_item_container_name' => ['name' => 'itemmgmt_item_container_name', 'type' => 'string', 'internal' => 'name', 'autocomplete' => true],
'itemmgmt_item_container_unit' => ['name' => 'itemmgmt_item_container_unit', 'type' => 'string', 'internal' => 'unit'],
'itemmgmt_item_container_quantity' => ['name' => 'itemmgmt_item_container_quantity', 'type' => 'int', 'internal' => 'quantity'],
'itemmgmt_item_container_decimals' => ['name' => 'itemmgmt_item_container_decimals', 'type' => 'int', 'internal' => 'quantityDecimals'],
'itemmgmt_item_container_weight' => ['name' => 'itemmgmt_item_container_weight', 'type' => 'int', 'internal' => 'weight'],
'itemmgmt_item_container_width' => ['name' => 'itemmgmt_item_container_width', 'type' => 'int', 'internal' => 'width'],
'itemmgmt_item_container_height' => ['name' => 'itemmgmt_item_container_height', 'type' => 'int', 'internal' => 'height'],
'itemmgmt_item_container_length' => ['name' => 'itemmgmt_item_container_length', 'type' => 'int', 'internal' => 'length'],
'itemmgmt_item_container_volume' => ['name' => 'itemmgmt_item_container_volume', 'type' => 'int', 'internal' => 'volume'],
'itemmgmt_item_container_item' => ['name' => 'itemmgmt_item_container_item', 'type' => 'int', 'internal' => 'item'],
];
/**

View File

@ -134,6 +134,12 @@ class Item implements \JsonSerializable
*/
public ?int $unit = null;
/**
* Containers
*
* @var Container[]
* @since 1.0.0
*/
public array $container = [];
/**
@ -148,18 +154,6 @@ class Item implements \JsonSerializable
$this->purchasePrice = new FloatInt();
}
/**
* Get id.
*
* @return int Model id
*
* @since 1.0.0
*/
public function getId() : int
{
return $this->id;
}
/**
* Add item l11n
*
@ -189,7 +183,7 @@ class Item implements \JsonSerializable
*
* @since 1.0.0
*/
public function getL11n(string $type = null) : BaseStringL11n
public function getL11n(?string $type = null) : BaseStringL11n
{
foreach ($this->l11n as $l11n) {
if ($l11n->type?->title === $type) {
@ -212,32 +206,6 @@ class Item implements \JsonSerializable
return $this->l11n;
}
/**
* Get status.
*
* @return int
*
* @since 1.0.0
*/
public function getStatus() : int
{
return $this->status;
}
/**
* Set status.
*
* @param int $status Status
*
* @return void
*
* @since 1.0.0
*/
public function setStatus(int $status) : void
{
$this->status = $status;
}
/**
* {@inheritdoc}
*/

View File

@ -43,15 +43,15 @@ final class ItemMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'itemmgmt_item_id' => ['name' => 'itemmgmt_item_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_item_no' => ['name' => 'itemmgmt_item_no', 'type' => 'string', 'internal' => 'number', 'autocomplete' => true],
'itemmgmt_item_status' => ['name' => 'itemmgmt_item_status', 'type' => 'int', 'internal' => 'status'],
'itemmgmt_item_stockidentifier' => ['name' => 'itemmgmt_item_stockidentifier', 'type' => 'int', 'internal' => 'stockIdentifier'],
'itemmgmt_item_info' => ['name' => 'itemmgmt_item_info', 'type' => 'string', 'internal' => 'info'],
'itemmgmt_item_salesprice' => ['name' => 'itemmgmt_item_salesprice', 'type' => 'Serializable', 'internal' => 'salesPrice'],
'itemmgmt_item_purchaseprice' => ['name' => 'itemmgmt_item_purchaseprice', 'type' => 'Serializable', 'internal' => 'purchasePrice'],
'itemmgmt_item_parent' => ['name' => 'itemmgmt_item_parent', 'type' => 'int', 'internal' => 'parent'],
'itemmgmt_item_unit' => ['name' => 'itemmgmt_item_unit', 'type' => 'int', 'internal' => 'unit'],
'itemmgmt_item_id' => ['name' => 'itemmgmt_item_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_item_no' => ['name' => 'itemmgmt_item_no', 'type' => 'string', 'internal' => 'number', 'autocomplete' => true],
'itemmgmt_item_status' => ['name' => 'itemmgmt_item_status', 'type' => 'int', 'internal' => 'status'],
'itemmgmt_item_stockidentifier' => ['name' => 'itemmgmt_item_stockidentifier', 'type' => 'int', 'internal' => 'stockIdentifier'],
'itemmgmt_item_info' => ['name' => 'itemmgmt_item_info', 'type' => 'string', 'internal' => 'info'],
'itemmgmt_item_salesprice' => ['name' => 'itemmgmt_item_salesprice', 'type' => 'Serializable', 'internal' => 'salesPrice'],
'itemmgmt_item_purchaseprice' => ['name' => 'itemmgmt_item_purchaseprice', 'type' => 'Serializable', 'internal' => 'purchasePrice'],
'itemmgmt_item_parent' => ['name' => 'itemmgmt_item_parent', 'type' => 'int', 'internal' => 'parent'],
'itemmgmt_item_unit' => ['name' => 'itemmgmt_item_unit', 'type' => 'int', 'internal' => 'unit'],
];
/**
@ -102,10 +102,10 @@ final class ItemMapper extends DataMapperFactory
'external' => null,
],
'container' => [
'mapper' => ContainerMapper::class,
'table' => 'itemmgmt_item_container',
'self' => 'itemmgmt_item_container_item',
'external' => null,
'mapper' => ContainerMapper::class,
'table' => 'itemmgmt_item_container',
'self' => 'itemmgmt_item_container_item',
'external' => null,
],
];
@ -198,12 +198,12 @@ final class ItemMapper extends DataMapperFactory
$l11nType->id = $res['itemmgmt_item_l11n_typeref'];
$l11nType->title = $res['itemmgmt_item_l11n_type_title'];
$l11n = new BaseStringL11n();
$l11n->id = $res['itemmgmt_item_l11n_id'];
$l11n->ref = $res['itemmgmt_item_id'];
$l11n->type = $l11nType;
$l11n->content = $res['itemmgmt_item_l11n_description'];
$l11n->setLanguage($res['itemmgmt_item_l11n_lang']);
$l11n = new BaseStringL11n();
$l11n->id = $res['itemmgmt_item_l11n_id'];
$l11n->ref = $res['itemmgmt_item_id'];
$l11n->type = $l11nType;
$l11n->content = $res['itemmgmt_item_l11n_description'];
$l11n->language = $res['itemmgmt_item_l11n_lang'];
$items[$l11n->ref]->addL11n($l11n);
}

View File

@ -1,132 +0,0 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\ItemManagement\Models
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
namespace Modules\ItemManagement\Models;
use phpOMS\Stdlib\Base\Exception\InvalidEnumValue;
use phpOMS\Stdlib\Base\FloatInt;
/**
* Account class.
*
* @package Modules\ItemManagement\Models
* @license OMS License 2.0
* @link https://jingga.app
* @since 1.0.0
*/
class ItemPrice implements \JsonSerializable
{
/**
* ID.
*
* @var int
* @since 1.0.0
*/
public int $id = 0;
public string $name = '';
public string $currency = '';
public FloatInt $price;
public int $status = ItemPriceStatus::ACTIVE;
public int $minQuantity = 0;
public int $relativeDiscount = 0;
public int $absoluteDiscount = 0;
public int $relativeUnitDiscount = 0;
public int $absoluteUnitDiscount = 0;
public string $promocode = '';
public ?\DateTime $start = null;
public ?\DateTime $end = null;
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct()
{
}
/**
* Get status
*
* @return int
*
* @since 1.0.0
*/
public function getStatus() : int
{
return $this->status;
}
/**
* Set status
*
* @param int $status Price status
*
* @return void
*
* @throws InvalidEnumValue
*
* @since 1.0.0
*/
public function setStatus(int $status) : void
{
if (!ItemPriceStatus::isValidValue($status)) {
throw new InvalidEnumValue((string) $status);
}
$this->status = $status;
}
/**
* {@inheritdoc}
*/
public function toArray() : array
{
return [
'id' => $this->id,
'name' => $this->name,
'currency' => $this->currency,
'price' => $this->price,
'status' => $this->status,
'minQuantity' => $this->minQuantity,
'relativeDiscount' => $this->relativeDiscount,
'absoluteDiscount' => $this->absoluteDiscount,
'relativeUnitDiscount' => $this->relativeUnitDiscount,
'absoluteUnitDiscount' => $this->absoluteUnitDiscount,
'promocode' => $this->promocode,
'start' => $this->start,
'end' => $this->end,
];
}
/**
* {@inheritdoc}
*/
public function jsonSerialize() : mixed
{
return $this->toArray();
}
}

View File

@ -63,7 +63,7 @@ class ItemRelation implements \JsonSerializable
*
* @since 1.0.0
*/
public function __construct(ItemRelationType $type = null)
public function __construct(?ItemRelationType $type = null)
{
$this->type = $type ?? new ItemRelationType();
}

View File

@ -36,10 +36,10 @@ final class ItemRelationMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'itemmgmt_item_relation_id' => ['name' => 'itemmgmt_item_relation_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_item_relation_src' => ['name' => 'itemmgmt_item_relation_src', 'type' => 'int', 'internal' => 'source'],
'itemmgmt_item_relation_dst' => ['name' => 'itemmgmt_item_relation_dst', 'type' => 'int', 'internal' => 'destination'],
'itemmgmt_item_relation_type' => ['name' => 'itemmgmt_item_relation_type', 'type' => 'int', 'internal' => 'type'],
'itemmgmt_item_relation_id' => ['name' => 'itemmgmt_item_relation_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_item_relation_src' => ['name' => 'itemmgmt_item_relation_src', 'type' => 'int', 'internal' => 'source'],
'itemmgmt_item_relation_dst' => ['name' => 'itemmgmt_item_relation_dst', 'type' => 'int', 'internal' => 'destination'],
'itemmgmt_item_relation_type' => ['name' => 'itemmgmt_item_relation_type', 'type' => 'int', 'internal' => 'type'],
];
/**

View File

@ -36,8 +36,8 @@ final class ItemRelationTypeMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'itemmgmt_item_relation_type_id' => ['name' => 'itemmgmt_item_relation_type_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_item_relation_type_title' => ['name' => 'itemmgmt_item_relation_type_title', 'type' => 'string', 'internal' => 'title'],
'itemmgmt_item_relation_type_id' => ['name' => 'itemmgmt_item_relation_type_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_item_relation_type_title' => ['name' => 'itemmgmt_item_relation_type_title', 'type' => 'string', 'internal' => 'title'],
];
/**

View File

@ -15,7 +15,6 @@ declare(strict_types=1);
namespace Modules\ItemManagement\Models;
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
use phpOMS\Localization\BaseStringL11nType;
/**
* Item mapper class.
@ -37,12 +36,12 @@ final class MaterialMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'itemmgmt_material_id' => ['name' => 'itemmgmt_material_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_material_category' => ['name' => 'itemmgmt_material_category', 'type' => 'int', 'internal' => 'category'],
'itemmgmt_material_subcategory' => ['name' => 'itemmgmt_material_subcategory', 'type' => 'int', 'internal' => 'subcategory'],
'itemmgmt_material_type' => ['name' => 'itemmgmt_material_type', 'type' => 'int', 'internal' => 'type'],
'itemmgmt_material_unit' => ['name' => 'itemmgmt_material_unit', 'type' => 'int', 'internal' => 'unit'],
'itemmgmt_material_item' => ['name' => 'itemmgmt_material_item', 'type' => 'int', 'internal' => 'item'],
'itemmgmt_material_id' => ['name' => 'itemmgmt_material_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_material_category' => ['name' => 'itemmgmt_material_category', 'type' => 'int', 'internal' => 'category'],
'itemmgmt_material_subcategory' => ['name' => 'itemmgmt_material_subcategory', 'type' => 'int', 'internal' => 'subcategory'],
'itemmgmt_material_type' => ['name' => 'itemmgmt_material_type', 'type' => 'int', 'internal' => 'type'],
'itemmgmt_material_unit' => ['name' => 'itemmgmt_material_unit', 'type' => 'int', 'internal' => 'unit'],
'itemmgmt_material_item' => ['name' => 'itemmgmt_material_item', 'type' => 'int', 'internal' => 'item'],
];
/**

View File

@ -42,5 +42,4 @@ abstract class MaterialSubcategory extends Enum
public const AUXILIARY_MATERIAL = 101;
public const SUPPLIES = 102;
}

View File

@ -37,10 +37,10 @@ final class MaterialTypeL11nMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'itemmgmt_material_type_l11n_id' => ['name' => 'itemmgmt_material_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_material_type_l11n_title' => ['name' => 'itemmgmt_material_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'itemmgmt_material_type_l11n_type' => ['name' => 'itemmgmt_material_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
'itemmgmt_material_type_l11n_language' => ['name' => 'itemmgmt_material_type_l11n_language', 'type' => 'string', 'internal' => 'language'],
'itemmgmt_material_type_l11n_id' => ['name' => 'itemmgmt_material_type_l11n_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_material_type_l11n_title' => ['name' => 'itemmgmt_material_type_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
'itemmgmt_material_type_l11n_type' => ['name' => 'itemmgmt_material_type_l11n_type', 'type' => 'int', 'internal' => 'ref'],
'itemmgmt_material_type_l11n_language' => ['name' => 'itemmgmt_material_type_l11n_language', 'type' => 'string', 'internal' => 'language'],
];
/**

View File

@ -37,8 +37,8 @@ final class MaterialTypeMapper extends DataMapperFactory
* @since 1.0.0
*/
public const COLUMNS = [
'itemmgmt_material_type_id' => ['name' => 'itemmgmt_material_type_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_material_type_name' => ['name' => 'itemmgmt_material_type_name', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
'itemmgmt_material_type_id' => ['name' => 'itemmgmt_material_type_id', 'type' => 'int', 'internal' => 'id'],
'itemmgmt_material_type_name' => ['name' => 'itemmgmt_material_type_name', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
];
/**
@ -54,7 +54,7 @@ final class MaterialTypeMapper extends DataMapperFactory
'self' => 'itemmgmt_material_type_l11n_type',
'column' => 'content',
'external' => null,
]
],
];
/**

46
Models/NullContainer.php Normal file
View File

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

View File

@ -23,5 +23,5 @@ return ['Navigation' => [
'List' => 'Liste',
'Types' => 'Arten',
'Values' => 'Werte',
'Materials' => 'Materialien',
'Materials' => 'Materialien',
]];

View File

@ -23,5 +23,5 @@ return ['Navigation' => [
'List' => 'List',
'Types' => 'Types',
'Values' => 'Values',
'Materials' => 'Materials',
'Materials' => 'Materials',
]];

View File

@ -13,150 +13,150 @@
declare(strict_types=1);
return ['ItemManagement' => [
'Accounting' => 'Buchhaltung',
'Address' => 'Adresse',
'Articlegroup' => 'ArtikelGroup.',
'Attribute' => 'Attribut',
'AttributeTypes' => 'Attributtypen',
'Attributes' => 'Attribute',
'Available' => 'Erhältlich',
'AvgPrice' => 'Durchschn. Preis',
'Bills' => 'Rechnungen',
'Bonus' => 'Bonus',
'ClientGroup' => 'Client / Gruppe.',
'ClientSection' => 'Kundensparte',
'ClientSegment' => 'Kundensegment',
'ClientType' => 'Kundentyp',
'Commission' => 'Kommission',
'Container' => 'Container',
'CostCenter' => 'Kostenstelle',
'CostIndicator' => 'Kostenindikator',
'CostObject' => 'Kostenträger',
'Countries' => 'Länder',
'Country' => 'Land',
'Created' => 'Erstellt',
'CreatedAt' => 'Erstellt',
'CustomerGroup' => 'Kundengruppe',
'CustomsID' => 'Zoll-ID.',
'Date' => 'Datum',
'Description' => 'Beschreibung',
'Discount' => 'Rabatt',
'DiscountP' => 'Rabatt in%',
'Disposal' => 'Entsorgung',
'Documents' => 'Unterlagen',
'EarningIndicator' => 'Indikator verdienen',
'End' => 'Ende',
'Files' => 'Dateien',
'General' => 'Allgemein',
'GrossWeight' => 'Bruttogewicht',
'Group' => 'Gruppe',
'Groups' => 'Gruppen',
'Height' => 'Höhe',
'ID' => 'ID',
'ILV' => 'ILV',
'Info' => 'Die Info',
'Item' => 'Artikel',
'ItemSection' => 'Artikelsparte',
'ItemSegment' => 'Artikelsegment',
'ItemType' => 'Artikeltyp',
'Items' => 'Produkte',
'Language' => 'Sprache',
'LastOrder' => 'Letzte Bestellung',
'Leadtime' => 'Vorlaufzeit',
'Length' => 'Länge',
'Localization' => 'Lokalisierung',
'Localizations' => 'Lokalisierungen',
'Location' => 'Ort',
'Log' => 'Protokoll',
'Logs' => 'Protokoll',
'Lot' => 'Viel',
'MRR' => 'Mrr.',
'MTDSales' => 'MTD-Verkäufe.',
'Makespan' => 'Makespan',
'Margin' => 'Rand',
'Master' => 'Meister',
'MaximumLevel' => 'Maximaler Lagerstand',
'Media' => 'Medien',
'MinimumLevel' => 'Mindestbestandstufe',
'Modified' => 'Geändert',
'Name' => 'Name',
'Name1' => 'Name1.',
'Name2' => 'Name2.',
'Name3' => 'Name3.',
'Net' => 'Netto',
'NetWeight' => 'Reingewicht',
'None' => 'Keiner',
'Notes' => 'Anmerkungen',
'Number' => 'Nummer',
'Ordered' => 'Bestellt',
'Packaging' => 'Verpackung',
'Price' => 'Preis',
'PriceChange' => 'Preisänderung',
'PriceUnit' => 'Preiseinheit.',
'Prices' => 'Preise',
'Pricing' => 'Preise',
'Procurement' => 'Beschaffung',
'Productgroup' => 'Produktgruppe',
'Production' => 'Produktion',
'Profile' => 'Profil',
'Properties' => 'Eigenschaften',
'Property' => 'Eigentum',
'Purchase' => 'Kaufen',
'PurchasePrice' => 'Kaufpreis',
'Purchasing' => 'Einkauf',
'QA' => 'Qualitätssicherung',
'QM' => 'Qualitätsmanagement',
'Quantity' => 'Menge',
'QuantityUnit' => 'Einheit der Menge.',
'RecentInvoices' => 'Neuste Rechnungen',
'ReorderLevel' => 'Neuordnungspegel',
'Reserved' => 'Reserviert',
'SN' => 'SN',
'Sales' => 'Umsatz',
'SalesPrice' => 'Verkaufspreis',
'SalesPricing' => 'Verkaufspreise',
'Segment' => 'Segment',
'ShelfLife' => 'Haltbarkeit.',
'Start' => 'Start',
'Status' => 'Status',
'Stock' => 'Aktie',
'StockList' => 'Lagerliste',
'Successor' => 'Nachfolger',
'Supplier' => 'Anbieter',
'Text' => 'Text',
'TimeUnit' => 'Zeiteinheit',
'Title' => 'Titel',
'TopCustomers' => 'Top Kunden',
'Tracking' => 'Verfolgung',
'TradingUnit' => 'Handelseinheit',
'Translation' => 'Übersetzung',
'Type' => 'Typ',
'Unit' => 'Einheit',
'Value' => 'Wert',
'Volume' => 'Volumen',
'Warehouse' => 'Lagerhaus',
'Width' => 'Breite',
'YTDSales' => 'Ytd Sales',
'ItemProductGroup' => 'Artikel Produktgruppe',
'ItemSalesGroup' => 'Artikel Umsatzgruppe',
'Accounting' => 'Buchhaltung',
'Address' => 'Adresse',
'Articlegroup' => 'ArtikelGroup.',
'Attribute' => 'Attribut',
'AttributeTypes' => 'Attributtypen',
'Attributes' => 'Attribute',
'Available' => 'Erhältlich',
'AvgPrice' => 'Durchschn. Preis',
'Bills' => 'Rechnungen',
'Bonus' => 'Bonus',
'ClientGroup' => 'Client / Gruppe.',
'ClientSection' => 'Kundensparte',
'ClientSegment' => 'Kundensegment',
'ClientType' => 'Kundentyp',
'Commission' => 'Kommission',
'Container' => 'Container',
'CostCenter' => 'Kostenstelle',
'CostIndicator' => 'Kostenindikator',
'CostObject' => 'Kostenträger',
'Countries' => 'Länder',
'Country' => 'Land',
'Created' => 'Erstellt',
'CreatedAt' => 'Erstellt',
'CustomerGroup' => 'Kundengruppe',
'CustomsID' => 'Zoll-ID.',
'Date' => 'Datum',
'Description' => 'Beschreibung',
'Discount' => 'Rabatt',
'DiscountP' => 'Rabatt in%',
'Disposal' => 'Entsorgung',
'Documents' => 'Unterlagen',
'EarningIndicator' => 'Indikator verdienen',
'End' => 'Ende',
'Files' => 'Dateien',
'General' => 'Allgemein',
'GrossWeight' => 'Bruttogewicht',
'Group' => 'Gruppe',
'Groups' => 'Gruppen',
'Height' => 'Höhe',
'ID' => 'ID',
'ILV' => 'ILV',
'Info' => 'Die Info',
'Item' => 'Artikel',
'ItemSection' => 'Artikelsparte',
'ItemSegment' => 'Artikelsegment',
'ItemType' => 'Artikeltyp',
'Items' => 'Produkte',
'Language' => 'Sprache',
'LastOrder' => 'Letzte Bestellung',
'Leadtime' => 'Vorlaufzeit',
'Length' => 'Länge',
'Localization' => 'Lokalisierung',
'Localizations' => 'Lokalisierungen',
'Location' => 'Ort',
'Log' => 'Protokoll',
'Logs' => 'Protokoll',
'Lot' => 'Viel',
'MRR' => 'Mrr.',
'MTDSales' => 'MTD-Verkäufe.',
'Makespan' => 'Makespan',
'Margin' => 'Rand',
'Master' => 'Meister',
'MaximumLevel' => 'Maximaler Lagerstand',
'Media' => 'Medien',
'MinimumLevel' => 'Mindestbestandstufe',
'Modified' => 'Geändert',
'Name' => 'Name',
'Name1' => 'Name1.',
'Name2' => 'Name2.',
'Name3' => 'Name3.',
'Net' => 'Netto',
'NetWeight' => 'Reingewicht',
'None' => 'Keiner',
'Notes' => 'Anmerkungen',
'Number' => 'Nummer',
'Ordered' => 'Bestellt',
'Packaging' => 'Verpackung',
'Price' => 'Preis',
'PriceChange' => 'Preisänderung',
'PriceUnit' => 'Preiseinheit.',
'Prices' => 'Preise',
'Pricing' => 'Preise',
'Procurement' => 'Beschaffung',
'Productgroup' => 'Produktgruppe',
'Production' => 'Produktion',
'Profile' => 'Profil',
'Properties' => 'Eigenschaften',
'Property' => 'Eigentum',
'Purchase' => 'Kaufen',
'PurchasePrice' => 'Kaufpreis',
'Purchasing' => 'Einkauf',
'QA' => 'Qualitätssicherung',
'QM' => 'Qualitätsmanagement',
'Quantity' => 'Menge',
'QuantityUnit' => 'Einheit der Menge.',
'RecentInvoices' => 'Neuste Rechnungen',
'ReorderLevel' => 'Neuordnungspegel',
'Reserved' => 'Reserviert',
'SN' => 'SN',
'Sales' => 'Umsatz',
'SalesPrice' => 'Verkaufspreis',
'SalesPricing' => 'Verkaufspreise',
'Segment' => 'Segment',
'ShelfLife' => 'Haltbarkeit.',
'Start' => 'Start',
'Status' => 'Status',
'Stock' => 'Aktie',
'StockList' => 'Lagerliste',
'Successor' => 'Nachfolger',
'Supplier' => 'Anbieter',
'Text' => 'Text',
'TimeUnit' => 'Zeiteinheit',
'Title' => 'Titel',
'TopCustomers' => 'Top Kunden',
'Tracking' => 'Verfolgung',
'TradingUnit' => 'Handelseinheit',
'Translation' => 'Übersetzung',
'Type' => 'Typ',
'Unit' => 'Einheit',
'Value' => 'Wert',
'Volume' => 'Volumen',
'Warehouse' => 'Lagerhaus',
'Width' => 'Breite',
'YTDSales' => 'Ytd Sales',
'ItemProductGroup' => 'Artikel Produktgruppe',
'ItemSalesGroup' => 'Artikel Umsatzgruppe',
'Promocode' => 'Promocode',
'Region' => 'Region',
'Region' => 'Region',
'Materials' => 'Materialien',
'Weight' => 'Gewicht',
'Depth' => 'Tiefe',
'WidthLength' => 'Breite/Länge',
'MaximumOrderInterval' => 'Maximales Bestellintervall',
'MinimumOrderQuantity' => 'Mindestbestellmenge',
'PrimarySupplier' => 'Hauptlieferant',
'LeadTime' => 'Lieferzeit',
'UnitQuantity' => 'Einheitsmenge',
'Weight' => 'Gewicht',
'Depth' => 'Tiefe',
'WidthLength' => 'Breite/Länge',
'MaximumOrderInterval' => 'Maximales Bestellintervall',
'MinimumOrderQuantity' => 'Mindestbestellmenge',
'PrimarySupplier' => 'Hauptlieferant',
'LeadTime' => 'Lieferzeit',
'UnitQuantity' => 'Einheitsmenge',
'UnitPrice' => 'Einheitspreis',
'Lieferanten' => 'Lieferanten',
'CostCenter' => 'Kostenstelle',
'CostObject' => 'Kostenträger',
'DefaultStock' => 'Standard Lager',
'DefaultStockLocation' => 'Standard Lagerplatz',
'Lieferanten' => 'Lieferanten',
'CostCenter' => 'Kostenstelle',
'CostObject' => 'Kostenträger',
'DefaultStock' => 'Standard Lager',
'DefaultStockLocation' => 'Standard Lagerplatz',
'Inventory' => 'Bestandsführung',
'Identifier' => 'Identifizierung',
'Stocktaking' => 'Inventur',
'Identifier' => 'Identifizierung',
'Stocktaking' => 'Inventur',
]];

View File

@ -13,150 +13,150 @@
declare(strict_types=1);
return ['ItemManagement' => [
'Accounting' => 'Accounting',
'Address' => 'Address',
'Articlegroup' => 'Articlegroup',
'Attribute' => 'Attribute',
'AttributeTypes' => 'Attribute types',
'Attributes' => 'Attributes',
'Available' => 'Available',
'AvgPrice' => 'Avg. Price',
'Bills' => 'Bills',
'Bonus' => 'Bonus',
'ClientGroup' => 'Client Group',
'ClientSection' => 'Client Section',
'ClientSegment' => 'Client Segment',
'ClientType' => 'Client Type',
'Commission' => 'Commission',
'Container' => 'Container',
'CostCenter' => 'CostCenter',
'CostIndicator' => 'Cost Indicator',
'CostObject' => 'CostObject',
'Countries' => 'Countries',
'Country' => 'Country',
'Created' => 'Created',
'CreatedAt' => 'Created',
'CustomerGroup' => 'Customer Group',
'CustomsID' => 'Customs ID',
'Date' => 'Date',
'Description' => 'Description',
'Discount' => 'Discount',
'DiscountP' => 'Discount in %',
'Disposal' => 'Disposal',
'Documents' => 'Documents',
'EarningIndicator' => 'Earning Indicator',
'End' => 'End',
'Files' => 'Files',
'General' => 'General',
'GrossWeight' => 'Gross Weight',
'Group' => 'Group',
'Groups' => 'Groups',
'Height' => 'Height',
'ID' => 'ID',
'ILV' => 'ILV',
'Info' => 'Info',
'Item' => 'Item',
'ItemSection' => 'Item Section',
'ItemSegment' => 'Item Segment',
'ItemType' => 'Item Type',
'Items' => 'Items',
'Language' => 'Language',
'LastOrder' => 'Last Order',
'Leadtime' => 'Lead time',
'Length' => 'Length',
'Localization' => 'Localization',
'Localizations' => 'Localizations',
'Location' => 'Location',
'Log' => 'Log',
'Logs' => 'Logs',
'Lot' => 'Lot',
'MRR' => 'MRR',
'MTDSales' => 'MTD Sales',
'Makespan' => 'Makespan',
'Margin' => 'Margin',
'Master' => 'Master',
'MaximumLevel' => 'Maximum stock level',
'Media' => 'Media',
'MinimumLevel' => 'Minimum stock level',
'Modified' => 'Modified',
'Name' => 'Name',
'Name1' => 'Name1',
'Name2' => 'Name2',
'Name3' => 'Name3',
'Net' => 'Net',
'NetWeight' => 'Net Weight',
'None' => 'None',
'Notes' => 'Notes',
'Number' => 'Number',
'Ordered' => 'Ordered',
'Packaging' => 'Packaging',
'Price' => 'Price',
'PriceChange' => 'Price Change',
'PriceUnit' => 'Unit of price',
'Prices' => 'Prices',
'Pricing' => 'Pricing',
'Procurement' => 'Procurement',
'Productgroup' => 'Productgroup',
'Production' => 'Production',
'Profile' => 'Profile',
'Properties' => 'Properties',
'Property' => 'Property',
'Purchase' => 'Purchase',
'PurchasePrice' => 'Purchase Price',
'Purchasing' => 'Purchasing',
'QA' => 'QA',
'QM' => 'QM',
'Quantity' => 'Quantity',
'QuantityUnit' => 'Unit of quantity',
'RecentInvoices' => 'Recent invoices',
'ReorderLevel' => 'Reorder level',
'Reserved' => 'Reserved',
'SN' => 'SN',
'Sales' => 'Sales',
'SalesPrice' => 'Sales Price',
'SalesPricing' => 'Sales Pricing',
'Segment' => 'Segment',
'ShelfLife' => 'Shelf life',
'Start' => 'Start',
'Status' => 'Status',
'Stock' => 'Stock',
'StockList' => 'Stock list',
'Successor' => 'Successor',
'Supplier' => 'Supplier',
'Text' => 'Text',
'TimeUnit' => 'Unit of time',
'Title' => 'Title',
'TopCustomers' => 'Top Customers',
'Tracking' => 'Tracking',
'TradingUnit' => 'Trading Unit',
'Translation' => 'Translation',
'Type' => 'Type',
'Unit' => 'Unit',
'Value' => 'Value',
'Volume' => 'Volume',
'Warehouse' => 'Warehouse',
'Width' => 'Width',
'YTDSales' => 'YTD Sales',
'ItemProductGroup' => 'Item Product Group',
'ItemSalesGroup' => 'Item Sales Group',
'Accounting' => 'Accounting',
'Address' => 'Address',
'Articlegroup' => 'Articlegroup',
'Attribute' => 'Attribute',
'AttributeTypes' => 'Attribute types',
'Attributes' => 'Attributes',
'Available' => 'Available',
'AvgPrice' => 'Avg. Price',
'Bills' => 'Bills',
'Bonus' => 'Bonus',
'ClientGroup' => 'Client Group',
'ClientSection' => 'Client Section',
'ClientSegment' => 'Client Segment',
'ClientType' => 'Client Type',
'Commission' => 'Commission',
'Container' => 'Container',
'CostCenter' => 'CostCenter',
'CostIndicator' => 'Cost Indicator',
'CostObject' => 'CostObject',
'Countries' => 'Countries',
'Country' => 'Country',
'Created' => 'Created',
'CreatedAt' => 'Created',
'CustomerGroup' => 'Customer Group',
'CustomsID' => 'Customs ID',
'Date' => 'Date',
'Description' => 'Description',
'Discount' => 'Discount',
'DiscountP' => 'Discount in %',
'Disposal' => 'Disposal',
'Documents' => 'Documents',
'EarningIndicator' => 'Earning Indicator',
'End' => 'End',
'Files' => 'Files',
'General' => 'General',
'GrossWeight' => 'Gross Weight',
'Group' => 'Group',
'Groups' => 'Groups',
'Height' => 'Height',
'ID' => 'ID',
'ILV' => 'ILV',
'Info' => 'Info',
'Item' => 'Item',
'ItemSection' => 'Item Section',
'ItemSegment' => 'Item Segment',
'ItemType' => 'Item Type',
'Items' => 'Items',
'Language' => 'Language',
'LastOrder' => 'Last Order',
'Leadtime' => 'Lead time',
'Length' => 'Length',
'Localization' => 'Localization',
'Localizations' => 'Localizations',
'Location' => 'Location',
'Log' => 'Log',
'Logs' => 'Logs',
'Lot' => 'Lot',
'MRR' => 'MRR',
'MTDSales' => 'MTD Sales',
'Makespan' => 'Makespan',
'Margin' => 'Margin',
'Master' => 'Master',
'MaximumLevel' => 'Maximum stock level',
'Media' => 'Media',
'MinimumLevel' => 'Minimum stock level',
'Modified' => 'Modified',
'Name' => 'Name',
'Name1' => 'Name1',
'Name2' => 'Name2',
'Name3' => 'Name3',
'Net' => 'Net',
'NetWeight' => 'Net Weight',
'None' => 'None',
'Notes' => 'Notes',
'Number' => 'Number',
'Ordered' => 'Ordered',
'Packaging' => 'Packaging',
'Price' => 'Price',
'PriceChange' => 'Price Change',
'PriceUnit' => 'Unit of price',
'Prices' => 'Prices',
'Pricing' => 'Pricing',
'Procurement' => 'Procurement',
'Productgroup' => 'Productgroup',
'Production' => 'Production',
'Profile' => 'Profile',
'Properties' => 'Properties',
'Property' => 'Property',
'Purchase' => 'Purchase',
'PurchasePrice' => 'Purchase Price',
'Purchasing' => 'Purchasing',
'QA' => 'QA',
'QM' => 'QM',
'Quantity' => 'Quantity',
'QuantityUnit' => 'Unit of quantity',
'RecentInvoices' => 'Recent invoices',
'ReorderLevel' => 'Reorder level',
'Reserved' => 'Reserved',
'SN' => 'SN',
'Sales' => 'Sales',
'SalesPrice' => 'Sales Price',
'SalesPricing' => 'Sales Pricing',
'Segment' => 'Segment',
'ShelfLife' => 'Shelf life',
'Start' => 'Start',
'Status' => 'Status',
'Stock' => 'Stock',
'StockList' => 'Stock list',
'Successor' => 'Successor',
'Supplier' => 'Supplier',
'Text' => 'Text',
'TimeUnit' => 'Unit of time',
'Title' => 'Title',
'TopCustomers' => 'Top Customers',
'Tracking' => 'Tracking',
'TradingUnit' => 'Trading Unit',
'Translation' => 'Translation',
'Type' => 'Type',
'Unit' => 'Unit',
'Value' => 'Value',
'Volume' => 'Volume',
'Warehouse' => 'Warehouse',
'Width' => 'Width',
'YTDSales' => 'YTD Sales',
'ItemProductGroup' => 'Item Product Group',
'ItemSalesGroup' => 'Item Sales Group',
'Promocode' => 'Promocode',
'Region' => 'Region',
'Region' => 'Region',
'Materials' => 'Materials',
'Weight' => 'Weight',
'Depth' => 'Depth',
'WidthLength' => 'Width/Length',
'MaximumOrderInterval' => 'Maximum Order Interval',
'MinimumOrderQuantity' => 'Minimum Order Quantity',
'PrimarySupplier' => 'Primary Supplier',
'LeadTime' => 'Lead Time',
'UnitQuantity' => 'Unit Quantity',
'Weight' => 'Weight',
'Depth' => 'Depth',
'WidthLength' => 'Width/Length',
'MaximumOrderInterval' => 'Maximum Order Interval',
'MinimumOrderQuantity' => 'Minimum Order Quantity',
'PrimarySupplier' => 'Primary Supplier',
'LeadTime' => 'Lead Time',
'UnitQuantity' => 'Unit Quantity',
'UnitPrice' => 'Unit Price',
'Suppliers' => 'Suppliers',
'CostCenter' => 'Cost Center',
'CostObject' => 'Cost Object',
'DefaultStock' => 'Default stock',
'DefaultStockLocation' => 'Default stock location',
'CostCenter' => 'Cost Center',
'CostObject' => 'Cost Object',
'DefaultStock' => 'Default stock',
'DefaultStockLocation' => 'Default stock location',
'Inventory' => 'Inventory',
'Identifier' => 'Identifier',
'Stocktaking' => 'Stocktaking',
'Identifier' => 'Identifier',
'Stocktaking' => 'Stocktaking',
]];

View File

@ -86,7 +86,7 @@ echo $this->data['nav']->render(); ?>
<tr>
<td><a href="#"><i class="g-icon">close</i></a>
<td><a href="#"><i class="g-icon">settings</i></a>
<td><?= ISO639Enum::getByName('_' . \strtoupper($value->getLanguage())); ?>
<td><?= ISO639Enum::getByName('_' . \strtoupper($value->language)); ?>
<td><?= $value->content; ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>

View File

@ -12,6 +12,8 @@
*/
declare(strict_types=1);
use Modules\ItemManagement\Models\StockIdentifierType;
use phpOMS\Stdlib\Base\FloatInt;
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Views\View $this */
@ -128,7 +130,7 @@ echo $this->data['nav']->render(); ?>
<tbody>
<?php $count = 0; foreach ($items as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/item/profile?{?}&id=' . $value->id);
$url = UriFactory::build('{/base}/item/view?{?}&id=' . $value->id);
$image = $value->getFileByTypeName('item_profile_image');
?>
<tr data-href="<?= $url; ?>">
@ -140,10 +142,37 @@ echo $this->data['nav']->render(); ?>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n('name1')->content); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n('name2')->content); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($value->getL11n('name3')->content); ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($value->salesPrice); ?></a>
<td>
<td>
<td>
<td class="rightText"><a href="<?= $url; ?>"><?= $this->getCurrency($value->salesPrice, symbol: ''); ?></a>
<?php if ($value->stockIdentifier === StockIdentifierType::NONE) : ?>
<td>
<td>
<td>
<?php else : ?>
<td class="rightText"><a href="<?= $url; ?>">
<?php
$sum = 0;
foreach ($this->data['dists'][$value->id] ?? [] as $dist) {
$sum += $dist->quantity;
}
$total = new FloatInt($sum);
echo $total->getAmount(\reset($value->container)->quantityDecimals);
?></a>
<td class="rightText"><a href="<?= $url; ?>">
<?php
$total = new FloatInt($this->data['reserved'][$value->id] ?? 0);
echo $total->getAmount(\reset($value->container)->quantityDecimals);
?></a>
<td class="rightText"><a href="<?= $url; ?>">
<?php
$total = new FloatInt($this->data['ordered'][$value->id] ?? 0);
echo $total->getAmount(\reset($value->container)->quantityDecimals);
?></a>
<?php endif; ?>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="9" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>

View File

@ -24,7 +24,6 @@ use phpOMS\Localization\ISO3166NameEnum;
use phpOMS\Localization\ISO4217CharEnum;
use phpOMS\Localization\ISO639Enum;
use phpOMS\Localization\Money;
use phpOMS\Localization\NullLocalization;
use phpOMS\Localization\RegionEnum;
use phpOMS\Message\Http\HttpHeader;
use phpOMS\Stdlib\Base\SmartDateTime;
@ -37,18 +36,15 @@ $notes = $item->notes;
$files = $item->files;
$itemImage = $this->getData('itemImage') ?? new NullMedia();
$allInvoices = $this->data['allInvoices'] ?? [];
$topCustomers = $this->getData('topCustomers') ?? [[], []];
$attributeView = $this->data['attributeView'];
$l11nView = $this->data['l11nView'];
$allInvoices = $this->data['allInvoices'] ?? [];
$topCustomers = $this->getData('topCustomers') ?? [[], []];
$attributeView = $this->data['attributeView'];
$l11nView = $this->data['l11nView'];
$languages = ISO639Enum::getConstants();
/** @var \phpOMS\Localization\Localization $l11n */
$l11n = $this->getData('default_localization') ?? new NullLocalization();
$regions = RegionEnum::getConstants();
$countries = ISO3166CharEnum::getConstants();
$regions = RegionEnum::getConstants();
$countries = ISO3166CharEnum::getConstants();
$currencies = ISO4217CharEnum::getConstants();
echo $this->data['nav']->render();
@ -94,7 +90,7 @@ echo $this->data['nav']->render();
<div class="portlet-body">
<table class="layout wf-100">
<tr><td><label for="iId"><?= $this->getHtml('ID', '0', '0'); ?></label>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input type="number" id="iId" min="1" name="id" value="<?= $this->printHtml($item->number); ?>" disabled></span>
<tr><td><span class="input"><button type="button" formaction=""><i class="g-icon">book</i></button><input type="text" id="iId" min="1" name="id" value="<?= $this->printHtml($item->number); ?>" disabled></span>
<tr><td><label for="iName1"><?= $this->getHtml('Name1'); ?></label>
<tr><td><input type="text" id="iName1" name="name1" value="<?= $this->printHtml($item->getL11n('name1')->content); ?>" spellcheck="false" required>
<tr><td><label for="iName2"><?= $this->getHtml('Name2'); ?></label>
@ -133,11 +129,11 @@ echo $this->data['nav']->render();
<div class="portlet-body">
<table class="wf-100">
<tr><td><?= $this->getHtml('YTDSales'); ?>:
<td><?= $this->getCurrency(SalesBillMapper::getItemNetSales($item->id, SmartDateTime::startOfYear($this->data['business_start']), new \DateTime('now')), format: 'medium'); ?>
<td><?= $this->getCurrency(SalesBillMapper::getItemNetSales($item->id, SmartDateTime::startOfYear($this->data['business_start']), new \DateTime('now')), symbol: '', format: 'medium'); ?>
<tr><td><?= $this->getHtml('MTDSales'); ?>:
<td><?= $this->getCurrency(SalesBillMapper::getItemNetSales($item->id, SmartDateTime::startOfMonth(), new \DateTime('now')), format: 'medium'); ?>
<td><?= $this->getCurrency(SalesBillMapper::getItemNetSales($item->id, SmartDateTime::startOfMonth(), new \DateTime('now')), symbol: '', format: 'medium'); ?>
<tr><td><?= $this->getHtml('ILV'); ?>:
<td><?= $this->getCurrency(SalesBillMapper::getILVHistoric($item->id), format: 'medium'); ?>
<td><?= $this->getCurrency(SalesBillMapper::getILVHistoric($item->id), symbol: '', format: 'medium'); ?>
</table>
</div>
</section>
@ -163,9 +159,9 @@ echo $this->data['nav']->render();
<div class="portlet-body">
<table class="wf-100">
<tr><td><?= $this->getHtml('SalesPrice'); ?>:
<td><?= $this->getCurrency($item->salesPrice, format: 'medium'); ?>
<td><?= $this->getCurrency($item->salesPrice, symbol: '', format: 'medium'); ?>
<tr><td><?= $this->getHtml('PurchasePrice'); ?>:
<td><?= $this->getCurrency($item->purchasePrice, format: 'medium'); ?>
<td><?= $this->getCurrency($item->purchasePrice, symbol: '', format: 'medium'); ?>
<tr><td><?= $this->getHtml('Margin'); ?>:
<td><?= $this->getNumeric(
$item->salesPrice->getInt() === 0
@ -193,13 +189,19 @@ echo $this->data['nav']->render();
<td class="wf-100"><?= $this->getHtml('Title'); ?>
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($notes as $note) :
$url = UriFactory::build('{/base}/editor/single?{?}&id=' . $note->id);
?>
<?php
$count = 0;
foreach ($notes as $note) :
++$count;
$url = UriFactory::build('{/base}/editor/view?{?}&id=' . $note->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($note->title); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($note->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
@ -219,14 +221,20 @@ echo $this->data['nav']->render();
<td>
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($files as $file) :
$url = UriFactory::build('{/base}/media/single?{?}&id=' . $file->id);
?>
<?php
$count = 0;
foreach ($files as $file) :
++$count;
$url = UriFactory::build('{/base}/media/view?{?}&id=' . $file->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($file->name); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($file->extension); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($file->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="3" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
@ -258,17 +266,23 @@ echo $this->data['nav']->render();
->limit(5)
->execute();
$count = 0;
/** @var \Modules\Billing\Models\Bill $invoice */
foreach ($newestInvoices as $invoice) :
++$count;
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->getNumber()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->type->getL11n()); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/sales/client/profile?{?}&id=' . $invoice->client->id); ?>"><?= $this->printHtml($invoice->billTo); ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/sales/client/view?{?}&id=' . $invoice->client->id); ?>"><?= $this->printHtml($invoice->billTo); ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales, symbol: ''); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
@ -293,12 +307,12 @@ echo $this->data['nav']->render();
<td><?= $this->getHtml('Net'); ?>
<tbody>
<?php $i = -1; foreach (($topCustomers[0] ?? []) as $client) : ++$i;
$url = UriFactory::build('{/base}/sales/client/profile?id=' . $client->id);
$url = UriFactory::build('{/base}/sales/client/view?id=' . $client->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->number); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->account->name1); ?> <?= $this->printHtml($client->account->name2); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->mainAddress->getCountry()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->mainAddress->country); ?></a>
<td><a href="<?= $url; ?>"><?= (new Money((int) $topCustomers[1][$i]['net_sales']))->getCurrency(); ?></a>
<?php endforeach; ?>
</table>
@ -333,7 +347,7 @@ echo $this->data['nav']->render();
<?php
$temp = [];
foreach ($monthlySalesCosts as $monthly) {
$temp[] = \round(((((int) $monthly['net_sales']) - ((int) $monthly['net_costs'])) / ((int) $monthly['net_sales'])) * 100, 2);
$temp[] = \round(((int) $monthly['net_sales']) === 0 ? 0 : ((((int) $monthly['net_sales']) - ((int) $monthly['net_costs'])) / ((int) $monthly['net_sales'])) * 100, 2);
}
?>
<?= \implode(',', $temp); ?>
@ -394,9 +408,7 @@ echo $this->data['nav']->render();
</section>
</div>
<?php endif; ?>
</div>
<div class="row">
<?php
$regionSales = [];
if (!empty($regionSales)) : ?>
@ -585,6 +597,7 @@ echo $this->data['nav']->render();
<td><?= $this->getHtml('ID', '0', '0'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<td><?= $this->getHtml('Name'); ?><i class="sort-asc g-icon">expand_less</i><i class="sort-desc g-icon">expand_more</i>
<td><?= $this->getHtml('Quantity'); ?>
<td><?= $this->getHtml('Decimals'); ?>
<td><?= $this->getHtml('Weight'); ?>
<td><?= $this->getHtml('WidthLength'); ?>
<td><?= $this->getHtml('Height'); ?>
@ -604,6 +617,7 @@ echo $this->data['nav']->render();
<td data-tpl-text="/id" data-tpl-value="/id"></td>
<td data-tpl-text="/name" data-tpl-value="/name" data-value=""></td>
<td data-tpl-text="/quantity" data-tpl-value="/quantity"></td>
<td data-tpl-text="/decimals" data-tpl-value="/decimals"></td>
<td data-tpl-text="/weight" data-tpl-value="/weight"></td>
<td data-tpl-text="/width" data-tpl-value="/width"></td>
<td data-tpl-text="/height" data-tpl-value="/height"></td>
@ -612,14 +626,14 @@ echo $this->data['nav']->render();
</tr>
</template>
<?php
$c = 0;
$c = 0;
$containers = $this->data['containers'] ?? [];
foreach ($containers as $key => $value) : ++$c;
?>
<tr data-id="<?= $value->id; ?>">
<td>
<i class="g-icon btn update-form">settings</i>
<?php if ($value->name !== 'base') : ?>
<?php if ($value->name !== 'default') : ?>
<input id="itemContainerTable-remove-<?= $value->id; ?>" type="checkbox" class="hidden">
<label for="itemContainerTable-remove-<?= $value->id; ?>" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
@ -630,6 +644,7 @@ echo $this->data['nav']->render();
<td data-tpl-text="/id" data-tpl-value="/id"><?= $value->id; ?>
<td data-tpl-text="/name" data-tpl-value="/name"><?= $this->printHtml($value->name); ?>
<td data-tpl-text="/quantity" data-tpl-value="/quantity"><?= $this->printHtml($value->promocode); ?>
<td data-tpl-text="/decimals" data-tpl-value="/decimals"><?= $this->printHtml($value->promocode); ?>
<td data-tpl-text="/weight" data-tpl-value="/weight"><?= $this->printHtml($value->price->getAmount()); ?>
<td data-tpl-text="/width" data-tpl-value="/width"><?= $this->printHtml($value->currency); ?>
<td data-tpl-text="/height" data-tpl-value="/height"><?= $this->printHtml((string) $value->quantity); ?>
@ -682,7 +697,7 @@ echo $this->data['nav']->render();
<div class="fixed">
<select id="iPriceCurrency" name="currency" data-tpl-text="/currency" data-tpl-value="/currency">
<?php foreach ($currencies as $currency) : ?>
<option value="<?= $currency; ?>"<?= $this->data['default_localization']->currency === $currency ? ' selected' : ''; ?>><?= $this->printHtml($currency); ?>
<option value="<?= $currency; ?>"<?= $this->data['attributeView']->data['default_localization']->currency === $currency ? ' selected' : ''; ?>><?= $this->printHtml($currency); ?>
<?php endforeach; ?>
</select>
</div>
@ -947,14 +962,17 @@ echo $this->data['nav']->render();
</tr>
</template>
<?php
$c = 0;
$prices = $this->data['prices'];
foreach ($prices as $key => $value) : ++$c;
$c = 0;
foreach ($this->data['prices'] as $key => $value) :
if ($value->type !== PriceType::SALES) {
continue;
}
++$c;
?>
<tr data-id="<?= $value->id; ?>">
<td>
<i class="g-icon btn update-form">settings</i>
<?php if ($value->name !== 'base') : ?>
<?php if ($value->name !== 'default') : ?>
<input id="itemSalesPriceTable-remove-<?= $value->id; ?>" type="checkbox" class="hidden">
<label for="itemSalesPriceTable-remove-<?= $value->id; ?>" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
@ -965,12 +983,12 @@ echo $this->data['nav']->render();
<td data-tpl-text="/id" data-tpl-value="/id"><?= $value->id; ?>
<td data-tpl-text="/name" data-tpl-value="/name"><?= $this->printHtml($value->name); ?>
<td data-tpl-text="/promocode" data-tpl-value="/promocode"><?= $this->printHtml($value->promocode); ?>
<td data-tpl-text="/price" data-tpl-value="/price"><?= $this->printHtml($value->price->getAmount()); ?>
<td data-tpl-text="/price" data-tpl-value="/price"><?= $this->printHtml($value->priceNew->getAmount()); ?>
<td data-tpl-text="/currency" data-tpl-value="/currency"><?= $this->printHtml($value->currency); ?>
<td data-tpl-text="/quantity" data-tpl-value="/quantity"><?= $this->printHtml((string) $value->quantity); ?>
<td data-tpl-text="/discount" data-tpl-value="/discount"><?= $this->printHtml((string) $value->discount); ?>
<td data-tpl-text="/discountp" data-tpl-value="/discountp"><?= $this->printHtml((string) $value->discountPercentage); ?>
<td data-tpl-text="/bonus" data-tpl-value="/bonus"><?= $this->printHtml((string) $value->bonus); ?>
<td data-tpl-text="/quantity" data-tpl-value="/quantity"><?= $value->quantity->getAmount(); ?>
<td data-tpl-text="/discount" data-tpl-value="/discount"><?= $value->discount->getAmount(); ?>
<td data-tpl-text="/discountp" data-tpl-value="/discountp"><?= $this->getPercentage($value->discountPercentage->value / 10000 / 100); ?>
<td data-tpl-text="/bonus" data-tpl-value="/bonus"><?= $value->bonus->getAmount(); ?>
<td data-tpl-text="/item_segment" data-tpl-value="/item_segment"><?= $this->printHtml((string) $value->itemsegment->getL11n()); ?>
<td data-tpl-text="/item_section" data-tpl-value="/item_section"><?= $this->printHtml((string) $value->itemsection->getL11n()); ?>
<td data-tpl-text="/item_salesgroup" data-tpl-value="/item_salesgroup"><?= $this->printHtml((string) $value->itemsalesgroup->getL11n()); ?>
@ -1084,7 +1102,7 @@ echo $this->data['nav']->render();
<div class="fixed">
<select id="iPurchasePriceCurrency" name="currency" data-tpl-text="/currency" data-tpl-value="/currency">
<?php foreach ($currencies as $currency) : ?>
<option value="<?= $currency; ?>"<?= $this->data['default_localization']->currency === $currency ? ' selected' : ''; ?>><?= $this->printHtml($currency); ?>
<option value="<?= $currency; ?>"<?= $this->data['attributeView']->data['default_localization']->currency === $currency ? ' selected' : ''; ?>><?= $this->printHtml($currency); ?>
<?php endforeach; ?>
</select>
</div>
@ -1196,47 +1214,40 @@ echo $this->data['nav']->render();
</tr>
</template>
<?php
$c = 0;
$prices = $this->data['purchase_prices'];
foreach ($prices as $key => $value) : ++$c;
$c = 0;
foreach ($this->data['prices'] as $key => $value) :
if ($value->type !== PriceType::PURCHASE) {
continue;
}
++$c;
?>
<tr data-id="<?= $value->id; ?>">
<td>
<i class="g-icon btn update-form">settings</i>
<?php if ($value->name !== 'base') : ?>
<input id="itemPurchasePriceTable-remove-<?= $value->id; ?>" type="checkbox" class="hidden">
<label for="itemPurchasePriceTable-remove-<?= $value->id; ?>" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
<label for="itemPurchasePriceTable-remove-<?= $value->id; ?>" class="link default"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
<label for="itemPurchasePriceTable-remove-<?= $value->id; ?>" class="remove-form link cancel"><?= $this->getHtml('Delete', '0', '0'); ?></label>
</span>
<?php endif; ?>
<td data-tpl-text="/id" data-tpl-value="/id"><?= $value->id; ?>
<td data-tpl-text="/name" data-tpl-value="/name"><?= $this->printHtml($value->name); ?>
<td data-tpl-text="/promocode" data-tpl-value="/promocode"><?= $this->printHtml($value->promocode); ?>
<td data-tpl-text="/price" data-tpl-value="/price"><?= $this->printHtml($value->price->getAmount()); ?>
<td data-tpl-text="/currency" data-tpl-value="/currency"><?= $this->printHtml($value->currency); ?>
<td data-tpl-text="/quantity" data-tpl-value="/quantity"><?= $this->printHtml((string) $value->quantity); ?>
<td data-tpl-text="/discount" data-tpl-value="/discount"><?= $this->printHtml((string) $value->discount); ?>
<td data-tpl-text="/discountp" data-tpl-value="/discountp"><?= $this->printHtml((string) $value->discountPercentage); ?>
<td data-tpl-text="/bonus" data-tpl-value="/bonus"><?= $this->printHtml((string) $value->bonus); ?>
<td data-tpl-text="/item_segment" data-tpl-value="/item_segment"><?= $this->printHtml((string) $value->itemsegment->getL11n()); ?>
<td data-tpl-text="/item_section" data-tpl-value="/item_section"><?= $this->printHtml((string) $value->itemsection->getL11n()); ?>
<td data-tpl-text="/item_salesgroup" data-tpl-value="/item_salesgroup"><?= $this->printHtml((string) $value->itemsalesgroup->getL11n()); ?>
<td data-tpl-text="/item_productgroup" data-tpl-value="/item_productgroup"><?= $this->printHtml((string) $value->itemproductgroup->getL11n()); ?>
<td data-tpl-text="/item_producttype" data-tpl-value="/item_producttype"><?= $this->printHtml((string) $value->itemtype->getL11n()); ?>
<td data-tpl-text="/item_account_segment" data-tpl-value="/item_account_segment"><?= $this->printHtml((string) $value->clientsegment->getL11n()); ?>
<td data-tpl-text="/item_account_section" data-tpl-value="/item_account_section"><?= $this->printHtml((string) $value->clientsection->getL11n()); ?>
<td data-tpl-text="/item_account_group" data-tpl-value="/item_account_group"><?= $this->printHtml((string) $value->clientgroup->getL11n()); ?>
<td data-tpl-text="/item_account_type" data-tpl-value="/item_account_type"><?= $this->printHtml((string) $value->clienttype->getL11n()); ?>
<td data-tpl-text="/item_account_region" data-tpl-value="/item_account_region"><?= $this->printHtml((string) $value->clientcountry); ?>
<td data-tpl-text="/item_start" data-tpl-value="/item_start"><?= $value->start?->format('Y-m-d'); ?>
<td data-tpl-text="/item_end" data-tpl-value="/item_end"><?= $value->end?->format('Y-m-d'); ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="22" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
<tr data-id="<?= $value->id; ?>">
<td>
<i class="g-icon btn update-form">settings</i>
<?php if ($value->name !== 'default') : ?>
<input id="itemPurchasePriceTable-remove-<?= $value->id; ?>" type="checkbox" class="hidden">
<label for="itemPurchasePriceTable-remove-<?= $value->id; ?>" class="checked-visibility-alt"><i class="g-icon btn form-action">close</i></label>
<span class="checked-visibility">
<label for="itemPurchasePriceTable-remove-<?= $value->id; ?>" class="link default"><?= $this->getHtml('Cancel', '0', '0'); ?></label>
<label for="itemPurchasePriceTable-remove-<?= $value->id; ?>" class="remove-form link cancel"><?= $this->getHtml('Delete', '0', '0'); ?></label>
</span>
<?php endif; ?>
<td data-tpl-text="/id" data-tpl-value="/id"><?= $value->id; ?>
<td data-tpl-text="/name" data-tpl-value="/name"><?= $this->printHtml($value->name); ?>
<td data-tpl-text="/supplier" data-tpl-value="/supplier"><?= $this->printHtml($value->supplier->number); ?>
<td data-tpl-text="/price" data-tpl-value="/price"><?= $value->priceNew->getAmount(); ?>
<td data-tpl-text="/currency" data-tpl-value="/currency"><?= $this->printHtml($value->currency); ?>
<td data-tpl-text="/quantity" data-tpl-value="/quantity"><?= $value->quantity->getAmount(); ?>
<td data-tpl-text="/discount" data-tpl-value="/discount"><?= $value->discount->getAmount(); ?>
<td data-tpl-text="/discountp" data-tpl-value="/discountp"><?= $this->getPercentage($value->discountPercentage->value / 10000 / 100); ?>
<td data-tpl-text="/bonus" data-tpl-value="/bonus"><?= $value->bonus->getAmount(); ?>
<td data-tpl-text="/item_start" data-tpl-value="/item_start"><?= $value->start?->format('Y-m-d'); ?>
<td data-tpl-text="/item_end" data-tpl-value="/item_end"><?= $value->end?->format('Y-m-d'); ?>
<?php endforeach; ?>
<?php if ($c === 0) : ?>
<tr>
<td colspan="22" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
@ -1263,7 +1274,7 @@ echo $this->data['nav']->render();
<?php
$attr = $this->data['defaultAttributeTypes']['sales_tax_code'] ?? null;
foreach ($attr?->defaults ?? [] as $value) : ?>
<option value="<?= $value->id ?>"><?= $this->printHtml($value->getValue()); ?>
<option value="<?= $value->id; ?>"><?= $this->printHtml($value->getValue()); ?>
<?php endforeach; ?>
</select>
</div>
@ -1275,7 +1286,7 @@ echo $this->data['nav']->render();
<?php
$attr = $this->data['defaultAttributeTypes']['purchase_tax_code'] ?? null;
foreach ($attr?->defaults ?? [] as $value) : ?>
<option value="<?= $value->id ?>"><?= $this->printHtml($value->getValue()); ?>
<option value="<?= $value->id; ?>"><?= $this->printHtml($value->getValue()); ?>
<?php endforeach; ?>
</select>
</div>
@ -1290,7 +1301,7 @@ echo $this->data['nav']->render();
->where('l11n/language', $this->response->header->l11n->language)
->execute();
foreach ($costcenters as $cc) : ?>
<option value="<?= $cc->id ?>"><?= $this->printHtml($cc->code . ' ' . $cc->getL11n()); ?>
<option value="<?= $cc->id; ?>"><?= $this->printHtml($cc->code . ' ' . $cc->getL11n()); ?>
<?php endforeach; ?>
</select>
</div>
@ -1305,7 +1316,7 @@ echo $this->data['nav']->render();
->where('l11n/language', $this->response->header->l11n->language)
->execute();
foreach ($costobjects as $co) : ?>
<option value="<?= $co->id ?>"><?= $this->printHtml($co->code . ' ' . $co->getL11n()); ?>
<option value="<?= $co->id; ?>"><?= $this->printHtml($co->code . ' ' . $co->getL11n()); ?>
<?php endforeach; ?>
</select>
</div>
@ -1360,7 +1371,7 @@ echo $this->data['nav']->render();
<?php
$attr = $this->data['defaultAttributeTypes']['has_inventory'] ?? null;
foreach ($attr?->defaults ?? [] as $value) : ?>
<option value="<?= $value->id ?>"><?= $this->printHtml($value->getValue()); ?>
<option value="<?= $value->id; ?>"><?= $this->printHtml($value->getValue()); ?>
<?php endforeach; ?>
</select>
</div>
@ -1371,7 +1382,7 @@ echo $this->data['nav']->render();
<?php
$attr = $this->data['defaultAttributeTypes']['inventory_identifier'] ?? null;
foreach ($attr?->defaults ?? [] as $value) : ?>
<option value="<?= $value->id ?>"><?= $this->printHtml($value->getValue()); ?>
<option value="<?= $value->id; ?>"><?= $this->printHtml($value->getValue()); ?>
<?php endforeach; ?>
</select>
</div>
@ -1382,7 +1393,7 @@ echo $this->data['nav']->render();
<?php
$attr = $this->data['defaultAttributeTypes']['stocktaking_type'] ?? null;
foreach ($attr?->defaults ?? [] as $value) : ?>
<option value="<?= $value->id ?>"><?= $this->printHtml($value->getValue()); ?>
<option value="<?= $value->id; ?>"><?= $this->printHtml($value->getValue()); ?>
<?php endforeach; ?>
</select>
</div>
@ -1425,17 +1436,23 @@ echo $this->data['nav']->render();
<?php
$allInvoices = SalesBillMapper::getItemBills($item->id, SmartDateTime::startOfYear($this->data['business_start']), new SmartDateTime('now'));
$count = 0;
/** @var \Modules\Billing\Models\Bill $invoice */
foreach ($allInvoices as $invoice) :
++$count;
$url = UriFactory::build('{/base}/sales/bill?{?}&id=' . $invoice->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $invoice->getNumber(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->type->getL11n(); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->billTo; ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales); ?></a>
<td><a href="<?= $url; ?>"><?= $this->getCurrency($invoice->netSales, symbol: ''); ?></a>
<td><a href="<?= $url; ?>"><?= $invoice->createdAt->format('Y-m-d'); ?></a>
<?php endforeach; ?>
<?php if ($count === 0) : ?>
<tr><td colspan="5" class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>
<?php endif; ?>
</table>
</div>
</section>
@ -1448,7 +1465,7 @@ echo $this->data['nav']->render();
<div class="row">
<div class="col-xs-12">
<div class="portlet">
<div class="portlet-head"><?= $this->getHtml('Audits', 'Auditor'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="portlet-head"><?= $this->getHtml('Logs', 'Auditor'); ?><i class="g-icon download btn end-xs">download</i></div>
<div class="slider">
<table class="default sticky">
<colgroup>
@ -1479,7 +1496,7 @@ echo $this->data['nav']->render();
$next = empty($audits) ? HttpHeader::getAllHeaders()['Referer'] ?? 'admin/module/settings?id={?id}#{\#}' : 'admin/module/settings?{?}&audit=' . \end($audits)->id . '&ptype=n#{\#}';
foreach ($audits as $key => $audit) : ++$count;
$url = UriFactory::build('{/base}/admin/audit/single?{?}&id=' . $audit->id); ?>
$url = UriFactory::build('{/base}/admin/audit/view?{?}&id=' . $audit->id); ?>
<tr tabindex="0" data-href="<?= $url; ?>">
<td><?= $audit->id; ?>
<td><?= $this->printHtml($audit->module); ?>

View File

@ -15,7 +15,7 @@ declare(strict_types=1);
use phpOMS\Uri\UriFactory;
/** @var \phpOMS\Localization\BaseStringL11nType */
$type = $this->data['type'];
$type = $this->data['type'];
/** @var \phpOMS\Views\View $this */
echo $this->data['nav']->render(); ?>

View File

@ -126,7 +126,7 @@ echo $this->data['nav']->render(); ?>
</label>
<tbody>
<?php $count = 0; foreach ($items as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/purchase/item/profile?{?}&id=' . $value->id);
$url = UriFactory::build('{/base}/purchase/item/view?{?}&id=' . $value->id);
$image = $value->getFileByType('backend_image');
?>
<tr data-href="<?= $url; ?>">

View File

@ -128,7 +128,7 @@ echo $this->data['nav']->render(); ?>
<tbody>
<?php $count = 0; foreach ($items as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/sales/item/profile?{?}&id=' . $value->id);
$url = UriFactory::build('{/base}/sales/item/view?{?}&id=' . $value->id);
$image = $value->getFileByTypeName('item_profile_image');
?>
<tr data-href="<?= $url; ?>">

View File

@ -20,8 +20,8 @@ use phpOMS\Uri\UriFactory;
/** @var \Modules\ItemManagement\Models\Item $item */
$item = $this->data['item'];
$itemL11n = $item->getL11ns();
$Attribute = $item->attributes;
$itemL11n = $item->getL11ns();
$Attribute = $item->attributes;
$notes = $item->notes;
$files = $item->files;
@ -143,9 +143,9 @@ echo $this->data['nav']->render();
<div class="portlet-body">
<table class="wf-100">
<tr><td><?= $this->getHtml('SalesPrice'); ?>:
<td><?= $item->salesPrice->getCurrency(); ?>
<td><?= $item->salesPrice->getAmount(); ?>
<tr><td><?= $this->getHtml('PurchasePrice'); ?>:
<td><?= $item->purchasePrice->getCurrency(); ?>
<td><?= $item->purchasePrice->getAmount(); ?>
<tr><td><?= $this->getHtml('Margin'); ?>:
<td><?= $item->salesPrice->getInt() === 0
? '0.00'
@ -170,7 +170,7 @@ echo $this->data['nav']->render();
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($notes as $note) :
$url = UriFactory::build('{/base}/editor/single?{?}&id=' . $note->id);
$url = UriFactory::build('{/base}/editor/view?{?}&id=' . $note->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($note->title); ?></a>
@ -193,7 +193,7 @@ echo $this->data['nav']->render();
<td><?= $this->getHtml('CreatedAt'); ?>
<tbody>
<?php foreach ($files as $file) :
$url = UriFactory::build('{/base}/media/single?{?}&id=' . $file->id);
$url = UriFactory::build('{/base}/media/view?{?}&id=' . $file->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($file->name); ?></a>
@ -228,8 +228,8 @@ echo $this->data['nav']->render();
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->getNumber()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->type->getL11n()); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/sales/client/profile?{?}&id=' . $invoice->client->id); ?>"><?= $this->printHtml($invoice->billTo); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->netSales->getCurrency()); ?></a>
<td><a class="content" href="<?= UriFactory::build('{/base}/sales/client/view?{?}&id=' . $invoice->client->id); ?>"><?= $this->printHtml($invoice->billTo); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->netSales->getAmount()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($invoice->createdAt->format('Y-m-d')); ?></a>
<?php endforeach; ?>
</table>
@ -251,12 +251,12 @@ echo $this->data['nav']->render();
<td><?= $this->getHtml('Net'); ?>
<tbody>
<?php $i = -1; foreach ($topCustomers as $client) : ++$i;
$url = UriFactory::build('{/base}/sales/client/profile?id=' . $client->id);
$url = UriFactory::build('{/base}/sales/client/view?id=' . $client->id);
?>
<tr data-href="<?= $url; ?>">
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->number); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->profile->account->name1); ?> <?= $this->printHtml($client->profile->account->name2); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->mainAddress->getCountry()); ?></a>
<td><a href="<?= $url; ?>"><?= $this->printHtml($client->mainAddress->country); ?></a>
<td><a href="<?= $url; ?>"><?= (new Money((int) $topCustomers[1][$i]['net_sales']))->getCurrency(); ?></a>
<?php endforeach; ?>
</table>

View File

@ -116,7 +116,7 @@ echo $this->data['nav']->render(); ?>
<tbody>
<?php $count = 0; foreach ($items as $key => $value) : ++$count;
$url = UriFactory::build('{/base}/item/profile?{?}&id=' . $value->id);
$url = UriFactory::build('{/base}/item/view?{?}&id=' . $value->id);
$image = $value->getFileByTypeName('item_profile_image');
?>
<tr data-href="<?= $url; ?>">

View File

@ -75,8 +75,8 @@ final class Autoloader
*/
public static function defaultAutoloader(string $class) : void
{
$class = \ltrim($class, '\\');
$class = \strtr($class, '_\\', '//');
$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/', 'MainRepository/Web/', $class);

View File

@ -1,4 +1,15 @@
<?php
/**
* Jingga
*
* PHP Version 8.1
*
* @package Modules\ItemManagement\tests
* @copyright Dennis Eichhorn
* @license OMS License 2.0
* @version 1.0.0
* @link https://jingga.app
*/
declare(strict_types=1);
\ini_set('memory_limit', '2048M');
@ -67,10 +78,10 @@ $GLOBALS['is_github'] = $IS_GITHUB;
$tmp = FileLogger::getInstance(__DIR__ . '/../Logs');
$CONFIG = [
'db' => [
'db' => [
'core' => [
'masters' => [
'admin' => [
'admin' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -80,7 +91,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'insert' => [
'insert' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -90,7 +101,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'select' => [
'select' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -100,7 +111,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'update' => [
'update' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -110,7 +121,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'delete' => [
'delete' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -120,7 +131,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'schema' => [
'schema' => [
'db' => 'mysql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '3306', /* db host port */
@ -132,7 +143,7 @@ $CONFIG = [
],
],
'postgresql' => [
'admin' => [
'admin' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -142,7 +153,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'insert' => [
'insert' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -152,7 +163,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'select' => [
'select' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -162,7 +173,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'update' => [
'update' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -172,7 +183,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'delete' => [
'delete' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -182,7 +193,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'schema' => [
'schema' => [
'db' => 'pgsql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '5432', /* db host port */
@ -194,37 +205,37 @@ $CONFIG = [
],
],
'sqlite' => [
'admin' => [
'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' => [
'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' => [
'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' => [
'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' => [
'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' => [
'schema' => [
'db' => 'sqlite', /* db type */
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
'weight' => 1000, /* db table prefix */
@ -232,7 +243,7 @@ $CONFIG = [
],
],
'mssql' => [
'admin' => [
'admin' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -242,7 +253,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'insert' => [
'insert' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -252,7 +263,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'select' => [
'select' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -262,7 +273,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'update' => [
'update' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -272,7 +283,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'delete' => [
'delete' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -282,7 +293,7 @@ $CONFIG = [
'weight' => 1000, /* db table prefix */
'datetimeformat' => 'Y-m-d H:i:s',
],
'schema' => [
'schema' => [
'db' => 'mssql', /* db type */
'host' => '127.0.0.1', /* db host address */
'port' => '1433', /* db host port */
@ -322,16 +333,16 @@ $CONFIG = [
'password' => '123456',
],
],
'log' => [
'log' => [
'file' => [
'path' => __DIR__ . '/Logs',
],
],
'page' => [
'page' => [
'root' => '/',
'https' => false,
],
'app' => [
'app' => [
'path' => __DIR__,
'default' => [
'app' => 'Backend',
@ -350,7 +361,7 @@ $CONFIG = [
],
],
],
'socket' => [
'socket' => [
'master' => [
'host' => '127.0.0.1',
'limit' => 300,
@ -360,7 +371,7 @@ $CONFIG = [
'language' => [
'en',
],
'apis' => [
'apis' => [
],
];

View File

@ -19,7 +19,6 @@ 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
{
@ -30,7 +29,7 @@ trait ApiControllerAttributeTrait
public function testApiItemAttributeTypeCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('name', 'test_attribute');
@ -48,7 +47,7 @@ trait ApiControllerAttributeTrait
public function testApiItemAttributeTypeL11nCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('title', 'DE:2');
@ -66,7 +65,7 @@ trait ApiControllerAttributeTrait
public function testApiItemAttributeValueIntCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('default', '1');
@ -86,7 +85,7 @@ trait ApiControllerAttributeTrait
public function testApiItemAttributeValueStrCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('type', '1');
@ -105,7 +104,7 @@ trait ApiControllerAttributeTrait
public function testApiItemAttributeValueFloatCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('type', '1');
@ -124,7 +123,7 @@ trait ApiControllerAttributeTrait
public function testApiItemAttributeValueDatCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('type', '1');
@ -143,7 +142,7 @@ trait ApiControllerAttributeTrait
public function testApiItemAttributeCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('ref', '1');
@ -161,7 +160,7 @@ trait ApiControllerAttributeTrait
public function testApiItemAttributeValueCreateInvalidData() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('invalid', '1');
@ -177,7 +176,7 @@ trait ApiControllerAttributeTrait
public function testApiItemAttributeTypeCreateInvalidData() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('invalid', '1');
@ -193,7 +192,7 @@ trait ApiControllerAttributeTrait
public function testApiItemAttributeTypeL11nCreateInvalidData() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('invalid', '1');
@ -209,7 +208,7 @@ trait ApiControllerAttributeTrait
public function testApiItemAttributeCreateInvalidData() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('invalid', '1');

View File

@ -18,7 +18,6 @@ use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\System\MimeType;
use phpOMS\Uri\HttpUri;
use phpOMS\Utils\TestUtils;
trait ApiControllerItemTrait
@ -41,7 +40,7 @@ trait ApiControllerItemTrait
public function testApiItemCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('number', '123456');
@ -58,7 +57,7 @@ trait ApiControllerItemTrait
public function testApiItemCreateInvalidData() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('invalid', '1');
@ -74,7 +73,7 @@ trait ApiControllerItemTrait
public function testApiItemProfileImageCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
\copy(__DIR__ . '/m_icon.png', __DIR__ . '/m_icon_tmp.png');
@ -105,7 +104,7 @@ trait ApiControllerItemTrait
public function testApiItemFileCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
\copy(__DIR__ . '/Test file.txt', __DIR__ . '/Test file_tmp.txt');
@ -135,7 +134,7 @@ trait ApiControllerItemTrait
public function testApiItemNoteCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
@ -156,7 +155,7 @@ trait ApiControllerItemTrait
public function testApiFileCreateInvalidData() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('invalid', '1');
@ -172,7 +171,7 @@ trait ApiControllerItemTrait
public function testApiNoteCreateInvalidData() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('invalid', '1');

View File

@ -18,7 +18,6 @@ use phpOMS\Localization\ISO639x1Enum;
use phpOMS\Message\Http\HttpRequest;
use phpOMS\Message\Http\HttpResponse;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Uri\HttpUri;
trait ApiControllerL11nTrait
{
@ -29,7 +28,7 @@ trait ApiControllerL11nTrait
public function testApiItemL11nTypeCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('title', 'TestItemL11nType');
@ -47,7 +46,7 @@ trait ApiControllerL11nTrait
public function testApiItemL11nCreate() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('item', '1');
@ -65,7 +64,7 @@ trait ApiControllerL11nTrait
public function testApiItemL11nTypeCreateInvalidData() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('invalid', '1');
@ -81,7 +80,7 @@ trait ApiControllerL11nTrait
public function testApiItemL11nCreateInvalidData() : void
{
$response = new HttpResponse();
$request = new HttpRequest(new HttpUri(''));
$request = new HttpRequest();
$request->header->account = 1;
$request->setData('invalid', '1');

View File

@ -58,13 +58,13 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
protected string $appName = 'Api';
};
$this->app->dbPool = $GLOBALS['dbpool'];
$this->app->unitId = 1;
$this->app->accountManager = new AccountManager($GLOBALS['session']);
$this->app->appSettings = new CoreSettings();
$this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/');
$this->app->dispatcher = new Dispatcher($this->app);
$this->app->eventManager = new EventManager($this->app->dispatcher);
$this->app->dbPool = $GLOBALS['dbpool'];
$this->app->unitId = 1;
$this->app->accountManager = new AccountManager($GLOBALS['session']);
$this->app->appSettings = new CoreSettings();
$this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/');
$this->app->dispatcher = new Dispatcher($this->app);
$this->app->eventManager = new EventManager($this->app->dispatcher);
$this->app->eventManager->importFromFile(__DIR__ . '/../../../../Web/Api/Hooks.php');
$this->app->sessionManager = new HttpSession(36000);
$this->app->l11nManager = new L11nManager();

View File

@ -44,24 +44,14 @@ final class ItemTest extends \PHPUnit\Framework\TestCase
self::assertEquals('', $this->item->number);
self::assertEquals(0, $this->item->successor);
self::assertEquals('', $this->item->info);
self::assertEquals(ItemStatus::ACTIVE, $this->item->getStatus());
self::assertEquals(ItemStatus::ACTIVE, $this->item->status);
self::assertEquals([], $this->item->files);
self::assertEquals([], $this->item->getAttributes());
self::assertEquals([], $this->item->attributes);
self::assertInstanceOf(BaseStringL11n::class, $this->item->getL11n(''));
self::assertInstanceOf('\phpOMS\Stdlib\Base\FloatInt', $this->item->salesPrice);
self::assertInstanceOf('\phpOMS\Stdlib\Base\FloatInt', $this->item->purchasePrice);
}
/**
* @covers Modules\ItemManagement\Models\Item
* @group module
*/
public function testStatusInputOutput() : void
{
$this->item->setStatus(ItemStatus::INACTIVE);
self::assertEquals(ItemStatus::INACTIVE, $this->item->getStatus());
}
/**
* @covers Modules\ItemManagement\Models\Item
* @group module
@ -69,7 +59,7 @@ final class ItemTest extends \PHPUnit\Framework\TestCase
public function testAttributeInputOutput() : void
{
$this->item->addAttribute(new Attribute());
self::assertCount(1, $this->item->getAttributes());
self::assertCount(1, $this->item->attributes);
}
/**
@ -88,17 +78,17 @@ final class ItemTest extends \PHPUnit\Framework\TestCase
*/
public function testSerialize() : void
{
$this->item->number = '123456';
$this->item->setStatus(ItemStatus::INACTIVE);
$this->item->info = 'Test info';
$this->item->number = '123456';
$this->item->status = ItemStatus::INACTIVE;
$this->item->info = 'Test info';
self::assertEquals(
[
'id' => 0,
'number' => '123456',
'status' => ItemStatus::INACTIVE,
'info' => 'Test info',
'l11n' => [],
'id' => 0,
'number' => '123456',
'status' => ItemStatus::INACTIVE,
'info' => 'Test info',
'l11n' => [],
],
$this->item->jsonSerialize()
);