mirror of
https://github.com/Karaka-Management/oms-EquipmentManagement.git
synced 2026-01-11 17:18:41 +00:00
auto fixes + some impl.
This commit is contained in:
parent
2b10e0c5a3
commit
53ffd0aa25
|
|
@ -278,6 +278,11 @@
|
||||||
"type": "TINYINT(1)",
|
"type": "TINYINT(1)",
|
||||||
"null": false
|
"null": false
|
||||||
},
|
},
|
||||||
|
"equipmgmt_attr_type_internal": {
|
||||||
|
"name": "equipmgmt_attr_type_internal",
|
||||||
|
"type": "TINYINT(1)",
|
||||||
|
"null": false
|
||||||
|
},
|
||||||
"equipmgmt_attr_type_required": {
|
"equipmgmt_attr_type_required": {
|
||||||
"description": "Every equipment must have this attribute type if set to true.",
|
"description": "Every equipment must have this attribute type if set to true.",
|
||||||
"name": "equipmgmt_attr_type_required",
|
"name": "equipmgmt_attr_type_required",
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ use phpOMS\Message\Http\HttpRequest;
|
||||||
use phpOMS\Message\Http\HttpResponse;
|
use phpOMS\Message\Http\HttpResponse;
|
||||||
use phpOMS\Module\InstallerAbstract;
|
use phpOMS\Module\InstallerAbstract;
|
||||||
use phpOMS\Module\ModuleInfo;
|
use phpOMS\Module\ModuleInfo;
|
||||||
use phpOMS\Uri\HttpUri;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Installer class.
|
* Installer class.
|
||||||
|
|
@ -100,7 +99,7 @@ final class Installer extends InstallerAbstract
|
||||||
/** @var array $type */
|
/** @var array $type */
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('name', $type['name'] ?? '');
|
$request->setData('name', $type['name'] ?? '');
|
||||||
|
|
@ -126,7 +125,7 @@ final class Installer extends InstallerAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('title', $l11n);
|
$request->setData('title', $l11n);
|
||||||
|
|
@ -161,7 +160,7 @@ final class Installer extends InstallerAbstract
|
||||||
/** @var array $type */
|
/** @var array $type */
|
||||||
foreach ($types as $type) {
|
foreach ($types as $type) {
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('name', $type['name'] ?? '');
|
$request->setData('name', $type['name'] ?? '');
|
||||||
|
|
@ -187,7 +186,7 @@ final class Installer extends InstallerAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('title', $l11n);
|
$request->setData('title', $l11n);
|
||||||
|
|
@ -222,12 +221,14 @@ final class Installer extends InstallerAbstract
|
||||||
/** @var array $attribute */
|
/** @var array $attribute */
|
||||||
foreach ($attributes as $attribute) {
|
foreach ($attributes as $attribute) {
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('name', $attribute['name'] ?? '');
|
$request->setData('name', $attribute['name'] ?? '');
|
||||||
$request->setData('title', \reset($attribute['l11n']));
|
$request->setData('title', \reset($attribute['l11n']));
|
||||||
$request->setData('language', \array_keys($attribute['l11n'])[0] ?? 'en');
|
$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('is_required', $attribute['is_required'] ?? false);
|
||||||
$request->setData('custom', $attribute['is_custom_allowed'] ?? false);
|
$request->setData('custom', $attribute['is_custom_allowed'] ?? false);
|
||||||
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
|
$request->setData('validation_pattern', $attribute['validation_pattern'] ?? '');
|
||||||
|
|
@ -252,7 +253,7 @@ final class Installer extends InstallerAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('title', $l11n);
|
$request->setData('title', $l11n);
|
||||||
|
|
@ -291,7 +292,7 @@ final class Installer extends InstallerAbstract
|
||||||
/** @var array $value */
|
/** @var array $value */
|
||||||
foreach ($attribute['values'] as $value) {
|
foreach ($attribute['values'] as $value) {
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('value', $value['value'] ?? '');
|
$request->setData('value', $value['value'] ?? '');
|
||||||
|
|
@ -325,7 +326,7 @@ final class Installer extends InstallerAbstract
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('title', $l11n);
|
$request->setData('title', $l11n);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType;
|
||||||
use phpOMS\Router\RouteVerb;
|
use phpOMS\Router\RouteVerb;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'^.*/equipment/find.*$' => [
|
'^.*/equipment/find(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\EquipmentManagement\Controller\ApiEquipmentController:apiEquipmentFind',
|
'dest' => '\Modules\EquipmentManagement\Controller\ApiEquipmentController:apiEquipmentFind',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -30,7 +30,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'^.*/equipment/attribute.*$' => [
|
'^.*/equipment/attribute(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\EquipmentManagement\Controller\ApiEquipmentAttributeController:apiEquipmentAttributeCreate',
|
'dest' => '\Modules\EquipmentManagement\Controller\ApiEquipmentAttributeController:apiEquipmentAttributeCreate',
|
||||||
'verb' => RouteVerb::PUT,
|
'verb' => RouteVerb::PUT,
|
||||||
|
|
@ -51,7 +51,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'^.*/equipment/note.*$' => [
|
'^.*/equipment/note(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\EquipmentManagement\Controller\ApiEquipmentController:apiNoteCreate',
|
'dest' => '\Modules\EquipmentManagement\Controller\ApiEquipmentController:apiNoteCreate',
|
||||||
'verb' => RouteVerb::PUT,
|
'verb' => RouteVerb::PUT,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use phpOMS\Account\PermissionType;
|
||||||
use phpOMS\Router\RouteVerb;
|
use phpOMS\Router\RouteVerb;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'^.*/equipment/attribute/type/list.*$' => [
|
'^.*/equipment/attribute/type/list(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementAttributeTypeList',
|
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementAttributeTypeList',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -29,7 +29,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^.*/equipment/attribute/type\?.*$' => [
|
'^.*/equipment/attribute/type(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementAttributeType',
|
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementAttributeType',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -41,7 +41,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'^.*/equipment/list.*$' => [
|
'^.*/equipment/list(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentList',
|
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentList',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -52,7 +52,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^.*/equipment/create.*$' => [
|
'^.*/equipment/create(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentCreate',
|
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentCreate',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -63,9 +63,9 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^.*/equipment/profile.*$' => [
|
'^.*/equipment/view(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentProfile',
|
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentView',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
|
|
@ -75,7 +75,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'^.*/equipment/inspection/list.*$' => [
|
'^.*/equipment/inspection/list(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentList',
|
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentList',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -86,7 +86,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^.*/equipment/inspection/create.*$' => [
|
'^.*/equipment/inspection/create(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentCreate',
|
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentCreate',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -97,9 +97,9 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^.*/equipment/inspection/profile.*$' => [
|
'^.*/equipment/inspection/view(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentProfile',
|
'dest' => '\Modules\EquipmentManagement\Controller\BackendController:viewEquipmentManagementEquipmentView',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
'permission' => [
|
'permission' => [
|
||||||
'module' => BackendController::NAME,
|
'module' => BackendController::NAME,
|
||||||
|
|
|
||||||
|
|
@ -61,12 +61,15 @@ final class ApiEquipmentAttributeController extends Controller
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = EquipmentAttributeTypeMapper::get()->with('defaults')->where('id', (int) $request->getData('type'))->execute();
|
$type = EquipmentAttributeTypeMapper::get()
|
||||||
|
->with('defaults')
|
||||||
|
->where('id', (int) $request->getData('type'))
|
||||||
|
->execute();
|
||||||
|
|
||||||
if (!$type->repeatable) {
|
if (!$type->repeatable) {
|
||||||
$attr = EquipmentAttributeMapper::count()
|
$attr = EquipmentAttributeMapper::count()
|
||||||
->with('type')
|
->with('type')
|
||||||
->where('type/id', (int) $request->getData('type'))
|
->where('type/id', $type->id)
|
||||||
->where('ref', (int) $request->getData('ref'))
|
->where('ref', (int) $request->getData('ref'))
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
|
@ -164,13 +167,20 @@ final class ApiEquipmentAttributeController extends Controller
|
||||||
->where('id', $request->getDataInt('type') ?? 0)
|
->where('id', $request->getDataInt('type') ?? 0)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
|
if ($type->isInternal) {
|
||||||
|
$response->header->status = RequestStatusCode::R_403;
|
||||||
|
$this->createInvalidCreateResponse($request, $response, $val);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$attrValue = $this->createAttributeValueFromRequest($request, $type);
|
$attrValue = $this->createAttributeValueFromRequest($request, $type);
|
||||||
$this->createModel($request->header->account, $attrValue, EquipmentAttributeValueMapper::class, 'attr_value', $request->getOrigin());
|
$this->createModel($request->header->account, $attrValue, EquipmentAttributeValueMapper::class, 'attr_value', $request->getOrigin());
|
||||||
|
|
||||||
if ($attrValue->isDefault) {
|
if ($attrValue->isDefault) {
|
||||||
$this->createModelRelation(
|
$this->createModelRelation(
|
||||||
$request->header->account,
|
$request->header->account,
|
||||||
(int) $request->getData('type'),
|
$type->id,
|
||||||
$attrValue->id,
|
$attrValue->id,
|
||||||
EquipmentAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
|
EquipmentAttributeTypeMapper::class, 'defaults', '', $request->getOrigin()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ final class ApiEquipmentController extends Controller
|
||||||
$equipment->name = $request->getDataString('name') ?? '';
|
$equipment->name = $request->getDataString('name') ?? '';
|
||||||
$equipment->info = $request->getDataString('info') ?? '';
|
$equipment->info = $request->getDataString('info') ?? '';
|
||||||
$equipment->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0));
|
$equipment->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0));
|
||||||
$equipment->status = $request->getDataInt('status') ?? EquipmentStatus::INACTIVE;
|
$equipment->status = EquipmentStatus::tryFromValue($request->getDataInt('status')) ?? EquipmentStatus::INACTIVE;
|
||||||
$equipment->unit = $request->getDataInt('unit') ?? $this->app->unitId;
|
$equipment->unit = $request->getDataInt('unit') ?? $this->app->unitId;
|
||||||
|
|
||||||
return $equipment;
|
return $equipment;
|
||||||
|
|
@ -500,7 +500,7 @@ final class ApiEquipmentController extends Controller
|
||||||
$new->name = $request->getDataString('name') ?? $new->name;
|
$new->name = $request->getDataString('name') ?? $new->name;
|
||||||
$new->info = $request->getDataString('info') ?? $new->info;
|
$new->info = $request->getDataString('info') ?? $new->info;
|
||||||
$new->type = $request->hasData('type') ? new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0)) : $new->type;
|
$new->type = $request->hasData('type') ? new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0)) : $new->type;
|
||||||
$new->status = $request->getDataInt('status') ?? $new->status;
|
$new->status = EquipmentStatus::tryFromValue($request->getDataInt('status')) ?? $new->status;
|
||||||
$new->unit = $request->getDataInt('unit') ?? $this->app->unitId;
|
$new->unit = $request->getDataInt('unit') ?? $this->app->unitId;
|
||||||
|
|
||||||
return $new;
|
return $new;
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,10 @@ final class ApiEquipmentTypeController extends Controller
|
||||||
private function createEquipmentTypeFromRequest(RequestAbstract $request) : BaseStringL11nType
|
private function createEquipmentTypeFromRequest(RequestAbstract $request) : BaseStringL11nType
|
||||||
{
|
{
|
||||||
$equipmentType = new BaseStringL11nType();
|
$equipmentType = new BaseStringL11nType();
|
||||||
$equipmentType->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN);
|
$equipmentType->setL11n(
|
||||||
|
$request->getDataString('title') ?? '',
|
||||||
|
ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN
|
||||||
|
);
|
||||||
$equipmentType->title = $request->getDataString('name') ?? '';
|
$equipmentType->title = $request->getDataString('name') ?? '';
|
||||||
|
|
||||||
return $equipmentType;
|
return $equipmentType;
|
||||||
|
|
@ -137,12 +140,10 @@ final class ApiEquipmentTypeController extends Controller
|
||||||
*/
|
*/
|
||||||
private function createEquipmentTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
private function createEquipmentTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
||||||
{
|
{
|
||||||
$equipmentTypeL11n = new BaseStringL11n();
|
$equipmentTypeL11n = new BaseStringL11n();
|
||||||
$equipmentTypeL11n->ref = $request->getDataInt('type') ?? 0;
|
$equipmentTypeL11n->ref = $request->getDataInt('type') ?? 0;
|
||||||
$equipmentTypeL11n->setLanguage(
|
$equipmentTypeL11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
|
||||||
$request->getDataString('language') ?? $request->header->l11n->language
|
$equipmentTypeL11n->content = $request->getDataString('title') ?? '';
|
||||||
);
|
|
||||||
$equipmentTypeL11n->content = $request->getDataString('title') ?? '';
|
|
||||||
|
|
||||||
return $equipmentTypeL11n;
|
return $equipmentTypeL11n;
|
||||||
}
|
}
|
||||||
|
|
@ -327,10 +328,8 @@ final class ApiEquipmentTypeController extends Controller
|
||||||
*/
|
*/
|
||||||
public function updateEquipmentTypeL11nFromRequest(RequestAbstract $request, BaseStringL11n $new) : BaseStringL11n
|
public function updateEquipmentTypeL11nFromRequest(RequestAbstract $request, BaseStringL11n $new) : BaseStringL11n
|
||||||
{
|
{
|
||||||
$new->setLanguage(
|
$new->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $new->language;
|
||||||
$request->getDataString('language') ?? $new->language
|
$new->content = $request->getDataString('title') ?? $new->content;
|
||||||
);
|
|
||||||
$new->content = $request->getDataString('title') ?? $new->content;
|
|
||||||
|
|
||||||
return $new;
|
return $new;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ final class ApiInspectionTypeController extends Controller
|
||||||
$inspection = new Inspection();
|
$inspection = new Inspection();
|
||||||
$inspection->reference = (int) $request->getData('ref');
|
$inspection->reference = (int) $request->getData('ref');
|
||||||
$inspection->description = $request->getDataString('description') ?? '';
|
$inspection->description = $request->getDataString('description') ?? '';
|
||||||
$inspection->status = $request->getDataInt('status') ?? InspectionStatus::TODO;
|
$inspection->status = InspectionStatus::tryFromValue($request->getDataInt('status')) ?? InspectionStatus::TODO;
|
||||||
$inspection->next = $request->getDataDateTime('next') ?? null;
|
$inspection->next = $request->getDataDateTime('next') ?? null;
|
||||||
$inspection->date = $request->getDataDateTime('date') ?? null;
|
$inspection->date = $request->getDataDateTime('date') ?? null;
|
||||||
$inspection->interval = $request->getDataInt('interval') ?? 0;
|
$inspection->interval = $request->getDataInt('interval') ?? 0;
|
||||||
|
|
@ -147,7 +147,10 @@ final class ApiInspectionTypeController extends Controller
|
||||||
private function createInspectionTypeFromRequest(RequestAbstract $request) : BaseStringL11nType
|
private function createInspectionTypeFromRequest(RequestAbstract $request) : BaseStringL11nType
|
||||||
{
|
{
|
||||||
$equipmentType = new BaseStringL11nType();
|
$equipmentType = new BaseStringL11nType();
|
||||||
$equipmentType->setL11n($request->getDataString('title') ?? '', $request->getDataString('language') ?? ISO639x1Enum::_EN);
|
$equipmentType->setL11n(
|
||||||
|
$request->getDataString('title') ?? '',
|
||||||
|
ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? ISO639x1Enum::_EN
|
||||||
|
);
|
||||||
$equipmentType->title = $request->getDataString('name') ?? '';
|
$equipmentType->title = $request->getDataString('name') ?? '';
|
||||||
|
|
||||||
return $equipmentType;
|
return $equipmentType;
|
||||||
|
|
@ -211,12 +214,10 @@ final class ApiInspectionTypeController extends Controller
|
||||||
*/
|
*/
|
||||||
private function createInspectionTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
private function createInspectionTypeL11nFromRequest(RequestAbstract $request) : BaseStringL11n
|
||||||
{
|
{
|
||||||
$equipmentTypeL11n = new BaseStringL11n();
|
$equipmentTypeL11n = new BaseStringL11n();
|
||||||
$equipmentTypeL11n->ref = $request->getDataInt('type') ?? 0;
|
$equipmentTypeL11n->ref = $request->getDataInt('type') ?? 0;
|
||||||
$equipmentTypeL11n->setLanguage(
|
$equipmentTypeL11n->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $request->header->l11n->language;
|
||||||
$request->getDataString('language') ?? $request->header->l11n->language
|
$equipmentTypeL11n->content = $request->getDataString('title') ?? '';
|
||||||
);
|
|
||||||
$equipmentTypeL11n->content = $request->getDataString('title') ?? '';
|
|
||||||
|
|
||||||
return $equipmentTypeL11n;
|
return $equipmentTypeL11n;
|
||||||
}
|
}
|
||||||
|
|
@ -401,10 +402,8 @@ final class ApiInspectionTypeController extends Controller
|
||||||
*/
|
*/
|
||||||
public function updateInspectionTypeL11nFromRequest(RequestAbstract $request, BaseStringL11n $new) : BaseStringL11n
|
public function updateInspectionTypeL11nFromRequest(RequestAbstract $request, BaseStringL11n $new) : BaseStringL11n
|
||||||
{
|
{
|
||||||
$new->setLanguage(
|
$new->language = ISO639x1Enum::tryFromValue($request->getDataString('language')) ?? $new->language;
|
||||||
$request->getDataString('language') ?? $new->language
|
$new->content = $request->getDataString('title') ?? $new->content;
|
||||||
);
|
|
||||||
$new->content = $request->getDataString('title') ?? $new->content;
|
|
||||||
|
|
||||||
return $new;
|
return $new;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\EquipmentManagement\Controller;
|
namespace Modules\EquipmentManagement\Controller;
|
||||||
|
|
||||||
use Modules\Admin\Models\LocalizationMapper;
|
|
||||||
use Modules\Admin\Models\SettingsEnum;
|
|
||||||
use Modules\EquipmentManagement\Models\Attribute\EquipmentAttributeTypeL11nMapper;
|
use Modules\EquipmentManagement\Models\Attribute\EquipmentAttributeTypeL11nMapper;
|
||||||
use Modules\EquipmentManagement\Models\Attribute\EquipmentAttributeTypeMapper;
|
use Modules\EquipmentManagement\Models\Attribute\EquipmentAttributeTypeMapper;
|
||||||
use Modules\EquipmentManagement\Models\EquipmentMapper;
|
use Modules\EquipmentManagement\Models\EquipmentMapper;
|
||||||
|
|
@ -152,14 +150,11 @@ final class BackendController extends Controller
|
||||||
{
|
{
|
||||||
$view = new View($this->app->l11nManager, $request, $response);
|
$view = new View($this->app->l11nManager, $request, $response);
|
||||||
|
|
||||||
$view->setTemplate('/Modules/EquipmentManagement/Theme/Backend/equipment-profile');
|
$view->setTemplate('/Modules/EquipmentManagement/Theme/Backend/equipment-view');
|
||||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008402001, $request, $response);
|
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008402001, $request, $response);
|
||||||
|
|
||||||
/** @var \Model\Setting $settings */
|
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
|
||||||
$settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_LOCALIZATION);
|
$view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
|
||||||
|
|
||||||
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
|
|
||||||
$view->data['attributeView']->data['default_localization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
|
|
||||||
|
|
||||||
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
|
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
|
||||||
$view->data['equipment-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
|
$view->data['equipment-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
|
||||||
|
|
@ -179,11 +174,11 @@ final class BackendController extends Controller
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @codeCoverageIgnore
|
* @codeCoverageIgnore
|
||||||
*/
|
*/
|
||||||
public function viewEquipmentManagementEquipmentProfile(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
public function viewEquipmentManagementEquipmentView(RequestAbstract $request, ResponseAbstract $response, array $data = []) : RenderableInterface
|
||||||
{
|
{
|
||||||
$view = new View($this->app->l11nManager, $request, $response);
|
$view = new View($this->app->l11nManager, $request, $response);
|
||||||
|
|
||||||
$view->setTemplate('/Modules/EquipmentManagement/Theme/Backend/equipment-profile');
|
$view->setTemplate('/Modules/EquipmentManagement/Theme/Backend/equipment-view');
|
||||||
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008402001, $request, $response);
|
$view->data['nav'] = $this->app->moduleManager->get('Navigation')->createNavigationMid(1008402001, $request, $response);
|
||||||
|
|
||||||
// @todo This langauge filtering doesn't work. But it was working with the old mappers. Maybe there is a bug in the where() definition. Need to inspect the actual query.
|
// @todo This langauge filtering doesn't work. But it was working with the old mappers. Maybe there is a bug in the where() definition. Need to inspect the actual query.
|
||||||
|
|
@ -192,6 +187,7 @@ final class BackendController extends Controller
|
||||||
->with('attributes/type')
|
->with('attributes/type')
|
||||||
->with('attributes/value')
|
->with('attributes/value')
|
||||||
->with('attributes/type/l11n')
|
->with('attributes/type/l11n')
|
||||||
|
//->with('attributes/value/l11n')
|
||||||
->with('files')
|
->with('files')
|
||||||
->with('files/types')
|
->with('files/types')
|
||||||
->with('type')
|
->with('type')
|
||||||
|
|
@ -202,6 +198,7 @@ final class BackendController extends Controller
|
||||||
->where('type/l11n/language', $response->header->l11n->language)
|
->where('type/l11n/language', $response->header->l11n->language)
|
||||||
->where('fuelType/l11n/language', $response->header->l11n->language)
|
->where('fuelType/l11n/language', $response->header->l11n->language)
|
||||||
->where('attributes/type/l11n/language', $response->header->l11n->language)
|
->where('attributes/type/l11n/language', $response->header->l11n->language)
|
||||||
|
//->where('attributes/value/l11n/language', $response->header->l11n->language)
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$view->data['equipment'] = $equipment;
|
$view->data['equipment'] = $equipment;
|
||||||
|
|
@ -249,11 +246,8 @@ final class BackendController extends Controller
|
||||||
|
|
||||||
$view->data['units'] = $units;
|
$view->data['units'] = $units;
|
||||||
|
|
||||||
/** @var \Model\Setting $settings */
|
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
|
||||||
$settings = $this->app->appSettings->get(null, SettingsEnum::DEFAULT_LOCALIZATION);
|
$view->data['attributeView']->data['default_localization'] = $this->app->l11nServer;
|
||||||
|
|
||||||
$view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response);
|
|
||||||
$view->data['attributeView']->data['default_localization'] = LocalizationMapper::get()->where('id', (int) $settings->id)->execute();
|
|
||||||
|
|
||||||
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
|
$view->data['media-upload'] = new \Modules\Media\Theme\Backend\Components\Upload\BaseView($this->app->l11nManager, $request, $response);
|
||||||
$view->data['equipment-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
|
$view->data['equipment-notes'] = new \Modules\Editor\Theme\Backend\Components\Compound\BaseView($this->app->l11nManager, $request, $response);
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,10 @@ final class EquipmentAttributeMapper extends DataMapperFactory
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const COLUMNS = [
|
public const COLUMNS = [
|
||||||
'equipmgmt_equipment_attr_id' => ['name' => 'equipmgmt_equipment_attr_id', 'type' => 'int', 'internal' => 'id'],
|
'equipmgmt_equipment_attr_id' => ['name' => 'equipmgmt_equipment_attr_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'equipmgmt_equipment_attr_equipment' => ['name' => 'equipmgmt_equipment_attr_equipment', 'type' => 'int', 'internal' => 'ref'],
|
'equipmgmt_equipment_attr_equipment' => ['name' => 'equipmgmt_equipment_attr_equipment', 'type' => 'int', 'internal' => 'ref'],
|
||||||
'equipmgmt_equipment_attr_type' => ['name' => 'equipmgmt_equipment_attr_type', 'type' => 'int', 'internal' => 'type'],
|
'equipmgmt_equipment_attr_type' => ['name' => 'equipmgmt_equipment_attr_type', 'type' => 'int', 'internal' => 'type'],
|
||||||
'equipmgmt_equipment_attr_value' => ['name' => 'equipmgmt_equipment_attr_value', 'type' => 'int', 'internal' => 'value'],
|
'equipmgmt_equipment_attr_value' => ['name' => 'equipmgmt_equipment_attr_value', 'type' => 'int', 'internal' => 'value'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,8 @@ final class EquipmentAttributeTypeMapper extends DataMapperFactory
|
||||||
'equipmgmt_attr_type_datatype' => ['name' => 'equipmgmt_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
|
'equipmgmt_attr_type_datatype' => ['name' => 'equipmgmt_attr_type_datatype', 'type' => 'int', 'internal' => 'datatype'],
|
||||||
'equipmgmt_attr_type_fields' => ['name' => 'equipmgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
|
'equipmgmt_attr_type_fields' => ['name' => 'equipmgmt_attr_type_fields', 'type' => 'int', 'internal' => 'fields'],
|
||||||
'equipmgmt_attr_type_custom' => ['name' => 'equipmgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
|
'equipmgmt_attr_type_custom' => ['name' => 'equipmgmt_attr_type_custom', 'type' => 'bool', 'internal' => 'custom'],
|
||||||
'equipmgmt_attr_type_repeatable' => ['name' => 'equipmgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
|
'equipmgmt_attr_type_repeatable' => ['name' => 'equipmgmt_attr_type_repeatable', 'type' => 'bool', 'internal' => 'repeatable'],
|
||||||
|
'equipmgmt_attr_type_internal' => ['name' => 'equipmgmt_attr_type_internal', 'type' => 'bool', 'internal' => 'isInternal'],
|
||||||
'equipmgmt_attr_type_pattern' => ['name' => 'equipmgmt_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
|
'equipmgmt_attr_type_pattern' => ['name' => 'equipmgmt_attr_type_pattern', 'type' => 'string', 'internal' => 'validationPattern'],
|
||||||
'equipmgmt_attr_type_required' => ['name' => 'equipmgmt_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
|
'equipmgmt_attr_type_required' => ['name' => 'equipmgmt_attr_type_required', 'type' => 'bool', 'internal' => 'isRequired'],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,10 @@ final class EquipmentAttributeValueL11nMapper extends DataMapperFactory
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const COLUMNS = [
|
public const COLUMNS = [
|
||||||
'equipmgmt_attr_value_l11n_id' => ['name' => 'equipmgmt_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
'equipmgmt_attr_value_l11n_id' => ['name' => 'equipmgmt_attr_value_l11n_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'equipmgmt_attr_value_l11n_title' => ['name' => 'equipmgmt_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
'equipmgmt_attr_value_l11n_title' => ['name' => 'equipmgmt_attr_value_l11n_title', 'type' => 'string', 'internal' => 'content', 'autocomplete' => true],
|
||||||
'equipmgmt_attr_value_l11n_value' => ['name' => 'equipmgmt_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
|
'equipmgmt_attr_value_l11n_value' => ['name' => 'equipmgmt_attr_value_l11n_value', 'type' => 'int', 'internal' => 'ref'],
|
||||||
'equipmgmt_attr_value_l11n_lang' => ['name' => 'equipmgmt_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
'equipmgmt_attr_value_l11n_lang' => ['name' => 'equipmgmt_attr_value_l11n_lang', 'type' => 'string', 'internal' => 'language'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -37,15 +37,15 @@ final class EquipmentAttributeValueMapper extends DataMapperFactory
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const COLUMNS = [
|
public const COLUMNS = [
|
||||||
'equipmgmt_attr_value_id' => ['name' => 'equipmgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
|
'equipmgmt_attr_value_id' => ['name' => 'equipmgmt_attr_value_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'equipmgmt_attr_value_default' => ['name' => 'equipmgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
|
'equipmgmt_attr_value_default' => ['name' => 'equipmgmt_attr_value_default', 'type' => 'bool', 'internal' => 'isDefault'],
|
||||||
'equipmgmt_attr_value_valueStr' => ['name' => 'equipmgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
|
'equipmgmt_attr_value_valueStr' => ['name' => 'equipmgmt_attr_value_valueStr', 'type' => 'string', 'internal' => 'valueStr'],
|
||||||
'equipmgmt_attr_value_valueInt' => ['name' => 'equipmgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
|
'equipmgmt_attr_value_valueInt' => ['name' => 'equipmgmt_attr_value_valueInt', 'type' => 'int', 'internal' => 'valueInt'],
|
||||||
'equipmgmt_attr_value_valueDec' => ['name' => 'equipmgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
|
'equipmgmt_attr_value_valueDec' => ['name' => 'equipmgmt_attr_value_valueDec', 'type' => 'float', 'internal' => 'valueDec'],
|
||||||
'equipmgmt_attr_value_valueDat' => ['name' => 'equipmgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
|
'equipmgmt_attr_value_valueDat' => ['name' => 'equipmgmt_attr_value_valueDat', 'type' => 'DateTime', 'internal' => 'valueDat'],
|
||||||
'equipmgmt_attr_value_unit' => ['name' => 'equipmgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
|
'equipmgmt_attr_value_unit' => ['name' => 'equipmgmt_attr_value_unit', 'type' => 'string', 'internal' => 'unit'],
|
||||||
'equipmgmt_attr_value_deptype' => ['name' => 'equipmgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
|
'equipmgmt_attr_value_deptype' => ['name' => 'equipmgmt_attr_value_deptype', 'type' => 'int', 'internal' => 'dependingAttributeType'],
|
||||||
'equipmgmt_attr_value_depvalue' => ['name' => 'equipmgmt_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
|
'equipmgmt_attr_value_depvalue' => ['name' => 'equipmgmt_attr_value_depvalue', 'type' => 'int', 'internal' => 'dependingAttributeValue'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class Cost implements \JsonSerializable
|
||||||
public function toArray() : array
|
public function toArray() : array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ class CostType implements \JsonSerializable
|
||||||
public function toArray() : array
|
public function toArray() : array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class Equipment implements \JsonSerializable
|
||||||
public function toArray() : array
|
public function toArray() : array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,14 @@ final class EquipmentMapper extends DataMapperFactory
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const COLUMNS = [
|
public const COLUMNS = [
|
||||||
'equipmgmt_equipment_id' => ['name' => 'equipmgmt_equipment_id', 'type' => 'int', 'internal' => 'id'],
|
'equipmgmt_equipment_id' => ['name' => 'equipmgmt_equipment_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'equipmgmt_equipment_name' => ['name' => 'equipmgmt_equipment_name', 'type' => 'string', 'internal' => 'name'],
|
'equipmgmt_equipment_name' => ['name' => 'equipmgmt_equipment_name', 'type' => 'string', 'internal' => 'name'],
|
||||||
'equipmgmt_equipment_status' => ['name' => 'equipmgmt_equipment_status', 'type' => 'int', 'internal' => 'status'],
|
'equipmgmt_equipment_status' => ['name' => 'equipmgmt_equipment_status', 'type' => 'int', 'internal' => 'status'],
|
||||||
'equipmgmt_equipment_info' => ['name' => 'equipmgmt_equipment_info', 'type' => 'string', 'internal' => 'info'],
|
'equipmgmt_equipment_info' => ['name' => 'equipmgmt_equipment_info', 'type' => 'string', 'internal' => 'info'],
|
||||||
'equipmgmt_equipment_unit' => ['name' => 'equipmgmt_equipment_unit', 'type' => 'int', 'internal' => 'unit'],
|
'equipmgmt_equipment_unit' => ['name' => 'equipmgmt_equipment_unit', 'type' => 'int', 'internal' => 'unit'],
|
||||||
'equipmgmt_equipment_type' => ['name' => 'equipmgmt_equipment_type', 'type' => 'int', 'internal' => 'type'],
|
'equipmgmt_equipment_type' => ['name' => 'equipmgmt_equipment_type', 'type' => 'int', 'internal' => 'type'],
|
||||||
'equipmgmt_equipment_responsible' => ['name' => 'equipmgmt_equipment_responsible', 'type' => 'int', 'internal' => 'responsible'],
|
'equipmgmt_equipment_responsible' => ['name' => 'equipmgmt_equipment_responsible', 'type' => 'int', 'internal' => 'responsible'],
|
||||||
'equipmgmt_equipment_created_at' => ['name' => 'equipmgmt_equipment_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
'equipmgmt_equipment_created_at' => ['name' => 'equipmgmt_equipment_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -56,7 +56,7 @@ final class EquipmentMapper extends DataMapperFactory
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const HAS_MANY = [
|
public const HAS_MANY = [
|
||||||
'files' => [
|
'files' => [
|
||||||
'mapper' => MediaMapper::class,
|
'mapper' => MediaMapper::class,
|
||||||
'table' => 'equipmgmt_equipment_media',
|
'table' => 'equipmgmt_equipment_media',
|
||||||
'external' => 'equipmgmt_equipment_media_media',
|
'external' => 'equipmgmt_equipment_media_media',
|
||||||
|
|
@ -84,8 +84,8 @@ final class EquipmentMapper extends DataMapperFactory
|
||||||
*/
|
*/
|
||||||
public const OWNS_ONE = [
|
public const OWNS_ONE = [
|
||||||
'type' => [
|
'type' => [
|
||||||
'mapper' => EquipmentTypeMapper::class,
|
'mapper' => EquipmentTypeMapper::class,
|
||||||
'external' => 'equipmgmt_equipment_type',
|
'external' => 'equipmgmt_equipment_type',
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
use phpOMS\Localization\BaseStringL11n;
|
use phpOMS\Localization\BaseStringL11n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mapper class.
|
* Equipment type l11n mapper class.
|
||||||
*
|
*
|
||||||
* @package Modules\EquipmentManagement\Models
|
* @package Modules\EquipmentManagement\Models
|
||||||
* @license OMS License 2.0
|
* @license OMS License 2.0
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,8 @@ final class EquipmentTypeMapper extends DataMapperFactory
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const COLUMNS = [
|
public const COLUMNS = [
|
||||||
'equipmgmt_equipment_type_id' => ['name' => 'equipmgmt_equipment_type_id', 'type' => 'int', 'internal' => 'id'],
|
'equipmgmt_equipment_type_id' => ['name' => 'equipmgmt_equipment_type_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'equipmgmt_equipment_type_name' => ['name' => 'equipmgmt_equipment_type_name', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
|
'equipmgmt_equipment_type_name' => ['name' => 'equipmgmt_equipment_type_name', 'type' => 'string', 'internal' => 'title', 'autocomplete' => true],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ class Inspection implements \JsonSerializable
|
||||||
public function toArray() : array
|
public function toArray() : array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ namespace Modules\EquipmentManagement\Models;
|
||||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mapper class.
|
* Inspection mapper class.
|
||||||
*
|
*
|
||||||
* @package Modules\EquipmentManagement\Models
|
* @package Modules\EquipmentManagement\Models
|
||||||
* @license OMS License 2.0
|
* @license OMS License 2.0
|
||||||
|
|
@ -36,14 +36,14 @@ final class InspectionMapper extends DataMapperFactory
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public const COLUMNS = [
|
public const COLUMNS = [
|
||||||
'equipmgmt_equipment_inspection_id' => ['name' => 'equipmgmt_equipment_inspection_id', 'type' => 'int', 'internal' => 'id'],
|
'equipmgmt_equipment_inspection_id' => ['name' => 'equipmgmt_equipment_inspection_id', 'type' => 'int', 'internal' => 'id'],
|
||||||
'equipmgmt_equipment_inspection_equipment' => ['name' => 'equipmgmt_equipment_inspection_equipment', 'type' => 'int', 'internal' => 'reference'],
|
'equipmgmt_equipment_inspection_equipment' => ['name' => 'equipmgmt_equipment_inspection_equipment', 'type' => 'int', 'internal' => 'reference'],
|
||||||
'equipmgmt_equipment_inspection_description' => ['name' => 'equipmgmt_equipment_inspection_description', 'type' => 'string', 'internal' => 'description'],
|
'equipmgmt_equipment_inspection_description' => ['name' => 'equipmgmt_equipment_inspection_description', 'type' => 'string', 'internal' => 'description'],
|
||||||
'equipmgmt_equipment_inspection_status' => ['name' => 'equipmgmt_equipment_inspection_status', 'type' => 'int', 'internal' => 'status'],
|
'equipmgmt_equipment_inspection_status' => ['name' => 'equipmgmt_equipment_inspection_status', 'type' => 'int', 'internal' => 'status'],
|
||||||
'equipmgmt_equipment_inspection_interval' => ['name' => 'equipmgmt_equipment_inspection_interval', 'type' => 'int', 'internal' => 'interval'],
|
'equipmgmt_equipment_inspection_interval' => ['name' => 'equipmgmt_equipment_inspection_interval', 'type' => 'int', 'internal' => 'interval'],
|
||||||
'equipmgmt_equipment_inspection_next' => ['name' => 'equipmgmt_equipment_inspection_next', 'type' => 'DateTime', 'internal' => 'next'],
|
'equipmgmt_equipment_inspection_next' => ['name' => 'equipmgmt_equipment_inspection_next', 'type' => 'DateTime', 'internal' => 'next'],
|
||||||
'equipmgmt_equipment_inspection_date' => ['name' => 'equipmgmt_equipment_inspection_date', 'type' => 'DateTime', 'internal' => 'date'],
|
'equipmgmt_equipment_inspection_date' => ['name' => 'equipmgmt_equipment_inspection_date', 'type' => 'DateTime', 'internal' => 'date'],
|
||||||
'equipmgmt_equipment_inspection_type' => ['name' => 'equipmgmt_equipment_inspection_type', 'type' => 'int', 'internal' => 'type'],
|
'equipmgmt_equipment_inspection_type' => ['name' => 'equipmgmt_equipment_inspection_type', 'type' => 'int', 'internal' => 'type'],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||||
use phpOMS\Localization\BaseStringL11n;
|
use phpOMS\Localization\BaseStringL11n;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mapper class.
|
* Inspection type l11n mapper class.
|
||||||
*
|
*
|
||||||
* @package Modules\EquipmentManagement\Models
|
* @package Modules\EquipmentManagement\Models
|
||||||
* @license OMS License 2.0
|
* @license OMS License 2.0
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="#"><i class="g-icon">close</i></a>
|
<td><a href="#"><i class="g-icon">close</i></a>
|
||||||
<td><a href="#"><i class="g-icon">settings</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; ?>
|
<td><?= $value->content; ?>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php if ($c === 0) : ?>
|
<?php if ($c === 0) : ?>
|
||||||
|
|
|
||||||
|
|
@ -24,53 +24,53 @@ echo $this->data['nav']->render(); ?>
|
||||||
<section class="portlet">
|
<section class="portlet">
|
||||||
<div class="portlet-head"><?= $this->getHtml('Equipments'); ?><i class="g-icon download btn end-xs">download</i></div>
|
<div class="portlet-head"><?= $this->getHtml('Equipments'); ?><i class="g-icon download btn end-xs">download</i></div>
|
||||||
<div class="slider">
|
<div class="slider">
|
||||||
<table id="iSalesClientList" class="default sticky">
|
<table id="iEquipmentList" class="default sticky">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
<td><?= $this->getHtml('ID', '0', '0'); ?>
|
||||||
<label for="iSalesClientList-sort-1">
|
<label for="iEquipmentList-sort-1">
|
||||||
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-1">
|
<input type="radio" name="iEquipmentList-sort" id="iEquipmentList-sort-1">
|
||||||
<i class="sort-asc g-icon">expand_less</i>
|
<i class="sort-asc g-icon">expand_less</i>
|
||||||
</label>
|
</label>
|
||||||
<label for="iSalesClientList-sort-2">
|
<label for="iEquipmentList-sort-2">
|
||||||
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-2">
|
<input type="radio" name="iEquipmentList-sort" id="iEquipmentList-sort-2">
|
||||||
<i class="sort-desc g-icon">expand_more</i>
|
<i class="sort-desc g-icon">expand_more</i>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<i class="filter g-icon">filter_alt</i>
|
<i class="filter g-icon">filter_alt</i>
|
||||||
</label>
|
</label>
|
||||||
<td><?= $this->getHtml('Status'); ?>
|
<td><?= $this->getHtml('Status'); ?>
|
||||||
<label for="iSalesClientList-sort-3">
|
<label for="iEquipmentList-sort-3">
|
||||||
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-3">
|
<input type="radio" name="iEquipmentList-sort" id="iEquipmentList-sort-3">
|
||||||
<i class="sort-asc g-icon">expand_less</i>
|
<i class="sort-asc g-icon">expand_less</i>
|
||||||
</label>
|
</label>
|
||||||
<label for="iSalesClientList-sort-4">
|
<label for="iEquipmentList-sort-4">
|
||||||
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-4">
|
<input type="radio" name="iEquipmentList-sort" id="iEquipmentList-sort-4">
|
||||||
<i class="sort-desc g-icon">expand_more</i>
|
<i class="sort-desc g-icon">expand_more</i>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<i class="filter g-icon">filter_alt</i>
|
<i class="filter g-icon">filter_alt</i>
|
||||||
</label>
|
</label>
|
||||||
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
<td class="wf-100"><?= $this->getHtml('Name'); ?>
|
||||||
<label for="iSalesClientList-sort-5">
|
<label for="iEquipmentList-sort-5">
|
||||||
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-5">
|
<input type="radio" name="iEquipmentList-sort" id="iEquipmentList-sort-5">
|
||||||
<i class="sort-asc g-icon">expand_less</i>
|
<i class="sort-asc g-icon">expand_less</i>
|
||||||
</label>
|
</label>
|
||||||
<label for="iSalesClientList-sort-6">
|
<label for="iEquipmentList-sort-6">
|
||||||
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-6">
|
<input type="radio" name="iEquipmentList-sort" id="iEquipmentList-sort-6">
|
||||||
<i class="sort-desc g-icon">expand_more</i>
|
<i class="sort-desc g-icon">expand_more</i>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<i class="filter g-icon">filter_alt</i>
|
<i class="filter g-icon">filter_alt</i>
|
||||||
</label>
|
</label>
|
||||||
<td><?= $this->getHtml('Type'); ?>
|
<td><?= $this->getHtml('Type'); ?>
|
||||||
<label for="iSalesClientList-sort-7">
|
<label for="iEquipmentList-sort-7">
|
||||||
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-7">
|
<input type="radio" name="iEquipmentList-sort" id="iEquipmentList-sort-7">
|
||||||
<i class="sort-asc g-icon">expand_less</i>
|
<i class="sort-asc g-icon">expand_less</i>
|
||||||
</label>
|
</label>
|
||||||
<label for="iSalesClientList-sort-8">
|
<label for="iEquipmentList-sort-8">
|
||||||
<input type="radio" name="iSalesClientList-sort" id="iSalesClientList-sort-8">
|
<input type="radio" name="iEquipmentList-sort" id="iEquipmentList-sort-8">
|
||||||
<i class="sort-desc g-icon">expand_more</i>
|
<i class="sort-desc g-icon">expand_more</i>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
|
|
@ -81,7 +81,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
$count = 0;
|
$count = 0;
|
||||||
foreach ($equipments as $key => $value) :
|
foreach ($equipments as $key => $value) :
|
||||||
++$count;
|
++$count;
|
||||||
$url = UriFactory::build('{/base}/equipment/equipment/profile?{?}&id=' . $value->id);
|
$url = UriFactory::build('{/base}/equipment/equipment/view?{?}&id=' . $value->id);
|
||||||
?>
|
?>
|
||||||
<tr data-href="<?= $url; ?>">
|
<tr data-href="<?= $url; ?>">
|
||||||
<td>
|
<td>
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,9 @@ $equipmentStatus = EquipmentStatus::getConstants();
|
||||||
/**
|
/**
|
||||||
* @var \Modules\EquipmentManagement\Models\Equipment $equipment
|
* @var \Modules\EquipmentManagement\Models\Equipment $equipment
|
||||||
*/
|
*/
|
||||||
$equipment = $this->data['equipment'] ?? new NullEquipment();
|
$equipment = $this->data['equipment'] ?? new NullEquipment();
|
||||||
$files = $equipment->files;
|
$equipmentImage = $this->data['equipmentImage'] ?? new NullMedia();
|
||||||
$equipmentImage = $this->data['equipmentImage'] ?? new NullMedia();
|
$equipmentTypes = $this->data['types'] ?? [];
|
||||||
$equipmentTypes = $this->data['types'] ?? [];
|
|
||||||
$attributeView = $this->data['attributeView'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \phpOMS\Views\View $this
|
* @var \phpOMS\Views\View $this
|
||||||
|
|
@ -142,7 +140,7 @@ echo $this->data['nav']->render();
|
||||||
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
|
<input type="radio" id="c-tab-2" name="tabular-2"<?= $this->request->uri->fragment === 'c-tab-2' ? ' checked' : ''; ?>>
|
||||||
<div class="tab">
|
<div class="tab">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<?= $attributeView->render(
|
<?= $this->data['attributeView']->render(
|
||||||
$equipment->attributes,
|
$equipment->attributes,
|
||||||
$this->data['attributeTypes'] ?? [],
|
$this->data['attributeTypes'] ?? [],
|
||||||
$this->data['units'] ?? [],
|
$this->data['units'] ?? [],
|
||||||
|
|
@ -75,8 +75,8 @@ final class Autoloader
|
||||||
*/
|
*/
|
||||||
public static function defaultAutoloader(string $class) : void
|
public static function defaultAutoloader(string $class) : void
|
||||||
{
|
{
|
||||||
$class = \ltrim($class, '\\');
|
$class = \ltrim($class, '\\');
|
||||||
$class = \strtr($class, '_\\', '//');
|
$class = \strtr($class, '_\\', '//');
|
||||||
|
|
||||||
if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) {
|
if (\stripos($class, 'Web/Backend') !== false || \stripos($class, 'Web/Api') !== false) {
|
||||||
$class = \is_dir(__DIR__ . '/Web') ? $class : \str_replace('Web/', 'MainRepository/Web/', $class);
|
$class = \is_dir(__DIR__ . '/Web') ? $class : \str_replace('Web/', 'MainRepository/Web/', $class);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* Jingga
|
||||||
|
*
|
||||||
|
* PHP Version 8.1
|
||||||
|
*
|
||||||
|
* @package Modules\EquipmentManagement\tests
|
||||||
|
* @copyright Dennis Eichhorn
|
||||||
|
* @license OMS License 2.0
|
||||||
|
* @version 1.0.0
|
||||||
|
* @link https://jingga.app
|
||||||
|
*/
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
\ini_set('memory_limit', '2048M');
|
\ini_set('memory_limit', '2048M');
|
||||||
|
|
@ -67,10 +78,10 @@ $GLOBALS['is_github'] = $IS_GITHUB;
|
||||||
$tmp = FileLogger::getInstance(__DIR__ . '/../Logs');
|
$tmp = FileLogger::getInstance(__DIR__ . '/../Logs');
|
||||||
|
|
||||||
$CONFIG = [
|
$CONFIG = [
|
||||||
'db' => [
|
'db' => [
|
||||||
'core' => [
|
'core' => [
|
||||||
'masters' => [
|
'masters' => [
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -80,7 +91,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'insert' => [
|
'insert' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -90,7 +101,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'select' => [
|
'select' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -100,7 +111,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'update' => [
|
'update' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -110,7 +121,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'delete' => [
|
'delete' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -120,7 +131,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'schema' => [
|
'schema' => [
|
||||||
'db' => 'mysql', /* db type */
|
'db' => 'mysql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '3306', /* db host port */
|
'port' => '3306', /* db host port */
|
||||||
|
|
@ -132,7 +143,7 @@ $CONFIG = [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'postgresql' => [
|
'postgresql' => [
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -142,7 +153,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'insert' => [
|
'insert' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -152,7 +163,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'select' => [
|
'select' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -162,7 +173,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'update' => [
|
'update' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -172,7 +183,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'delete' => [
|
'delete' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -182,7 +193,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'schema' => [
|
'schema' => [
|
||||||
'db' => 'pgsql', /* db type */
|
'db' => 'pgsql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '5432', /* db host port */
|
'port' => '5432', /* db host port */
|
||||||
|
|
@ -194,37 +205,37 @@ $CONFIG = [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'sqlite' => [
|
'sqlite' => [
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'insert' => [
|
'insert' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'select' => [
|
'select' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'update' => [
|
'update' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'delete' => [
|
'delete' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'schema' => [
|
'schema' => [
|
||||||
'db' => 'sqlite', /* db type */
|
'db' => 'sqlite', /* db type */
|
||||||
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
'database' => __DIR__ . '/../Karaka/phpOMS/Localization/Defaults/localization.sqlite', /* db name */
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
|
|
@ -232,7 +243,7 @@ $CONFIG = [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'mssql' => [
|
'mssql' => [
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -242,7 +253,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'insert' => [
|
'insert' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -252,7 +263,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'select' => [
|
'select' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -262,7 +273,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'update' => [
|
'update' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -272,7 +283,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'delete' => [
|
'delete' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -282,7 +293,7 @@ $CONFIG = [
|
||||||
'weight' => 1000, /* db table prefix */
|
'weight' => 1000, /* db table prefix */
|
||||||
'datetimeformat' => 'Y-m-d H:i:s',
|
'datetimeformat' => 'Y-m-d H:i:s',
|
||||||
],
|
],
|
||||||
'schema' => [
|
'schema' => [
|
||||||
'db' => 'mssql', /* db type */
|
'db' => 'mssql', /* db type */
|
||||||
'host' => '127.0.0.1', /* db host address */
|
'host' => '127.0.0.1', /* db host address */
|
||||||
'port' => '1433', /* db host port */
|
'port' => '1433', /* db host port */
|
||||||
|
|
@ -322,16 +333,16 @@ $CONFIG = [
|
||||||
'password' => '123456',
|
'password' => '123456',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'log' => [
|
'log' => [
|
||||||
'file' => [
|
'file' => [
|
||||||
'path' => __DIR__ . '/Logs',
|
'path' => __DIR__ . '/Logs',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'page' => [
|
'page' => [
|
||||||
'root' => '/',
|
'root' => '/',
|
||||||
'https' => false,
|
'https' => false,
|
||||||
],
|
],
|
||||||
'app' => [
|
'app' => [
|
||||||
'path' => __DIR__,
|
'path' => __DIR__,
|
||||||
'default' => [
|
'default' => [
|
||||||
'app' => 'Backend',
|
'app' => 'Backend',
|
||||||
|
|
@ -350,7 +361,7 @@ $CONFIG = [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'socket' => [
|
'socket' => [
|
||||||
'master' => [
|
'master' => [
|
||||||
'host' => '127.0.0.1',
|
'host' => '127.0.0.1',
|
||||||
'limit' => 300,
|
'limit' => 300,
|
||||||
|
|
@ -360,7 +371,7 @@ $CONFIG = [
|
||||||
'language' => [
|
'language' => [
|
||||||
'en',
|
'en',
|
||||||
],
|
],
|
||||||
'apis' => [
|
'apis' => [
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ use phpOMS\Localization\ISO639x1Enum;
|
||||||
use phpOMS\Message\Http\HttpRequest;
|
use phpOMS\Message\Http\HttpRequest;
|
||||||
use phpOMS\Message\Http\HttpResponse;
|
use phpOMS\Message\Http\HttpResponse;
|
||||||
use phpOMS\Message\Http\RequestStatusCode;
|
use phpOMS\Message\Http\RequestStatusCode;
|
||||||
use phpOMS\Uri\HttpUri;
|
|
||||||
|
|
||||||
trait ApiControllerAttributeTrait
|
trait ApiControllerAttributeTrait
|
||||||
{
|
{
|
||||||
|
|
@ -30,7 +29,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiEquipmentAttributeTypeCreate() : void
|
public function testApiEquipmentAttributeTypeCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('name', 'test_attribute');
|
$request->setData('name', 'test_attribute');
|
||||||
|
|
@ -48,7 +47,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiEquipmentAttributeTypeL11nCreate() : void
|
public function testApiEquipmentAttributeTypeL11nCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('title', 'DE:2');
|
$request->setData('title', 'DE:2');
|
||||||
|
|
@ -66,7 +65,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiEquipmentAttributeValueIntCreate() : void
|
public function testApiEquipmentAttributeValueIntCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('default', '1');
|
$request->setData('default', '1');
|
||||||
|
|
@ -86,7 +85,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiEquipmentAttributeValueStrCreate() : void
|
public function testApiEquipmentAttributeValueStrCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('type', '1');
|
$request->setData('type', '1');
|
||||||
|
|
@ -105,7 +104,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiEquipmentAttributeValueFloatCreate() : void
|
public function testApiEquipmentAttributeValueFloatCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('type', '1');
|
$request->setData('type', '1');
|
||||||
|
|
@ -124,7 +123,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiEquipmentAttributeValueDatCreate() : void
|
public function testApiEquipmentAttributeValueDatCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('type', '1');
|
$request->setData('type', '1');
|
||||||
|
|
@ -143,7 +142,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiEquipmentAttributeCreate() : void
|
public function testApiEquipmentAttributeCreate() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('ref', '1');
|
$request->setData('ref', '1');
|
||||||
|
|
@ -161,7 +160,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiEquipmentAttributeValueCreateInvalidData() : void
|
public function testApiEquipmentAttributeValueCreateInvalidData() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('invalid', '1');
|
$request->setData('invalid', '1');
|
||||||
|
|
@ -177,7 +176,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiEquipmentAttributeTypeCreateInvalidData() : void
|
public function testApiEquipmentAttributeTypeCreateInvalidData() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('invalid', '1');
|
$request->setData('invalid', '1');
|
||||||
|
|
@ -193,7 +192,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiEquipmentAttributeTypeL11nCreateInvalidData() : void
|
public function testApiEquipmentAttributeTypeL11nCreateInvalidData() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('invalid', '1');
|
$request->setData('invalid', '1');
|
||||||
|
|
@ -209,7 +208,7 @@ trait ApiControllerAttributeTrait
|
||||||
public function testApiEquipmentAttributeCreateInvalidData() : void
|
public function testApiEquipmentAttributeCreateInvalidData() : void
|
||||||
{
|
{
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$request->header->account = 1;
|
$request->header->account = 1;
|
||||||
$request->setData('invalid', '1');
|
$request->setData('invalid', '1');
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ namespace Modules\EquipmentManagement\tests\Controller\Api;
|
||||||
use Modules\EquipmentManagement\Models\EquipmentTypeMapper;
|
use Modules\EquipmentManagement\Models\EquipmentTypeMapper;
|
||||||
use phpOMS\Message\Http\HttpRequest;
|
use phpOMS\Message\Http\HttpRequest;
|
||||||
use phpOMS\Message\Http\HttpResponse;
|
use phpOMS\Message\Http\HttpResponse;
|
||||||
use phpOMS\Uri\HttpUri;
|
|
||||||
use phpOMS\Utils\RnG\Text;
|
use phpOMS\Utils\RnG\Text;
|
||||||
|
|
||||||
trait ApiControllerEquipmentTrait
|
trait ApiControllerEquipmentTrait
|
||||||
|
|
@ -32,7 +31,7 @@ trait ApiControllerEquipmentTrait
|
||||||
$equipmentTypeCount = \count($equipmentType);
|
$equipmentTypeCount = \count($equipmentType);
|
||||||
|
|
||||||
$response = new HttpResponse();
|
$response = new HttpResponse();
|
||||||
$request = new HttpRequest(new HttpUri(''));
|
$request = new HttpRequest();
|
||||||
|
|
||||||
$LOREM = \array_slice(Text::LOREM_IPSUM, 0, 25);
|
$LOREM = \array_slice(Text::LOREM_IPSUM, 0, 25);
|
||||||
$LOREM_COUNT = \count($LOREM) - 1;
|
$LOREM_COUNT = \count($LOREM) - 1;
|
||||||
|
|
|
||||||
|
|
@ -57,13 +57,13 @@ final class ApiControllerTest extends \PHPUnit\Framework\TestCase
|
||||||
protected string $appName = 'Api';
|
protected string $appName = 'Api';
|
||||||
};
|
};
|
||||||
|
|
||||||
$this->app->dbPool = $GLOBALS['dbpool'];
|
$this->app->dbPool = $GLOBALS['dbpool'];
|
||||||
$this->app->unitId = 1;
|
$this->app->unitId = 1;
|
||||||
$this->app->accountManager = new AccountManager($GLOBALS['session']);
|
$this->app->accountManager = new AccountManager($GLOBALS['session']);
|
||||||
$this->app->appSettings = new CoreSettings();
|
$this->app->appSettings = new CoreSettings();
|
||||||
$this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/');
|
$this->app->moduleManager = new ModuleManager($this->app, __DIR__ . '/../../../../Modules/');
|
||||||
$this->app->dispatcher = new Dispatcher($this->app);
|
$this->app->dispatcher = new Dispatcher($this->app);
|
||||||
$this->app->eventManager = new EventManager($this->app->dispatcher);
|
$this->app->eventManager = new EventManager($this->app->dispatcher);
|
||||||
$this->app->eventManager->importFromFile(__DIR__ . '/../../../../Web/Api/Hooks.php');
|
$this->app->eventManager->importFromFile(__DIR__ . '/../../../../Web/Api/Hooks.php');
|
||||||
$this->app->sessionManager = new HttpSession(36000);
|
$this->app->sessionManager = new HttpSession(36000);
|
||||||
$this->app->l11nManager = new L11nManager();
|
$this->app->l11nManager = new L11nManager();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user