if expired plan deleted, go delete customer when expired

This commit is contained in:
Ibnu Maksum 2024-08-06 10:03:49 +07:00
parent 95899b4eba
commit 2a7563f43d
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
3 changed files with 16 additions and 12 deletions

View File

@ -44,10 +44,11 @@ class MikrotikHotspot
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); $client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
if (!empty($plan['plan_expired'])) { if (!empty($plan['plan_expired'])) {
$p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']); $p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']);
$this->add_customer($customer, $p); if($p){
} else { $this->add_customer($customer, $p);
$this->removeHotspotUser($client, $customer['username']); }
} }
$this->removeHotspotUser($client, $customer['username']);
$this->removeHotspotActiveUser($client, $customer['username']); $this->removeHotspotActiveUser($client, $customer['username']);
} }

View File

@ -71,13 +71,15 @@ class MikrotikPppoe
$client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); $client = $this->getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
if (!empty($plan['plan_expired'])) { if (!empty($plan['plan_expired'])) {
$p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']); $p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']);
$this->add_customer($customer, $p); if($p){
} else { $this->add_customer($customer, $p);
$this->removePpoeUser($client, $customer['username']); return;
if (!empty($customer['pppoe_username'])) {
$this->removePpoeUser($client, $customer['pppoe_username']);
} }
} }
$this->removePpoeUser($client, $customer['username']);
if (!empty($customer['pppoe_username'])) {
$this->removePpoeUser($client, $customer['pppoe_username']);
}
$this->removePpoeActive($client, $customer['username']); $this->removePpoeActive($client, $customer['username']);
if (!empty($customer['pppoe_username'])) { if (!empty($customer['pppoe_username'])) {
$this->removePpoeActive($client, $customer['pppoe_username']); $this->removePpoeActive($client, $customer['pppoe_username']);

View File

@ -85,10 +85,11 @@ class Radius
{ {
if (!empty($plan['plan_expired'])) { if (!empty($plan['plan_expired'])) {
$p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']); $p = ORM::for_table("tbl_plans")->find_one($plan['plan_expired']);
$this->customerAddPlan($customer, $p); if ($p) {
} else { $this->customerAddPlan($customer, $p);
$this->customerDeactivate($customer['username'], true); }
} }
$this->customerDeactivate($customer['username'], true);
} }
public function change_username($from, $to) public function change_username($from, $to)
@ -469,7 +470,7 @@ class Radius
$unitdown = ($bw['rate_down_unit'] == 'Kbps') ? 'K' : 'M'; $unitdown = ($bw['rate_down_unit'] == 'Kbps') ? 'K' : 'M';
$unitup = ($bw['rate_up_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']))) { if (!empty(trim($bw['burst']))) {
// burst format: 2M/1M 256K/128K 128K/64K 1s 1 64K/32K // burst format: 2M/1M 256K/128K 128K/64K 1s 1 64K/32K