From 85ede07d77153784cba739f64f38566a638fdd4a Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Fri, 9 Aug 2024 14:41:06 +0700 Subject: [PATCH] Zero datausage if expired --- system/devices/RadiusRest.php | 9 +++++++++ version.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/system/devices/RadiusRest.php b/system/devices/RadiusRest.php index 5e3fb95b..51f9f236 100644 --- a/system/devices/RadiusRest.php +++ b/system/devices/RadiusRest.php @@ -25,6 +25,15 @@ class RadiusRest { // Remove Customer to Mikrotik/Device function remove_customer($customer, $plan) { + // set zero data usage + if ($plan['typebp'] == "Limited" && ($plan['limit_type'] == "Data_Limit" || $plan['limit_type'] == "Both_Limit")) { + $cs = ORM::for_table("rad_acct")->where('username', $customer['username'])->findMany(); + foreach ($cs as $c) { + $c->acctOutputOctets = 0; + $c->acctInputOctets = 0; + $c->save(); + } + } } // customer change username diff --git a/version.json b/version.json index 17790164..99ed93d9 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2024.8.8" + "version": "2024.8.9" } \ No newline at end of file