diff --git a/system/autoload/User.php b/system/autoload/User.php
index 5baa5988..6e6ae651 100644
--- a/system/autoload/User.php
+++ b/system/autoload/User.php
@@ -205,13 +205,14 @@ class User
->select('tbl_user_recharges.id', 'id')
->selects([
'customer_id', 'username', 'plan_id', 'namebp', 'recharged_on', 'recharged_time', 'expiration', 'time',
- 'status', 'method', 'plan_type',
+ 'status', 'method', 'plan_type', 'name_bw',
['tbl_user_recharges.routers', 'routers'],
['tbl_user_recharges.type', 'type'],
'admin_id', 'prepaid'
])
->where('customer_id', $id)
->left_outer_join('tbl_plans', array('tbl_plans.id', '=', 'tbl_user_recharges.plan_id'))
+ ->left_outer_join('tbl_bandwidth', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))
->find_many();
return $d;
}
diff --git a/system/controllers/autoload_user.php b/system/controllers/autoload_user.php
index 78c2b2ab..6e67f7c3 100644
--- a/system/controllers/autoload_user.php
+++ b/system/controllers/autoload_user.php
@@ -21,21 +21,26 @@ switch ($action) {
$p = ORM::for_table('tbl_plans')->find_one($bill['plan_id']);
$dvc = Package::getDevice($p);
if ($_app_stage != 'demo') {
- if (file_exists($dvc)) {
- require_once $dvc;
- if ((new $p['device'])->online_customer($user, $bill['routers'])) {
- die('' . Lang::T('You are Online, Logout?') . '');
- } else {
- if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
- die('' . Lang::T('Not Online, Login now?') . '');
+ try{
+ if (file_exists($dvc)) {
+ require_once $dvc;
+ if ((new $p['device'])->online_customer($user, $bill['routers'])) {
+ die('' . Lang::T('You are Online, Logout?') . '');
} else {
- die(Lang::T('-'));
+ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'])) {
+ die('' . Lang::T('Not Online, Login now?') . '');
+ } else {
+ die(Lang::T('-'));
+ }
}
+ } else {
+ die(Lang::T('-'));
}
- } else {
- new Exception(Lang::T("Devices Not Found"));
+ }catch (Exception $e) {
+ die(Lang::T('Failed to connect to device'));
}
}
+ die(Lang::T('-'));
} else {
die('--');
}
diff --git a/system/controllers/home.php b/system/controllers/home.php
index 71c7645d..621a8967 100644
--- a/system/controllers/home.php
+++ b/system/controllers/home.php
@@ -94,8 +94,35 @@ if (_post('send') == 'balance') {
}
r2(U . 'home', 'w', Lang::T('Your friend do not have active package'));
}
+$_bill = User::_billing();
+$ui->assign('_bills', $_bill);
-$ui->assign('_bills', User::_billing());
+// Sync plan to router
+if (isset($_GET['sync']) && !empty($_GET['sync'])) {
+ foreach ($_bill as $tur) {
+ $p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']);
+ if ($p) {
+ $c = ORM::for_table('tbl_customers')->findOne($tur['customer_id']);
+ if ($c) {
+ $dvc = Package::getDevice($p);
+ if ($_app_stage != 'demo') {
+ if (file_exists($dvc)) {
+ require_once $dvc;
+ (new $p['device'])->add_customer($c, $p);
+ } else {
+ new Exception(Lang::T("Devices Not Found"));
+ }
+ }
+ $log .= "DONE : $ptur[namebp], $tur[type], $tur[routers]
";
+ } else {
+ $log .= "Customer NOT FOUND : $tur[namebp], $tur[type], $tur[routers]
";
+ }
+ } else {
+ $log .= "PLAN NOT FOUND : $tur[namebp], $tur[type], $tur[routers]
";
+ }
+ }
+ r2(U . 'home', 's', $log);
+}
if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
if ($user['status'] != 'Active') {
diff --git a/system/lan/english.json b/system/lan/english.json
index 8752c2b3..78d6ae85 100644
--- a/system/lan/english.json
+++ b/system/lan/english.json
@@ -680,5 +680,6 @@
"Enter_the_session_timeout_duration__minutes_": "Enter the session timeout duration (minutes)",
"Idle_Timeout__Logout_Admin_if_Idle_for_xx_minutes": "Idle Timeout, Logout Admin if Idle for xx minutes",
"Failed_to_create_transaction__please_tell_seller_": "Failed to create transaction, please tell seller.",
- "_": "-"
+ "paid_off": "paid off",
+ "Sync_account_if_you_failed_login_to_internet": "Sync account if you failed login to internet"
}
\ No newline at end of file
diff --git a/ui/ui/sections/user-footer.tpl b/ui/ui/sections/user-footer.tpl
index 12c1e3cb..a48dc5f8 100644
--- a/ui/ui/sections/user-footer.tpl
+++ b/ui/ui/sections/user-footer.tpl
@@ -103,7 +103,9 @@
});
}
}
-
+ $(function() {
+ $('[data-toggle="tooltip"]').tooltip()
+ })
});
});