From 5f2137d8eceafcb9046def6ee5581676b621ac16 Mon Sep 17 00:00:00 2001 From: solocla Date: Fri, 14 Aug 2026 08:04:22 +0200 Subject: [PATCH] notification on off widget --- public/userarea/include/training_widget.php | 13 +++++++++++++ .../scadenzario/include/my_deadlines_widget.php | 8 +++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/public/userarea/include/training_widget.php b/public/userarea/include/training_widget.php index 62916c6..cff51d8 100644 --- a/public/userarea/include/training_widget.php +++ b/public/userarea/include/training_widget.php @@ -9,6 +9,19 @@ if (!isset($pdo)) { $pdo = DBHandlerSelect::getInstance()->getConnection(); } +if (!isset($pdo)) { + $pdo = DBHandlerSelect::getInstance()->getConnection(); +} + +/* Check user webapp notification preference */ +$__notifyStmt = $pdo->prepare("SELECT notify_webapp FROM auth_users WHERE id = ? LIMIT 1"); +$__notifyStmt->execute([(int)$iduserlogin]); +if ((int)$__notifyStmt->fetchColumn() !== 1) { + return; +} + +$__trWidgetHr = isset($user) + $__trWidgetHr = isset($user) && ( $user->hasRole('Admin') || $user->hasRole('Superuser') diff --git a/public/userarea/scadenzario/include/my_deadlines_widget.php b/public/userarea/scadenzario/include/my_deadlines_widget.php index 8bc8e42..99f09cb 100644 --- a/public/userarea/scadenzario/include/my_deadlines_widget.php +++ b/public/userarea/scadenzario/include/my_deadlines_widget.php @@ -6,6 +6,12 @@ * - orange -> approaching deadlines (in scadenza) * Scope: deadlines assigned directly to the user OR to their department. */ +/* Check user webapp notification preference */ +$_notifyStmt = $pdo->prepare("SELECT notify_webapp FROM auth_users WHERE id = ? LIMIT 1"); +$_notifyStmt->execute([(int)$iduserlogin]); +if ((int)$_notifyStmt->fetchColumn() !== 1) { + return; +} $_empStmt = $pdo->prepare("SELECT id, department FROM employees WHERE auth_user_id = ? LIMIT 1"); $_empStmt->execute([(int)$iduserlogin]); @@ -131,4 +137,4 @@ if (!$_emp || ($_overdue === 0 && $_approaching === 0)) { - + \ No newline at end of file