diff --git a/CHANGELOG.md b/CHANGELOG.md index 8999f2d1..e4773966 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ # CHANGELOG +## 2024.3.18 + +- Add Broadcasting SMS by @Focuslinkstech +- Fix Notification with Bills + ## 2024.3.16 - Fix Zero Charging diff --git a/system/autoload/Message.php b/system/autoload/Message.php index 0dc75027..7e90176f 100644 --- a/system/autoload/Message.php +++ b/system/autoload/Message.php @@ -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); diff --git a/system/autoload/Package.php b/system/autoload/Package.php index 80a40498..cab18ed2 100644 --- a/system/autoload/Package.php +++ b/system/autoload/Package.php @@ -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') { @@ -240,13 +240,13 @@ class Package $t->username = $c['username']; $t->plan_name = $p['name_plan']; if ($p['validity_unit'] == 'Period') { - // Postpaid price from field - $add_inv = User::getAttribute("Invoice", $id_customer); - if (empty ($add_inv) or $add_inv == 0) { - $t->price = $p['price'] + $add_cost; - } else { - $t->price = $add_inv + $add_cost; - } + // Postpaid price from field + $add_inv = User::getAttribute("Invoice", $id_customer); + if (empty($add_inv) or $add_inv == 0) { + $t->price = $p['price'] + $add_cost; + } else { + $t->price = $add_inv + $add_cost; + } } else { $t->price = $p['price'] + $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"); @@ -323,7 +324,7 @@ class Package $t->username = $c['username']; $t->plan_name = $p['name_plan']; if ($p['validity_unit'] == 'Period') { - // Postpaid price always zero for first time + // Postpaid price always zero for first time $t->price = 0 + $add_cost; } else { $t->price = $p['price'] + $add_cost; @@ -350,12 +351,12 @@ class Package $fl = ORM::for_table('tbl_customers_fields')->create(); $fl->customer_id = $c['id']; $fl->field_name = 'Invoice'; - // Calculating Price - $sd = new DateTime("$date_only"); - $ed = new DateTime("$date_exp"); - $td = $ed->diff($sd); - $fd = $td->format("%a"); - $gi = ($p['price'] / 30) * $fd; + // Calculating Price + $sd = new DateTime("$date_only"); + $ed = new DateTime("$date_exp"); + $td = $ed->diff($sd); + $fd = $td->format("%a"); + $gi = ($p['price'] / 30) * $fd; if ($gi > $p['price']) { $fl->field_value = $p['price']; } else { @@ -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 { @@ -434,13 +436,13 @@ class Package $t->username = $c['username']; $t->plan_name = $p['name_plan']; if ($p['validity_unit'] == 'Period') { - // Postpaid price from field - $add_inv = User::getAttribute("Invoice", $id_customer); - if (empty ($add_inv) or $add_inv == 0) { - $t->price = $p['price'] + $add_cost; - } else { - $t->price = $add_inv + $add_cost; - } + // Postpaid price from field + $add_inv = User::getAttribute("Invoice", $id_customer); + if (empty($add_inv) or $add_inv == 0) { + $t->price = $p['price'] + $add_cost; + } else { + $t->price = $add_inv + $add_cost; + } } else { $t->price = $p['price'] + $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"); @@ -516,7 +519,7 @@ class Package $t->username = $c['username']; $t->plan_name = $p['name_plan']; if ($p['validity_unit'] == 'Period') { - // Postpaid price always zero for first time + // Postpaid price always zero for first time $t->price = 0 + $add_cost; } else { $t->price = $p['price'] + $add_cost; @@ -543,12 +546,12 @@ class Package $fl = ORM::for_table('tbl_customers_fields')->create(); $fl->customer_id = $c['id']; $fl->field_name = 'Invoice'; - // Calculating Price - $sd = new DateTime("$date_only"); - $ed = new DateTime("$date_exp"); - $td = $ed->diff($sd); - $fd = $td->format("%a"); - $gi = ($p['price'] / 30) * $fd; + // Calculating Price + $sd = new DateTime("$date_only"); + $ed = new DateTime("$date_exp"); + $td = $ed->diff($sd); + $fd = $td->format("%a"); + $gi = ($p['price'] / 30) * $fd; if ($gi > $p['price']) { $fl->field_value = $p['price']; } else { @@ -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"; diff --git a/system/lan/english.json b/system/lan/english.json index 7d222e63..32193876 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -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" } \ No newline at end of file diff --git a/version.json b/version.json index 5a6a9b1f..3cc2ecff 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2024.3.16" + "version": "2024.3.18" } \ No newline at end of file