From d3d7eed6cddb692a48d16e599993ba459d04c9f3 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 20 Feb 2020 19:41:10 +0100 Subject: [PATCH] Disabilito anche il token collegato all'utente in fase di eliminazione anagrafica --- modules/anagrafiche/actions.php | 4 +++- modules/utenti/edit.php | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/anagrafiche/actions.php b/modules/anagrafiche/actions.php index 73e4af297..c20f11857 100755 --- a/modules/anagrafiche/actions.php +++ b/modules/anagrafiche/actions.php @@ -268,7 +268,9 @@ switch (post('op')) { // Se l'anagrafica è collegata ad un utente lo disabilito $dbo->query('UPDATE zz_users SET enabled = 0 WHERE idanagrafica = '.prepare($id_record)); - + // Disabilito anche il token + $dbo->query('UPDATE zz_tokens SET enabled = 0 WHERE id_utente = '.prepare($id_utente)); + flash()->info(tr('Anagrafica eliminata!')); } diff --git a/modules/utenti/edit.php b/modules/utenti/edit.php index 6005742b9..9b028ed97 100755 --- a/modules/utenti/edit.php +++ b/modules/utenti/edit.php @@ -74,13 +74,16 @@ if (!empty($utenti)) { '; // Disabilitazione token API, se diverso da id_utente #1 (admin) - $token = $dbo->fetchOne('SELECT `enabled` FROM `zz_tokens` WHERE `id_utente` = '.prepare($utente['id'])); + $token = $dbo->fetchOne('SELECT `enabled` FROM `zz_tokens` WHERE `id_utente` = '.prepare($utente['id']).'')['enabled']; + if ($utente['id'] == '1') { echo ' '; - } elseif (!empty($token['enabled'])) { + } elseif (!empty($token)) { + + echo '