From aac8306d7b3a9521a659777a42029689e1660bde Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Thu, 1 Aug 2024 10:12:54 +0700 Subject: [PATCH] disconnect PPPOE when plan change --- system/devices/MikrotikPppoe.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/system/devices/MikrotikPppoe.php b/system/devices/MikrotikPppoe.php index 70c55152..d7cc99f8 100644 --- a/system/devices/MikrotikPppoe.php +++ b/system/devices/MikrotikPppoe.php @@ -29,6 +29,7 @@ class MikrotikPppoe function add_customer($customer, $plan) { + global $isChangePlan; $mikrotik = $this->info($plan['routers']); $client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); //check if customer exists @@ -51,7 +52,9 @@ class MikrotikPppoe $setRequest->setArgument('password', $pass); $client->sendSync($setRequest); //disconnect then - //$this->removePpoeActive($client, $customer['username']); + if(isset($isChangePlan) && $isChangePlan){ + $this->removePpoeActive($client, $customer['username']); + } } }