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'] ?? '';
|
$id_customer = $_POST['id_customer'] ?? '';
|
||||||
$message = $_POST['message']?? '';
|
$message = $_POST['message'] ?? '';
|
||||||
$via = $_POST['via'] ?? '';
|
$via = $_POST['via'] ?? '';
|
||||||
$subject = $_POST['subject'] ?? '';
|
$subject = $_POST['subject'] ?? '';
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ EOT;
|
|||||||
$batch = $_REQUEST['batch'] ?? 100;
|
$batch = $_REQUEST['batch'] ?? 100;
|
||||||
$page = $_REQUEST['page'] ?? 0;
|
$page = $_REQUEST['page'] ?? 0;
|
||||||
$router = $_REQUEST['router'] ?? null;
|
$router = $_REQUEST['router'] ?? null;
|
||||||
$test = isset($_REQUEST['test']) && $_REQUEST['test'] === 'on' ? true : false;
|
$test = isset($_REQUEST['test']) && $_REQUEST['test'] === 'on';
|
||||||
$service = $_REQUEST['service'] ?? '';
|
$service = $_REQUEST['service'] ?? '';
|
||||||
$subject = $_REQUEST['subject'] ?? '';
|
$subject = $_REQUEST['subject'] ?? '';
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ EOT;
|
|||||||
die(json_encode(['status' => 'error', 'message' => LANG::T('All fields are required')]));
|
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 . '.']));
|
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)) {
|
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 . '.']));
|
die(json_encode(['status' => 'error', 'message' => LANG::T('Subject is required to send message using') . ' ' . $via . '.']));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare to send messages
|
// Prepare to send messages
|
||||||
$sentCount = 0;
|
$sentCount = 0;
|
||||||
$failedCount = 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')}
|
{Lang::T('Use 20 and above if you are sending to all customers to avoid server time out')}
|
||||||
</div>
|
</div>
|
||||||
</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>
|
<label class="col-md-2 control-label">{Lang::T('Subject')}</label>
|
||||||
<div class="col-md-6">
|
<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')}">
|
placeholder="{Lang::T('Enter message subject here')}">
|
||||||
</div>
|
</div>
|
||||||
<p class="help-block col-md-4">
|
<p class="help-block col-md-4">
|
||||||
@ -148,8 +148,8 @@
|
|||||||
<script>
|
<script>
|
||||||
document.getElementById('via').addEventListener('change', function () {
|
document.getElementById('via').addEventListener('change', function () {
|
||||||
const via = this.value;
|
const via = this.value;
|
||||||
const subject = document.getElementById('subject');
|
const subject = document.getElementById('subject-content');
|
||||||
const subjectField = document.getElementById('subject-content');
|
const subjectField = document.getElementById('subject');
|
||||||
|
|
||||||
subject.style.display = (via === 'all' || via === 'email' || via === 'inbox') ? 'block' : 'none';
|
subject.style.display = (via === 'all' || via === 'email' || via === 'inbox') ? 'block' : 'none';
|
||||||
|
|
||||||
@ -198,7 +198,6 @@
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: {
|
data: {
|
||||||
group: $('#group').val(),
|
group: $('#group').val(),
|
||||||
subject: $('#subject').val() || '',
|
|
||||||
message: $('#message').val(),
|
message: $('#message').val(),
|
||||||
via: $('#via').val(),
|
via: $('#via').val(),
|
||||||
batch: $('#batch').val(),
|
batch: $('#batch').val(),
|
||||||
@ -206,6 +205,7 @@
|
|||||||
page: page,
|
page: page,
|
||||||
test: $('#test').is(':checked') ? 'on' : 'off',
|
test: $('#test').is(':checked') ? 'on' : 'off',
|
||||||
service: $('#service').val(),
|
service: $('#service').val(),
|
||||||
|
subject: $('#subject').val(),
|
||||||
},
|
},
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
beforeSend: function () {
|
beforeSend: function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user