diff --git a/Admin/Install/db.json b/Admin/Install/db.json index ed5c3b6..ea8e30d 100755 --- a/Admin/Install/db.json +++ b/Admin/Install/db.json @@ -115,6 +115,11 @@ "type": "VARCHAR(255)", "null": false }, + "equipmgmt_equipment_location": { + "name": "equipmgmt_equipment_location", + "type": "VARCHAR(255)", + "null": false + }, "equipmgmt_equipment_status": { "name": "equipmgmt_equipment_status", "type": "TINYINT", @@ -289,13 +294,13 @@ "null": false }, "equipmgmt_attr_type_required": { - "description": "Every equipment must have this attribute type if set to true.", + "comment": "Every equipment must have this attribute type if set to true.", "name": "equipmgmt_attr_type_required", "type": "TINYINT(1)", "null": false }, "equipmgmt_attr_type_pattern": { - "description": "This is a regex validation pattern.", + "comment": "This is a regex validation pattern.", "name": "equipmgmt_attr_type_pattern", "type": "VARCHAR(255)", "null": false diff --git a/Admin/Installer.php b/Admin/Installer.php index 1795a01..9d79a12 100755 --- a/Admin/Installer.php +++ b/Admin/Installer.php @@ -287,6 +287,10 @@ final class Installer extends InstallerAbstract $module = $app->moduleManager->get('EquipmentManagement', 'ApiEquipmentAttribute'); foreach ($attributes as $attribute) { + if (!isset($attribute['values'])) { + continue; + } + $itemAttrValue[$attribute['name']] = []; /** @var array $value */ diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 42ba494..b78d605 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -83,12 +83,14 @@ final class ApiController extends Controller */ public function createEquipmentFromRequest(RequestAbstract $request) : Equipment { - $equipment = new Equipment(); - $equipment->name = $request->getDataString('name') ?? ''; - $equipment->info = $request->getDataString('info') ?? ''; - $equipment->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0)); - $equipment->status = EquipmentStatus::tryFromValue($request->getDataInt('status')) ?? EquipmentStatus::INACTIVE; - $equipment->unit = $request->getDataInt('unit') ?? $this->app->unitId; + $equipment = new Equipment(); + $equipment->name = $request->getDataString('name') ?? ''; + $equipment->info = $request->getDataString('info') ?? ''; + $equipment->code = $request->getDataString('code') ?? ''; + $equipment->location = $request->getDataString('location') ?? ''; + $equipment->type = new NullBaseStringL11nType((int) ($request->getDataInt('type') ?? 0)); + $equipment->status = EquipmentStatus::tryFromValue($request->getDataInt('status')) ?? EquipmentStatus::INACTIVE; + $equipment->unit = $request->getDataInt('unit') ?? $this->app->unitId; return $equipment; } diff --git a/Controller/BackendController.php b/Controller/BackendController.php index 3a3f430..a919948 100755 --- a/Controller/BackendController.php +++ b/Controller/BackendController.php @@ -217,7 +217,6 @@ final class BackendController extends Controller $view->setTemplate('/Modules/EquipmentManagement/Theme/Backend/equipment-view'); $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. $view->data['equipment'] = EquipmentMapper::get() ->with('attributes') ->with('attributes/type') @@ -273,6 +272,11 @@ final class BackendController extends Controller $view->data['units'] = UnitMapper::getAll() ->executeGetArray(); + $view->data['attributeTypes'] = EquipmentAttributeTypeMapper::getAll() + ->with('l11n') + ->where('l11n/language', $response->header->l11n->language) + ->executeGetArray(); + $view->data['attributeView'] = new \Modules\Attribute\Theme\Backend\Components\AttributeView($this->app->l11nManager, $request, $response); $view->data['attributeView']->data['default_localization'] = $this->app->l11nServer; diff --git a/Docs/Dev/en/structure.md b/Docs/Dev/en/structure.md deleted file mode 100755 index 38a509f..0000000 --- a/Docs/Dev/en/structure.md +++ /dev/null @@ -1,5 +0,0 @@ -# Structure - -## ER - -![ER](Modules/EquipmentManagement/Docs/Dev/img/er.png) \ No newline at end of file diff --git a/Docs/Dev/img/er.png b/Docs/Dev/img/er.png deleted file mode 100755 index b56a770..0000000 Binary files a/Docs/Dev/img/er.png and /dev/null differ diff --git a/Models/Equipment.php b/Models/Equipment.php index e2eb721..0bee3c2 100755 --- a/Models/Equipment.php +++ b/Models/Equipment.php @@ -32,6 +32,8 @@ class Equipment implements \JsonSerializable public string $code = ''; + public string $location = ''; + public int $status = EquipmentStatus::ACTIVE; public BaseStringL11nType $type; diff --git a/Models/EquipmentMapper.php b/Models/EquipmentMapper.php index f2adf20..5b800e4 100755 --- a/Models/EquipmentMapper.php +++ b/Models/EquipmentMapper.php @@ -42,6 +42,7 @@ final class EquipmentMapper extends DataMapperFactory 'equipmgmt_equipment_id' => ['name' => 'equipmgmt_equipment_id', 'type' => 'int', 'internal' => 'id'], 'equipmgmt_equipment_name' => ['name' => 'equipmgmt_equipment_name', 'type' => 'string', 'internal' => 'name'], 'equipmgmt_equipment_code' => ['name' => 'equipmgmt_equipment_code', 'type' => 'string', 'internal' => 'code'], + 'equipmgmt_equipment_location' => ['name' => 'equipmgmt_equipment_location', 'type' => 'string', 'internal' => 'location'], 'equipmgmt_equipment_status' => ['name' => 'equipmgmt_equipment_status', 'type' => 'int', 'internal' => 'status'], 'equipmgmt_equipment_info' => ['name' => 'equipmgmt_equipment_info', 'type' => 'string', 'internal' => 'info'], 'equipmgmt_equipment_unit' => ['name' => 'equipmgmt_equipment_unit', 'type' => 'int', 'internal' => 'unit'], diff --git a/Theme/Backend/Lang/de.lang.php b/Theme/Backend/Lang/de.lang.php index 4a2540e..ba532af 100755 --- a/Theme/Backend/Lang/de.lang.php +++ b/Theme/Backend/Lang/de.lang.php @@ -13,33 +13,35 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => 'Aktiv', - ':status2' => 'Inaktiv', - ':status3' => 'Beschädigt', - ':status4' => 'Außer Betrieb', - 'Attributes' => 'Attribute', - 'Costs' => 'Kosten', - 'Date' => 'Datum', - 'EIN' => 'WKN', - 'Ein' => 'Ein', - 'End' => 'Ende', - 'Number' => 'Nummer', - 'Equipments' => 'Equipment', - 'Equipment' => 'Equipment', - 'Files' => 'Dateien', - 'History' => 'Historie', - 'Inspections' => 'Inspectionen', - 'InspectionTypes' => 'Inspektionsarten', - 'LeasingFee' => 'Leasingkosten', - 'Make' => 'Marke', - 'Model' => 'Modell', - 'Name' => 'Name', - 'Notes' => 'Notizen', - 'Profile' => 'Profile', - 'PurchasePrice' => 'Kaufpreis', - 'Responsible' => 'Verantwortlich', - 'Start' => 'Start', - 'Status' => 'Status', - 'Type' => 'Typ', - 'Upcoming' => 'Upcoming', + ':status1' => 'Aktiv', + ':status2' => 'Inaktiv', + ':status3' => 'Beschädigt', + ':status4' => 'Außer Betrieb', + 'Attributes' => 'Attribute', + 'Costs' => 'Kosten', + 'Code' => 'Code', + 'Date' => 'Datum', + 'EIN' => 'WKN', + 'Ein' => 'Ein', + 'End' => 'Ende', + 'Number' => 'Nummer', + 'Equipments' => 'Equipment', + 'Equipment' => 'Equipment', + 'Files' => 'Dateien', + 'History' => 'Historie', + 'Inspections' => 'Inspectionen', + 'InspectionTypes' => 'Inspektionsarten', + 'LeasingFee' => 'Leasingkosten', + 'Make' => 'Marke', + 'Model' => 'Modell', + 'Name' => 'Name', + 'Notes' => 'Notizen', + 'Profile' => 'Profile', + 'PurchasePrice' => 'Kaufpreis', + 'Responsible' => 'Verantwortlich', + 'Start' => 'Start', + 'Status' => 'Status', + 'Type' => 'Typ', + 'Location' => 'Standort', + 'Upcoming' => 'Upcoming', ]]; diff --git a/Theme/Backend/Lang/en.lang.php b/Theme/Backend/Lang/en.lang.php index 2fd260d..62e9444 100755 --- a/Theme/Backend/Lang/en.lang.php +++ b/Theme/Backend/Lang/en.lang.php @@ -13,33 +13,35 @@ declare(strict_types=1); return ['EquipmentManagement' => [ - ':status1' => 'Active', - ':status2' => 'Inactive', - ':status3' => 'Damaged', - ':status4' => 'Out of order', - 'Attributes' => 'Attributes', - 'Costs' => 'Costs', - 'Date' => 'Date', - 'EIN' => 'EIN', - 'Ein' => 'Ein', - 'End' => 'End', - 'Equipments' => 'Equipments', - 'Equipment' => 'Equipment', - 'Number' => 'Number', - 'Files' => 'Files', - 'History' => 'History', - 'Inspections' => 'Inspections', - 'InspectionTypes' => 'Inspection Types', - 'LeasingFee' => 'Leasing Fee', - 'Make' => 'Make', - 'Model' => 'Model', - 'Name' => 'Name', - 'Notes' => 'Notes', - 'Profile' => 'Profile', - 'PurchasePrice' => 'Purchase Price', - 'Responsible' => 'Responsible', - 'Start' => 'Start', - 'Status' => 'Status', - 'Type' => 'Type', - 'Upcoming' => 'Upcoming', + ':status1' => 'Active', + ':status2' => 'Inactive', + ':status3' => 'Damaged', + ':status4' => 'Out of order', + 'Attributes' => 'Attributes', + 'Costs' => 'Costs', + 'Code' => 'Code', + 'Date' => 'Date', + 'EIN' => 'EIN', + 'Ein' => 'Ein', + 'End' => 'End', + 'Equipments' => 'Equipments', + 'Equipment' => 'Equipment', + 'Number' => 'Number', + 'Files' => 'Files', + 'History' => 'History', + 'Inspections' => 'Inspections', + 'InspectionTypes' => 'Inspection Types', + 'LeasingFee' => 'Leasing Fee', + 'Make' => 'Make', + 'Model' => 'Model', + 'Name' => 'Name', + 'Notes' => 'Notes', + 'Profile' => 'Profile', + 'PurchasePrice' => 'Purchase Price', + 'Responsible' => 'Responsible', + 'Start' => 'Start', + 'Status' => 'Status', + 'Type' => 'Type', + 'Location' => 'Location', + 'Upcoming' => 'Upcoming', ]]; diff --git a/Theme/Backend/equipment-view.tpl.php b/Theme/Backend/equipment-view.tpl.php index 0f6e328..44e360c 100755 --- a/Theme/Backend/equipment-view.tpl.php +++ b/Theme/Backend/equipment-view.tpl.php @@ -79,6 +79,11 @@ echo $this->data['nav']->render(); +
+ + +
+