Fix sync Bug

This commit is contained in:
iBNu Maksum 2024-08-01 20:21:58 +07:00 committed by GitHub
parent b64e841bde
commit ed4bd4861a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 16 deletions

View File

@ -100,25 +100,27 @@ $ui->assign('_bills', $_bill);
// Sync plan to router // Sync plan to router
if (isset($_GET['sync']) && !empty($_GET['sync'])) { if (isset($_GET['sync']) && !empty($_GET['sync'])) {
foreach ($_bill as $tur) { foreach ($_bill as $tur) {
$p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']); if($tur['status'] == 'on'){
if ($p) { $p = ORM::for_table('tbl_plans')->findOne($tur['plan_id']);
$c = ORM::for_table('tbl_customers')->findOne($tur['customer_id']); if ($p) {
if ($c) { $c = ORM::for_table('tbl_customers')->findOne($tur['customer_id']);
$dvc = Package::getDevice($p); if ($c) {
if ($_app_stage != 'demo') { $dvc = Package::getDevice($p);
if (file_exists($dvc)) { if ($_app_stage != 'demo') {
require_once $dvc; if (file_exists($dvc)) {
(new $p['device'])->add_customer($c, $p); require_once $dvc;
} else { (new $p['device'])->add_customer($c, $p);
new Exception(Lang::T("Devices Not Found")); } else {
new Exception(Lang::T("Devices Not Found"));
}
} }
$log .= "DONE : $ptur[namebp], $tur[type], $tur[routers]<br>";
} else {
$log .= "Customer NOT FOUND : $tur[namebp], $tur[type], $tur[routers]<br>";
} }
$log .= "DONE : $ptur[namebp], $tur[type], $tur[routers]<br>";
} else { } else {
$log .= "Customer NOT FOUND : $tur[namebp], $tur[type], $tur[routers]<br>"; $log .= "PLAN NOT FOUND : $tur[namebp], $tur[type], $tur[routers]<br>";
} }
} else {
$log .= "PLAN NOT FOUND : $tur[namebp], $tur[type], $tur[routers]<br>";
} }
} }
r2(U . 'home', 's', $log); r2(U . 'home', 's', $log);

View File

@ -1,3 +1,3 @@
{ {
"version": "2024.8.1.1" "version": "2024.8.1.2"
} }