From d1f4b80255423bca71b8de45a957f08e446d44e0 Mon Sep 17 00:00:00 2001 From: sviluppo-giacomo Date: Mon, 28 Apr 2025 12:56:02 +0200 Subject: [PATCH] ``` Add logging functionality for Licenze operations Implemented a LogLicenze model and extended LicenzeController to log insert, update, and delete actions. This improves traceability of changes performed on Licenze through the application. ``` --- application/models/Resources/LogLicenze.php | 13 +++++++++ .../v1/controllers/LicenzeController.php | 29 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 application/models/Resources/LogLicenze.php diff --git a/application/models/Resources/LogLicenze.php b/application/models/Resources/LogLicenze.php new file mode 100644 index 0000000..cfe7859 --- /dev/null +++ b/application/models/Resources/LogLicenze.php @@ -0,0 +1,13 @@ +inserimentoRecordDiLog($data, 'Inserimento'); + return $data; + } + + public function afterUpdateElement($data) + { + $this->inserimentoRecordDiLog($data, 'Aggiornamento'); + return $data; + } + + public function afterDeleteElement($id): void + { + $record = $this->_genericModel->getRecordById($this->_resourceName, $id); + $this->inserimentoRecordDiLog($record, 'Eliminazione'); + } + + private function inserimentoRecordDiLog($data, $op) + { + /*$this->_genericModel->insert('LogLicenze', [ + 'Operazione' => $op, + 'Data' => date('Y-m-d H:i:s'), + 'Utente' => $this->_authInfo->getIdentity(), + 'Descrizione' => '', + 'IdElemento' => '' + ]);*/ + } }//END CLASS