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 '