From 7c6b9ce672c1dc7ce2e0ba212ca0711d2e51b27e Mon Sep 17 00:00:00 2001 From: Kenio de Souza Date: Mon, 8 Sep 2025 15:50:10 -0300 Subject: [PATCH] =?UTF-8?q?Adicionado=20a=20tabela=20de=20parti=C3=A7?= =?UTF-8?q?=C3=A3o=20do=20GED?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/action/log/log_save.php | 7 ++++--- vendor/model/StationFolder.class.php | 15 ++++++++++----- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/vendor/action/log/log_save.php b/vendor/action/log/log_save.php index 9cd3e0b..52803d1 100644 --- a/vendor/action/log/log_save.php +++ b/vendor/action/log/log_save.php @@ -84,6 +84,9 @@ try { /** Exclui antigas unidades */ $StationDisk->Delete($clientId); + /** Exclui as antigas pastas */ + $StationFolder->Delete($clientId); + /** Exclui todas as estações de um determinado cliente */ $Station->Delete($clientId); @@ -158,9 +161,6 @@ try { } } - /** Exclui as antigas pastas */ - $StationFolder->Delete($stationId); - // Percorre a pasta Ged foreach ($jsonLog->ged as $path => $details) { @@ -173,6 +173,7 @@ try { /** Grava uma nova pasta ou atualiza o atual */ if (!$StationFolder->Save( 0, + $clientId, $stationId, $path, $value, diff --git a/vendor/model/StationFolder.class.php b/vendor/model/StationFolder.class.php index eaa4eb0..b5b44b7 100644 --- a/vendor/model/StationFolder.class.php +++ b/vendor/model/StationFolder.class.php @@ -177,6 +177,7 @@ class StationFolder /** Insere um novo registro no banco */ public function Save(? int $stationFolderId, + ? int $clientId, ? int $stationId, ? string $folderPath, ? int $amountOfFiles, @@ -186,6 +187,7 @@ class StationFolder /** Parametros */ $this->stationFolderId = $stationFolderId; + $this->clientId = $clientId; $this->stationId = $stationId; $this->folderPath = $folderPath; $this->amountOfFiles = $amountOfFiles; @@ -232,10 +234,12 @@ class StationFolder }else{//Se o ID não foi informado, grava-se um novo registro /** Consulta SQL */ - $this->sql = 'insert into station_folder(station_id, + $this->sql = 'insert into station_folder(station_id, + client_id, folder_path, amount_of_files ) values (:station_id, + :client_id, :folder_path, :amount_of_files)'; @@ -248,6 +252,7 @@ class StationFolder $this->connection->connect()->beginTransaction(); /** Preencho os parâmetros do SQL */ + $this->stmt->bindParam('client_id', $this->clientId); $this->stmt->bindParam('station_id', $this->stationId); $this->stmt->bindParam('folder_path', $this->folderPath); $this->stmt->bindParam('amount_of_files', $this->amountOfFiles); @@ -289,20 +294,20 @@ class StationFolder } /** Deleta um determinado registro no banco de dados */ - function Delete(int $stationId) + function Delete(int $clientId) { /** Parametros de entrada */ - $this->stationId = $stationId; + $this->clientId = $clientId; /** Consulta SQL */ $this->sql = 'delete from station_folder - where station_id = :station_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_id', $this->stationId); + $this->stmt->bindParam(':client_id', $this->clientId); /** Executo o SQL */ return $this->stmt->execute();