diff --git a/system/controllers/customers.php b/system/controllers/customers.php index ae01655b..14d7b0d6 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -213,11 +213,12 @@ switch ($action) { $p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->find_one(); if ($p) { $p = ORM::for_table('tbl_plans')->where('id', $c['plan_id'])->find_one(); + $c = User::_info($id_customer); $dvc = Package::getDevice($p); if ($_app_stage != 'demo') { if (file_exists($dvc)) { require_once $dvc; - (new $p['device'])->change_customer($c, $p); + (new $p['device'])->remove_customer($c, $p); } else { new Exception(Lang::T("Devices Not Found")); } @@ -240,7 +241,7 @@ switch ($action) { $routers = []; foreach ($bs as $b) { $c = ORM::for_table('tbl_customers')->find_one($id_customer); - $p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->where('enabled', '1')->find_one(); + $p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->find_one(); if ($p) { $routers[] = $b['routers']; $dvc = Package::getDevice($p); @@ -325,33 +326,33 @@ switch ($action) { } $id = $routes['2']; run_hook('delete_customer'); #HOOK - $d = ORM::for_table('tbl_customers')->find_one($id); - if ($d) { + $c = ORM::for_table('tbl_customers')->find_one($id); + if ($c) { // Delete the associated Customers Attributes records from tbl_customer_custom_fields table ORM::for_table('tbl_customers_fields')->where('customer_id', $id)->delete_many(); - $c = ORM::for_table('tbl_user_recharges')->where('username', $d['username'])->find_one(); - if ($c) { - $p = ORM::for_table('tbl_plans')->find_one($c['plan_id']); + //Delete active package + $turs = ORM::for_table('tbl_user_recharges')->where('username', $c['username'])->find_one(); + foreach($turs as $tur){ + $p = ORM::for_table('tbl_plans')->find_one($tur['plan_id']); if ($p) { $dvc = Package::getDevice($p); if ($_app_stage != 'demo') { if (file_exists($dvc)) { require_once $dvc; - (new $p['device'])->remove_customer($d, $p); + (new $p['device'])->remove_customer($c, $p); } else { new Exception(Lang::T("Devices Not Found")); } } } try { - $c->delete(); + $tur->delete(); } catch (Exception $e) { } } try { - $d->delete(); + $c->delete(); } catch (Exception $e) { - } catch (Throwable $e) { } r2(U . 'customers/list', 's', Lang::T('User deleted Successfully')); } diff --git a/system/controllers/plan.php b/system/controllers/plan.php index 27b25e06..aacf1c77 100644 --- a/system/controllers/plan.php +++ b/system/controllers/plan.php @@ -269,6 +269,7 @@ switch ($action) { if ($d) { run_hook('delete_customer_active_plan'); #HOOK $p = ORM::for_table('tbl_plans')->find_one($d['plan_id']); + $c = User::_info($d['customer_id']); $dvc = Package::getDevice($p); if ($_app_stage != 'demo') { if (file_exists($dvc)) { diff --git a/system/controllers/services.php b/system/controllers/services.php index f2307fff..32a0b46a 100644 --- a/system/controllers/services.php +++ b/system/controllers/services.php @@ -135,7 +135,7 @@ switch ($action) { if ($_app_stage != 'demo') { if (file_exists($dvc)) { require_once $dvc; - (new $p['device'])->remove_plan($d); + (new $d['device'])->remove_plan($d); } else { new Exception(Lang::T("Devices Not Found")); } @@ -222,7 +222,7 @@ switch ($action) { } $d->expired_date = $expired_date; } else { - $d->expired_date = 0; + $d->expired_date = 20; } $d->save(); @@ -230,7 +230,7 @@ switch ($action) { if ($_app_stage != 'demo') { if (file_exists($dvc)) { require_once $dvc; - (new $p['device'])->add_plan($d); + (new $d['device'])->add_plan($d); } else { new Exception(Lang::T("Devices Not Found")); } @@ -324,7 +324,7 @@ switch ($action) { } $d->expired_date = $expired_date; } else { - $d->expired_date = 0; + $d->expired_date = 20; } $d->save(); @@ -437,7 +437,7 @@ switch ($action) { if ($_app_stage != 'demo') { if (file_exists($dvc)) { require_once $dvc; - (new $p['device'])->remove_plan($d); + (new $d['device'])->remove_plan($d); } else { new Exception(Lang::T("Devices Not Found")); } @@ -537,7 +537,7 @@ switch ($action) { if ($_app_stage != 'demo') { if (file_exists($dvc)) { require_once $dvc; - (new $p['device'])->add_plan($d); + (new $d['device'])->add_plan($d); } else { new Exception(Lang::T("Devices Not Found")); } diff --git a/ui/ui/hotspot-add.tpl b/ui/ui/hotspot-add.tpl index 43406e80..dbf9cd3f 100644 --- a/ui/ui/hotspot-add.tpl +++ b/ui/ui/hotspot-add.tpl @@ -45,7 +45,7 @@
- -