Merge pull request #139 from Focuslinkstech/Development
Update message.php
This commit is contained in:
commit
7dd27e3080
@ -144,15 +144,18 @@ EOT;
|
|||||||
|
|
||||||
// Loop through customers and send messages
|
// Loop through customers and send messages
|
||||||
foreach ($customers as $customer) {
|
foreach ($customers as $customer) {
|
||||||
|
// Create a copy of the original message for each customer and save it as currentMessage
|
||||||
|
$currentMessage = $message;
|
||||||
|
|
||||||
// Replace placeholders in the message with actual values for each customer
|
// Replace placeholders in the message with actual values for each customer
|
||||||
$message = str_replace('[[name]]', $customer['fullname'], $message);
|
$currentMessage = str_replace('[[name]]', $customer['fullname'], $currentMessage);
|
||||||
$message = str_replace('[[user_name]]', $customer['username'], $message);
|
$currentMessage = str_replace('[[user_name]]', $customer['username'], $currentMessage);
|
||||||
$message = str_replace('[[phone]]', $customer['phonenumber'], $message);
|
$currentMessage = str_replace('[[phone]]', $customer['phonenumber'], $currentMessage);
|
||||||
$message = str_replace('[[company_name]]', $config['CompanyName'], $message);
|
$currentMessage = str_replace('[[company_name]]', $config['CompanyName'], $currentMessage);
|
||||||
|
|
||||||
// Send the message based on the selected method
|
// Send the message based on the selected method
|
||||||
if ($via == 'sms' || $via == 'both') {
|
if ($via == 'sms' || $via == 'both') {
|
||||||
$smsSent = Message::sendSMS($customer['phonenumber'], $message);
|
$smsSent = Message::sendSMS($customer['phonenumber'], $currentMessage);
|
||||||
if ($smsSent) {
|
if ($smsSent) {
|
||||||
$successCount++;
|
$successCount++;
|
||||||
$successMessages[] = "SMS sent to {$customer['fullname']}: {$customer['phonenumber']}";
|
$successMessages[] = "SMS sent to {$customer['fullname']}: {$customer['phonenumber']}";
|
||||||
@ -165,7 +168,7 @@ EOT;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($via == 'wa' || $via == 'both') {
|
if ($via == 'wa' || $via == 'both') {
|
||||||
$waSent = Message::sendWhatsapp($customer['phonenumber'], $message);
|
$waSent = Message::sendWhatsapp($customer['phonenumber'], $currentMessage);
|
||||||
if ($waSent) {
|
if ($waSent) {
|
||||||
$successCount++;
|
$successCount++;
|
||||||
$successMessages[] = "WhatsApp message sent to {$customer['fullname']}: {$customer['phonenumber']}";
|
$successMessages[] = "WhatsApp message sent to {$customer['fullname']}: {$customer['phonenumber']}";
|
||||||
|
@ -88,20 +88,20 @@
|
|||||||
<label class="col-md-3 control-label">{Lang::T('Service Type')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Service Type')}</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<select class="form-control" id="service_type" name="service_type">
|
<select class="form-control" id="service_type" name="service_type">
|
||||||
<option value="Hotspot" {if $d['service_type'] eq 'Hotspot' }selected{/if}>Hotspot
|
<option value="Hotspot">Hotspot
|
||||||
</option>
|
</option>
|
||||||
<option value="PPPoE" {if $d['service_type'] eq 'PPPoE' }selected{/if}>PPPoE</option>
|
<option value="PPPoE">PPPoE</option>
|
||||||
<option value="Others" {if $d['service_type'] eq 'Others' }selected{/if}>Others</option>
|
<option value="Others">Others</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-md-3 control-label">{Lang::T('Account Type')}</label>
|
<label class="col-md-3 control-label">{Lang::T('Account Type')}</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<select class="form-control" id="service_type" name="service_type">
|
<select class="form-control" id="account_type" name="account_type">
|
||||||
<option value="Personal" {if $d['account_type'] eq 'Personal' }selected{/if}>Personal
|
<option value="Personal">Personal
|
||||||
</option>
|
</option>
|
||||||
<option value="Business" {if $d['account_type'] eq 'Business' }selected{/if}>Business</option>
|
<option value="Business">Business</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -58,6 +58,9 @@
|
|||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<b>{Lang::T('Service Type')}</b> <span class="pull-right">{Lang::T($d['service_type'])}</span>
|
<b>{Lang::T('Service Type')}</b> <span class="pull-right">{Lang::T($d['service_type'])}</span>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="list-group-item">
|
||||||
|
<b>{Lang::T('Account Type')}</b> <span class="pull-right">{Lang::T($d['account_type'])}</span>
|
||||||
|
</li>
|
||||||
<li class="list-group-item">
|
<li class="list-group-item">
|
||||||
<b>{Lang::T('Balance')}</b> <span class="pull-right">{Lang::moneyFormat($d['balance'])}</span>
|
<b>{Lang::T('Balance')}</b> <span class="pull-right">{Lang::moneyFormat($d['balance'])}</span>
|
||||||
</li>
|
</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user