diff --git a/system/devices/MikrotikHotspot.php b/system/devices/MikrotikHotspot.php index 726d6b00..c10461bf 100644 --- a/system/devices/MikrotikHotspot.php +++ b/system/devices/MikrotikHotspot.php @@ -44,10 +44,11 @@ class MikrotikHotspot $client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); if (!empty($plan['plan_expired'])) { $p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']); - $this->add_customer($customer, $p); - } else { - $this->removeHotspotUser($client, $customer['username']); + if($p){ + $this->add_customer($customer, $p); + } } + $this->removeHotspotUser($client, $customer['username']); $this->removeHotspotActiveUser($client, $customer['username']); } diff --git a/system/devices/MikrotikPppoe.php b/system/devices/MikrotikPppoe.php index df55ee8e..79a46f0f 100644 --- a/system/devices/MikrotikPppoe.php +++ b/system/devices/MikrotikPppoe.php @@ -71,13 +71,15 @@ class MikrotikPppoe $client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); if (!empty($plan['plan_expired'])) { $p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']); - $this->add_customer($customer, $p); - } else { - $this->removePpoeUser($client, $customer['username']); - if (!empty($customer['pppoe_username'])) { - $this->removePpoeUser($client, $customer['pppoe_username']); + if($p){ + $this->add_customer($customer, $p); + return; } } + $this->removePpoeUser($client, $customer['username']); + if (!empty($customer['pppoe_username'])) { + $this->removePpoeUser($client, $customer['pppoe_username']); + } $this->removePpoeActive($client, $customer['username']); if (!empty($customer['pppoe_username'])) { $this->removePpoeActive($client, $customer['pppoe_username']); diff --git a/system/devices/Radius.php b/system/devices/Radius.php index 46cc2f31..0fa404a2 100644 --- a/system/devices/Radius.php +++ b/system/devices/Radius.php @@ -85,10 +85,11 @@ class Radius { if (!empty($plan['plan_expired'])) { $p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']); - $this->customerAddPlan($customer, $p); - } else { - $this->customerDeactivate($customer['username'], true); + if ($p) { + $this->customerAddPlan($customer, $p); + } } + $this->customerDeactivate($customer['username'], true); } public function change_username($from, $to) @@ -469,7 +470,7 @@ class Radius $unitdown = ($bw['rate_down_unit'] == 'Kbps') ? 'K' : 'M'; $unitup = ($bw['rate_up_unit'] == 'Kbps') ? 'K' : 'M'; - // TODO Burst mode [ 2M/1M 256K/128K 128K/64K 1s 1 64K/32K] + // TODO Burst mode [ 2M/1M 256K/128K 128K/64K 1s 1 64K/32K] if (!empty(trim($bw['burst']))) { // burst format: 2M/1M 256K/128K 128K/64K 1s 1 64K/32K