diff --git a/vendor/action/log/log_save.php b/vendor/action/log/log_save.php index 3beefec..6276986 100644 --- a/vendor/action/log/log_save.php +++ b/vendor/action/log/log_save.php @@ -114,7 +114,7 @@ try { /** Exclui antigas unidades */ - $StationDisk->Delete($stationId); + $StationDisk->Delete($clientId); // Percorre cada disco (C:, D:, etc.) foreach ($jsonLog->disk as $drive => $details) { @@ -144,7 +144,8 @@ try { /** Grava o novo disco ou atualiza o atual */ if (!$StationDisk->Save( - $stationDiskId, + 0, + $clientId, $stationId, $drive, $capacidade, @@ -188,7 +189,7 @@ try { /** Deleta os dados da partição */ - //$StationFolder->DeletePartition($clientId); + $StationFolder->DeletePartition($clientId); /** Grava os detalhes da partição GED */ $StationFolder->SavePartition($jsonLog->ged->{'partition'}, diff --git a/vendor/model/StationDisk.class.php b/vendor/model/StationDisk.class.php index 832905d..dd6ce36 100644 --- a/vendor/model/StationDisk.class.php +++ b/vendor/model/StationDisk.class.php @@ -175,7 +175,8 @@ class StationDisk } /** Insere um novo registro no banco */ - public function Save(? int $stationDiskId, + public function Save(? int $stationDiskId, + ? int $clientId, ? int $stationId, ? string $description, ? string $capacity, @@ -186,6 +187,7 @@ class StationDisk /** Parametros */ + $this->clientId = $clientId; $this->stationDiskId = $stationDiskId; $this->stationId = $stationId; $this->description = $description; @@ -244,7 +246,8 @@ class StationDisk }else{//Se o ID não foi informado, grava-se um novo registro /** Consulta SQL */ - $this->sql = 'insert into station_disk(station_disk_id, + $this->sql = 'insert into station_disk(station_disk_id, + client_id, station_id, description, capacity, @@ -252,6 +255,7 @@ class StationDisk available, available_percentage ) values (:station_disk_id, + :client_id, :station_id, :description, :capacity, @@ -269,6 +273,7 @@ class StationDisk /** Preencho os parâmetros do SQL */ $this->stmt->bindParam('station_disk_id', $this->stationDiskId); + $this->stmt->bindParam('client_id', $this->clientId); $this->stmt->bindParam('station_id', $this->stationId); $this->stmt->bindParam('description', $this->description); $this->stmt->bindParam('capacity', $this->capacity); @@ -311,20 +316,20 @@ class StationDisk } /** Deleta um determinado registro no banco de dados */ - function Delete(int $stationDiskId) + function Delete(int $clientId) { /** Parametros de entrada */ - $this->stationDiskId = $stationDiskId; + $this->clientId = $clientId; /** Consulta SQL */ $this->sql = 'delete from station_disk - where station_disk_id = :station_disk_id'; + where client_id = :client_id'; /** Preparo o sql para receber os valores */ $this->stmt = $this->connection->connect()->prepare($this->sql); /** Preencho os parâmetros do SQL */ - $this->stmt->bindParam('station_disk_id', $this->stationDiskId); + $this->stmt->bindParam(':client_id', $this->clientId); /** Executo o SQL */ return $this->stmt->execute();