From 3a2c55e0d87fcfd9e0b45f7fb3455eae74c9d5ac Mon Sep 17 00:00:00 2001 From: gerandonk Date: Mon, 23 Sep 2024 20:25:48 +0700 Subject: [PATCH] if exist remote ip on pppoe, it will reset on expired fix bugs expired user not going expired pool if remote-ip exist --- system/devices/MikrotikPppoe.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/system/devices/MikrotikPppoe.php b/system/devices/MikrotikPppoe.php index 71ac800a..9929bcba 100644 --- a/system/devices/MikrotikPppoe.php +++ b/system/devices/MikrotikPppoe.php @@ -33,6 +33,7 @@ class MikrotikPppoe $mikrotik = $this->info($plan['routers']); $client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); $cid = self::getIdByCustomer($customer, $client); + $exp = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']); if (empty($cid)) { //customer not exists, add it $this->addPpoeUser($client, $plan, $customer); @@ -49,11 +50,13 @@ class MikrotikPppoe } else { $setRequest->setArgument('name', $customer['username']); } - if (!empty($customer['pppoe_ip'])) { - $setRequest->setArgument('remote-address', $customer['pppoe_ip']); - }else{ + if ($exp == 0) { $setRequest->setArgument('remote-address', '0.0.0.0'); - } + } else if (!empty($customer['pppoe_ip'])){ + $setRequest->setArgument('remote-address', $customer['pppoe_ip']); + } else { + $setRequest->setArgument('remote-address', '0.0.0.0'); + } $setRequest->setArgument('profile', $plan['name_plan']); $setRequest->setArgument('comment', $customer['fullname'] . ' | ' . $customer['email'] . ' | ' . implode(', ', User::getBillNames($customer['id']))); $client->sendSync($setRequest);