From 7a95d793154fc62a2fdff4e92e565213ef577dd0 Mon Sep 17 00:00:00 2001
From: Ibnu Maksum <ibnumaksum@gmail.com>
Date: Tue, 6 Aug 2024 09:21:19 +0700
Subject: [PATCH] remove customer check pppoe_username

---
 system/devices/MikrotikPppoe.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/system/devices/MikrotikPppoe.php b/system/devices/MikrotikPppoe.php
index 486b85ce..df55ee8e 100644
--- a/system/devices/MikrotikPppoe.php
+++ b/system/devices/MikrotikPppoe.php
@@ -51,6 +51,8 @@ class MikrotikPppoe
             }
             if (!empty($customer['pppoe_ip'])) {
                 $setRequest->setArgument('local-address', $customer['pppoe_ip']);
+            }else{
+                $setRequest->setArgument('local-address', null);
             }
             $setRequest->setArgument('profile', $plan['name_plan']);
             $setRequest->setArgument('comment', $customer['fullname'] . ' | ' . $customer['email'] . ' | ' . implode(', ', User::getBillNames($customer['id'])));
@@ -72,8 +74,14 @@ class MikrotikPppoe
             $this->add_customer($customer, $p);
         } else {
             $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']);
+        }
     }
 
     // customer change username