fix: correct subject field handling in message sending logic and update related IDs in bulk template

This commit is contained in:
Focuslinkstech
2025-04-09 20:16:11 +01:00
parent cf60c470b1
commit e2f24c0cc6
2 changed files with 9 additions and 9 deletions

View File

@ -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;