fix: correct subject field handling in message sending logic and update related IDs in bulk template
This commit is contained in:
parent
cf60c470b1
commit
e2f24c0cc6
@ -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;
|
||||
|
@ -79,10 +79,10 @@
|
||||
{Lang::T('Use 20 and above if you are sending to all customers to avoid server time out')}
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="subject">
|
||||
<div class="form-group" id="subject-content">
|
||||
<label class="col-md-2 control-label">{Lang::T('Subject')}</label>
|
||||
<div class="col-md-6">
|
||||
<input type="text" class="form-control" name="subject" id="subject-content" value=""
|
||||
<input type="text" class="form-control" name="subject" id="subject" value=""
|
||||
placeholder="{Lang::T('Enter message subject here')}">
|
||||
</div>
|
||||
<p class="help-block col-md-4">
|
||||
@ -148,8 +148,8 @@
|
||||
<script>
|
||||
document.getElementById('via').addEventListener('change', function () {
|
||||
const via = this.value;
|
||||
const subject = document.getElementById('subject');
|
||||
const subjectField = document.getElementById('subject-content');
|
||||
const subject = document.getElementById('subject-content');
|
||||
const subjectField = document.getElementById('subject');
|
||||
|
||||
subject.style.display = (via === 'all' || via === 'email' || via === 'inbox') ? 'block' : 'none';
|
||||
|
||||
@ -198,7 +198,6 @@
|
||||
method: 'POST',
|
||||
data: {
|
||||
group: $('#group').val(),
|
||||
subject: $('#subject').val() || '',
|
||||
message: $('#message').val(),
|
||||
via: $('#via').val(),
|
||||
batch: $('#batch').val(),
|
||||
@ -206,6 +205,7 @@
|
||||
page: page,
|
||||
test: $('#test').is(':checked') ? 'on' : 'off',
|
||||
service: $('#service').val(),
|
||||
subject: $('#subject').val(),
|
||||
},
|
||||
dataType: 'json',
|
||||
beforeSend: function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user