From 5194bd165c24c350e03b1206692bb6522ee0c19b Mon Sep 17 00:00:00 2001 From: Jonathan Date: Wed, 20 Dec 2023 15:14:16 +0100 Subject: [PATCH] #12156 fix notification group --- .../include/functions_notifications.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pandora_console/include/functions_notifications.php b/pandora_console/include/functions_notifications.php index c65c475550..9e7db33bae 100644 --- a/pandora_console/include/functions_notifications.php +++ b/pandora_console/include/functions_notifications.php @@ -636,13 +636,15 @@ function notifications_get_user_label_status($source, $user, $label) ); // Clean default common groups error for mesagges. + $group_enable = true; if ($common_groups[0] === 0) { unset($common_groups[0]); + $group_enable = false; } // No group found, return no permissions. $value = empty($common_groups) ? false : $source[$label]; - return notifications_build_user_enable_return($value, false); + return notifications_build_user_enable_return($value, $group_enable); } @@ -674,6 +676,18 @@ function notifications_set_user_label_status($source, $user, $label, $value) return false; } + $eixsts = db_get_row('tnotification_source_user', 'id_user', $user); + if ($eixsts === false) { + db_process_sql_insert( + 'tnotification_source_user', + [ + 'id_user' => $user, + 'id_source' => $source, + 'enabled' => '1', + ] + ); + } + return (bool) db_process_sql_update( 'tnotification_source_user', [$label => $value],