diff --git a/install/phpnuxbill.sql b/install/phpnuxbill.sql
index 5f4bd014..1e5ea998 100644
--- a/install/phpnuxbill.sql
+++ b/install/phpnuxbill.sql
@@ -91,7 +91,7 @@ CREATE TABLE `tbl_plans` (
`data_limit` int(10) UNSIGNED DEFAULT NULL,
`data_unit` enum('MB','GB') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
`validity` int(10) NOT NULL,
- `validity_unit` enum('Mins','Hrs','Days','Months') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
+ `validity_unit` enum('Mins','Hrs','Days','Months','Period') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`shared_users` int(10) DEFAULT NULL,
`routers` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`is_radius` tinyint(1) NOT NULL DEFAULT '0' COMMENT '1 is radius',
diff --git a/pages_template/Announcement_Users.html.html b/pages_template/Announcement_Users.html.html
new file mode 100644
index 00000000..3f0a6c99
--- /dev/null
+++ b/pages_template/Announcement_Users.html.html
@@ -0,0 +1 @@
+Pengumuman!!
Besok libur
Announcement!!
Tomorrow holiday
\ No newline at end of file
diff --git a/system/autoload/Package.php b/system/autoload/Package.php
index 7dab432e..693e5faa 100644
--- a/system/autoload/Package.php
+++ b/system/autoload/Package.php
@@ -100,6 +100,18 @@ class Package
$mikrotik = Mikrotik::info($router_name);
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' month'));
+ } else if ($p['validity_unit'] == 'Period') {
+ $date_tmp = date("Y-m-20", strtotime('+' . $p['validity'] . ' month'));
+ $dt1 = new DateTime("$date_only");
+ $dt2 = new DateTime("$date_tmp");
+ $diff = $dt2->diff($dt1);
+ $sum = $diff->format("%a");// => 453
+ if ($sum >= 35) {
+ $date_exp = date("Y-m-20", strtotime('+0 month'));
+ } else {
+ $date_exp = date("Y-m-20", strtotime('+' . $p['validity'] . ' month'));
+ };
+ $time = date("23:59:00");
} else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' day'));
} else if ($p['validity_unit'] == 'Hrs') {
@@ -119,6 +131,9 @@ class Package
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = $b['time'];
+ } else if ($p['validity_unit'] == 'Period') {
+ $date_exp = date("Y-m-20", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
+ $time = date("23:59:00");
} else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
$time = $b['time'];
@@ -180,6 +195,12 @@ class Package
$t->admin_id = '0';
}
$t->save();
+
+ Message::sendTelegram("#u$c[username] #recharge #Hotspot \n" . $p['name_plan'] .
+ "\nRouter: " . $router_name .
+ "\nGateway: " . $gateway .
+ "\nChannel: " . $channel .
+ "\nPrice: " . Lang::moneyFormat($p['price']));
} else {
if ($p['is_radius']) {
Radius::customerAddPlan($c, $p, "$date_exp $time");
@@ -229,12 +250,14 @@ class Package
$t->admin_id = '0';
}
$t->save();
- }
- Message::sendTelegram("#u$c[username] #buy #Hotspot \n" . $p['name_plan'] .
+
+ Message::sendTelegram("#u$c[username] #buy #Hotspot \n" . $p['name_plan'] .
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
"\nPrice: " . Lang::moneyFormat($p['price']));
+ }
+
} else {
if ($b) {
@@ -243,6 +266,9 @@ class Package
if ($p['validity_unit'] == 'Months') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
$time = $b['time'];
+ } else if ($p['validity_unit'] == 'Period') {
+ $date_exp = date("Y-m-20", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
+ $time = date("23:59:00");
} else if ($p['validity_unit'] == 'Days') {
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
$time = $b['time'];
@@ -304,6 +330,12 @@ class Package
$t->admin_id = '0';
}
$t->save();
+
+ Message::sendTelegram("#u$c[username] #recharge #PPPOE \n" . $p['name_plan'] .
+ "\nRouter: " . $router_name .
+ "\nGateway: " . $gateway .
+ "\nChannel: " . $channel .
+ "\nPrice: " . Lang::moneyFormat($p['price']));
} else {
if ($p['is_radius']) {
Radius::customerAddPlan($c, $p, "$date_exp $time");
@@ -353,12 +385,14 @@ class Package
}
$t->type = "PPPOE";
$t->save();
- }
- Message::sendTelegram("#u$c[username] #buy #PPPOE \n" . $p['name_plan'] .
+
+ Message::sendTelegram("#u$c[username] #buy #PPPOE \n" . $p['name_plan'] .
"\nRouter: " . $router_name .
"\nGateway: " . $gateway .
"\nChannel: " . $channel .
"\nPrice: " . Lang::moneyFormat($p['price']));
+ }
+
}
run_hook("recharge_user_finish");
Message::sendInvoice($c, $t);
diff --git a/system/updates.json b/system/updates.json
index e5ecdff6..237741ae 100644
--- a/system/updates.json
+++ b/system/updates.json
@@ -68,6 +68,7 @@
],
"2024.2.23" : [
"ALTER TABLE `tbl_transactions` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`;",
- "ALTER TABLE `tbl_user_recharges` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`;"
+ "ALTER TABLE `tbl_user_recharges` ADD `admin_id` INT NOT NULL DEFAULT '1' AFTER `type`;",
+ "ALTER TABLE `tbl_plans` CHANGE `validity_unit` `validity_unit` ENUM('Mins','Hrs','Days','Months','Period') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;"
]
}
\ No newline at end of file
diff --git a/ui/ui/pppoe-add.tpl b/ui/ui/pppoe-add.tpl
index 4f0093ae..98b308dc 100644
--- a/ui/ui/pppoe-add.tpl
+++ b/ui/ui/pppoe-add.tpl
@@ -60,6 +60,7 @@
{Lang::T('1 Period = 1 Month, Expires the 20th of each month')}
{Lang::T('1 Period = 30 Month, Expires the 20th of each month')}