From e2f24c0cc62ef49314dc89bf29910040ba43371c Mon Sep 17 00:00:00 2001 From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com> Date: Wed, 9 Apr 2025 20:16:11 +0100 Subject: [PATCH] fix: correct subject field handling in message sending logic and update related IDs in bulk template --- system/controllers/message.php | 8 ++++---- ui/ui/admin/message/bulk.tpl | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/system/controllers/message.php b/system/controllers/message.php index 1df8144c..a1407698 100644 --- a/system/controllers/message.php +++ b/system/controllers/message.php @@ -58,7 +58,7 @@ EOT; } $id_customer = $_POST['id_customer'] ?? ''; - $message = $_POST['message']?? ''; + $message = $_POST['message'] ?? ''; $via = $_POST['via'] ?? ''; $subject = $_POST['subject'] ?? ''; @@ -156,7 +156,7 @@ EOT; $batch = $_REQUEST['batch'] ?? 100; $page = $_REQUEST['page'] ?? 0; $router = $_REQUEST['router'] ?? null; - $test = isset($_REQUEST['test']) && $_REQUEST['test'] === 'on' ? true : false; + $test = isset($_REQUEST['test']) && $_REQUEST['test'] === 'on'; $service = $_REQUEST['service'] ?? ''; $subject = $_REQUEST['subject'] ?? ''; @@ -164,7 +164,7 @@ EOT; die(json_encode(['status' => 'error', 'message' => LANG::T('All fields are required')])); } - if ($via === 'all' || $via === 'email' || $via === 'inbox' && empty($subject)) { + if (in_array($via, ['all', 'email', 'inbox']) && empty($subject)) { die(json_encode(['status' => 'error', 'message' => LANG::T('Subject is required to send message using') . ' ' . $via . '.'])); } @@ -438,7 +438,7 @@ EOT; if ($via === 'all' || $via === 'email' || $via === 'inbox' && empty($subject)) { die(json_encode(['status' => 'error', 'message' => LANG::T('Subject is required to send message using') . ' ' . $via . '.'])); } - + // Prepare to send messages $sentCount = 0; $failedCount = 0; diff --git a/ui/ui/admin/message/bulk.tpl b/ui/ui/admin/message/bulk.tpl index 9610309d..7d7c677a 100644 --- a/ui/ui/admin/message/bulk.tpl +++ b/ui/ui/admin/message/bulk.tpl @@ -79,10 +79,10 @@ {Lang::T('Use 20 and above if you are sending to all customers to avoid server time out')} -
+
-

@@ -148,8 +148,8 @@