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
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"));
if($tur['status'] == 'on'){
$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]<br>";
} else {
$log .= "Customer NOT FOUND : $tur[namebp], $tur[type], $tur[routers]<br>";
}
$log .= "DONE : $ptur[namebp], $tur[type], $tur[routers]<br>";
} 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);

View file

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