From 491fd9497bd71c30a934abeb2c65375b92408bde Mon Sep 17 00:00:00 2001 From: Bjoern Rudner Date: Fri, 18 Oct 2024 18:27:32 +0200 Subject: [PATCH] add secondary PC --- README.md | 1 + br-peripherals/datamodel.br-peripherals.xml | 28 ++++++++++++++++++++- br-peripherals/de.dict.br-peripherals.php | 1 + br-peripherals/en.dict.br-peripherals.php | 1 + 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f943de1..affaebf 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,7 @@ The class `Workstation` is a child class of `PhysicalDevice`. | Location | Foreign key to a Location | No | | User | Foreign key to a Person/Contact | No | | PC | Foreign key to a [PC](#pc) | Yes | +| Secondary PC | Foreign key to a [PC](#pc) | No | | Docking Station | Foreign key to a [Docking Station](#dockingstation) | No | | Monitor A | Foreign key to a [Monitor](#monitor) | No | | Monitor B | Foreign key to a [Monitor](#monitor) | No | diff --git a/br-peripherals/datamodel.br-peripherals.xml b/br-peripherals/datamodel.br-peripherals.xml index 0e4486e..983461f 100644 --- a/br-peripherals/datamodel.br-peripherals.xml +++ b/br-peripherals/datamodel.br-peripherals.xml @@ -79,6 +79,21 @@ pc_id name + + org_id AND obj.workstation_id = 0]]> + + + + pcB_id + PC + true + DEL_MANUAL + false + + + pcB_id + name + org_id AND obj.workstation_id = 0]]> @@ -319,7 +334,7 @@ DisconnectTargetFromWorkstation($this->GetOriginal('pc_id')); } + if (array_key_exists('pcB_id', $aChanges)) { + // record in the local memory object that the secondary PC was changed + $this->bPCBChanged = true; + // disconnect the old Workstation + $this->DisconnectTargetFromWorkstation($this->GetOriginal('pcB_id')); + } if (array_key_exists('monitorA_id', $aChanges)) { // record in the local memory object that the MonitorA was changed $this->bMonitorAChanged = true; @@ -590,6 +611,8 @@ return array('pc_id','monitorA_id','monitorB_id','dockingstation_id', // The Workstation is updated in DB and assigned Peripherals changed if (isset($this->bPCChanged)) $this->ConnectTargetToWorkstation($this->Get('pc_id'), $bUpdateLocations); + if (isset($this->bPCBChanged)) + $this->ConnectTargetToWorkstation($this->Get('pcB_id'), $bUpdateLocations); if (isset($this->bMonitorAChanged)) $this->ConnectTargetToWorkstation($this->Get('monitorA_id'), $bUpdateLocations); if (isset($this->bMonitorBChanged)) @@ -718,6 +741,9 @@ return array('pc_id','monitorA_id','monitorB_id','dockingstation_id', 10 + + 15 + 20 diff --git a/br-peripherals/de.dict.br-peripherals.php b/br-peripherals/de.dict.br-peripherals.php index 3a3c0f5..da5f9b0 100644 --- a/br-peripherals/de.dict.br-peripherals.php +++ b/br-peripherals/de.dict.br-peripherals.php @@ -14,6 +14,7 @@ 'Class:Workstation+' => 'Ein Arbeitsplatz', 'Class:Workstation/Attribute:user_id' => 'Benutzer', 'Class:Workstation/Attribute:pc_id' => 'PC', + 'Class:Workstation/Attribute:pcB_id' => 'Zweiter PC', 'Class:Workstation/Attribute:monitorA_id' => 'Bildschirm A', 'Class:Workstation/Attribute:monitorB_id' => 'Bildschirm B', 'Class:Workstation/Attribute:dockingstation_id' => 'Docking Station', diff --git a/br-peripherals/en.dict.br-peripherals.php b/br-peripherals/en.dict.br-peripherals.php index 1be0271..26d8a1d 100644 --- a/br-peripherals/en.dict.br-peripherals.php +++ b/br-peripherals/en.dict.br-peripherals.php @@ -14,6 +14,7 @@ 'Class:Workstation+' => 'A workstation', 'Class:Workstation/Attribute:user_id' => 'User', 'Class:Workstation/Attribute:pc_id' => 'PC', + 'Class:Workstation/Attribute:pcB_id' => 'secondary PC', 'Class:Workstation/Attribute:monitorA_id' => 'Monitor A', 'Class:Workstation/Attribute:monitorB_id' => 'Monitor B', 'Class:Workstation/Attribute:dockingstation_id' => 'Docking station',