Fix notification

This commit is contained in:
Ibnu Maksum 2024-03-18 11:48:15 +07:00
parent d36f39af8f
commit 130451e1ae
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
5 changed files with 107 additions and 44 deletions

View File

@ -2,6 +2,11 @@
# CHANGELOG
## 2024.3.18
- Add Broadcasting SMS by @Focuslinkstech
- Fix Notification with Bills
## 2024.3.16
- Fix Zero Charging

View File

@ -116,6 +116,9 @@ class Message
$textInvoice = str_replace('[[phone]]', $config['phone'], $textInvoice);
$textInvoice = str_replace('[[invoice]]', $trx['invoice'], $textInvoice);
$textInvoice = str_replace('[[date]]', Lang::dateAndTimeFormat($trx['recharged_on'], $trx['recharged_time']), $textInvoice);
if (!empty($trx['note'])) {
$textInvoice = str_replace('[[note]]', $trx['note'], $textInvoice);
}
$gc = explode("-", $trx['method']);
$textInvoice = str_replace('[[payment_gateway]]', trim($gc[0]), $textInvoice);
$textInvoice = str_replace('[[payment_channel]]', trim($gc[1]), $textInvoice);

View File

@ -37,7 +37,7 @@ class Package
// Zero cost recharge
if (isset($zero) && $zero == 1) {
$p['price'] = 0;
}else{
} else {
// Additional cost
list($bills, $add_cost) = User::getBills($id_customer);
if ($add_cost > 0 && $router_name != 'balance') {
@ -242,7 +242,7 @@ class Package
if ($p['validity_unit'] == 'Period') {
// Postpaid price from field
$add_inv = User::getAttribute("Invoice", $id_customer);
if (empty ($add_inv) or $add_inv == 0) {
if (empty($add_inv) or $add_inv == 0) {
$t->price = $p['price'] + $add_cost;
} else {
$t->price = $add_inv + $add_cost;
@ -286,7 +286,8 @@ class Package
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
"\nPrice: " . Lang::moneyFormat($p['price']));
"\nPrice: " . Lang::moneyFormat($p['price']) .
"\nNote:\n" . $note);
} else {
if ($p['is_radius']) {
Radius::customerAddPlan($c, $p, "$date_exp $time");
@ -373,7 +374,8 @@ class Package
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
"\nPrice: " . Lang::moneyFormat($p['price']));
"\nPrice: " . Lang::moneyFormat($p['price']) .
"\nNote:\n" . $note);
}
} else {
@ -436,7 +438,7 @@ class Package
if ($p['validity_unit'] == 'Period') {
// Postpaid price from field
$add_inv = User::getAttribute("Invoice", $id_customer);
if (empty ($add_inv) or $add_inv == 0) {
if (empty($add_inv) or $add_inv == 0) {
$t->price = $p['price'] + $add_cost;
} else {
$t->price = $add_inv + $add_cost;
@ -479,7 +481,8 @@ class Package
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
"\nPrice: " . Lang::moneyFormat($p['price']));
"\nPrice: " . Lang::moneyFormat($p['price']) .
"\nNote:\n" . $note);
} else {
if ($p['is_radius']) {
Radius::customerAddPlan($c, $p, "$date_exp $time");
@ -566,7 +569,8 @@ class Package
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
"\nPrice: " . Lang::moneyFormat($p['price']));
"\nPrice: " . Lang::moneyFormat($p['price']) .
"\nNote:\n" . $note);
}
}
if (is_array($bills) && count($bills) > 0) {
@ -678,9 +682,10 @@ class Package
$_admin = Admin::_info($in['admin_id']);
// if admin not deleted
if ($_admin) $admin = $_admin;
}else{
} else {
$admin['fullname'] = 'Customer';
}
$note = '';
//print
$invoice = Lang::pad($config['CompanyName'], ' ', 2) . "\n";
$invoice .= Lang::pad($config['address'], ' ', 2) . "\n";
@ -692,11 +697,26 @@ class Package
$invoice .= Lang::pad("", '=') . "\n";
$invoice .= Lang::pads(Lang::T('Type'), $in['type'], ' ') . "\n";
$invoice .= Lang::pads(Lang::T('Plan Name'), $in['plan_name'], ' ') . "\n";
$invoice .= Lang::pads(Lang::T('Plan Price'), Lang::moneyFormat($in['price']), ' ') . "\n";
$invoice .= Lang::pad($in['method'], ' ', 2) . "\n";
if(!empty($in['note'])){
if (!empty($in['note'])) {
$in['note'] = str_replace("\r", "", $in['note']);
$tmp = explode("\n", $in['note']);
foreach ($tmp as $t) {
if (strpos($t, " : ") === false) {
if (!empty($t)) {
$note .= "$t\n";
}
} else {
$tmp2 = explode(" : ", $t);
$invoice .= Lang::pads($tmp2[0], $tmp2[1], ' ') . "\n";
}
}
}
$invoice .= Lang::pads(Lang::T('Total'), Lang::moneyFormat($in['price']), ' ') . "\n";
$method = explode("-", $in['method']);
$invoice .= Lang::pads($method[0], $method[1], ' ') . "\n";
if (!empty($note)) {
$invoice .= Lang::pad("", '=') . "\n";
$invoice .= Lang::pad($in['note'], ' ', 2);
$invoice .= Lang::pad($note, ' ', 2) . "\n";
}
$invoice .= Lang::pad("", '=') . "\n";
$invoice .= Lang::pads(Lang::T('Username'), $in['username'], ' ') . "\n";
@ -720,11 +740,24 @@ class Package
$invoice .= Lang::pad("", '=') . "\n";
$invoice .= Lang::pads(Lang::T('Type'), $in['type'], ' ') . "\n";
$invoice .= Lang::pads(Lang::T('Plan Name'), $in['plan_name'], ' ') . "\n";
$invoice .= Lang::pads(Lang::T('Plan Price'), Lang::moneyFormat($in['price']), ' ') . "\n";
$invoice .= Lang::pad($in['method'], ' ', 2) . "\n";
if(!empty($in['note'])){
if (!empty($in['note'])) {
$invoice .= Lang::pad("", '=') . "\n";
$invoice .= Lang::pad($in['note'], ' ', 2);
foreach ($tmp as $t) {
if (strpos($t, " : ") === false) {
if (!empty($t)) {
$invoice .= Lang::pad($t, ' ', 2) . "\n";
}
} else {
$tmp2 = explode(" : ", $t);
$invoice .= Lang::pads($tmp2[0], $tmp2[1], ' ') . "\n";
}
}
}
$invoice .= Lang::pads(Lang::T('Total'), Lang::moneyFormat($in['price']), ' ') . "\n";
$invoice .= Lang::pads($method[0], $method[1], ' ') . "\n";
if (!empty($note)) {
$invoice .= Lang::pad("", '=') . "\n";
$invoice .= Lang::pad($note, ' ', 2) . "\n";
}
$invoice .= Lang::pad("", '=') . "\n";
$invoice .= Lang::pads(Lang::T('Username'), $in['username'], ' ') . "\n";

View File

@ -490,5 +490,27 @@
"Payment_not_found": "Payment not found",
"If_your_friend_have_Additional_Cost__you_will_pay_for_that_too": "If your friend have Additional Cost, you will pay for that too",
"Cache_cleared_successfully_": "Cache cleared successfully!",
"Paid": "Paid"
"Paid": "Paid",
"Send_Message": "Send Message",
"Send_SMS_WA_Message": "Send SMS\/WA Message",
"Send_Bulk_SMS_WA_Message": "Send Bulk SMS\/WA Message",
"Send_Personal_Message": "Send Personal Message",
"Send_Via": "Send Via",
"Compose_your_message___": "Compose your message...",
"Use_placeholders_": "Use placeholders:",
"__name__": "[[name]]",
"Customer_Name": "Customer Name",
"__user_name__": "[[user_name]]",
"Customer_Username": "Customer Username",
"__phone__": "[[phone]]",
"Customer_Phone": "Customer Phone",
"__company_name__": "[[company_name]]",
"Your_Company_Name": "Your Company Name",
"Message_Sent_Successfully": "Message Sent Successfully",
"Send_Bulk_Message": "Send Bulk Message",
"Group": "Group",
"All_Customers": "All Customers",
"New_Customers": "New Customers",
"Expired_Customers": "Expired Customers",
"Active_Customers": "Active Customers"
}

View File

@ -1,3 +1,3 @@
{
"version": "2024.3.16"
"version": "2024.3.18"
}