fix wrong variable

This commit is contained in:
Ibnu Maksum 2024-06-21 09:44:49 +07:00
parent 628fcda360
commit d11b2a75ef
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
7 changed files with 29 additions and 25 deletions

View File

@ -213,11 +213,12 @@ switch ($action) {
$p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->find_one();
if ($p) {
$p = ORM::for_table('tbl_plans')->where('id', $c['plan_id'])->find_one();
$c = User::_info($id_customer);
$dvc = Package::getDevice($p);
if ($_app_stage != 'demo') {
if (file_exists($dvc)) {
require_once $dvc;
(new $p['device'])->change_customer($c, $p);
(new $p['device'])->remove_customer($c, $p);
} else {
new Exception(Lang::T("Devices Not Found"));
}
@ -240,7 +241,7 @@ switch ($action) {
$routers = [];
foreach ($bs as $b) {
$c = ORM::for_table('tbl_customers')->find_one($id_customer);
$p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->where('enabled', '1')->find_one();
$p = ORM::for_table('tbl_plans')->where('id', $b['plan_id'])->find_one();
if ($p) {
$routers[] = $b['routers'];
$dvc = Package::getDevice($p);
@ -325,33 +326,33 @@ switch ($action) {
}
$id = $routes['2'];
run_hook('delete_customer'); #HOOK
$d = ORM::for_table('tbl_customers')->find_one($id);
if ($d) {
$c = ORM::for_table('tbl_customers')->find_one($id);
if ($c) {
// Delete the associated Customers Attributes records from tbl_customer_custom_fields table
ORM::for_table('tbl_customers_fields')->where('customer_id', $id)->delete_many();
$c = ORM::for_table('tbl_user_recharges')->where('username', $d['username'])->find_one();
if ($c) {
$p = ORM::for_table('tbl_plans')->find_one($c['plan_id']);
//Delete active package
$turs = ORM::for_table('tbl_user_recharges')->where('username', $c['username'])->find_one();
foreach($turs as $tur){
$p = ORM::for_table('tbl_plans')->find_one($tur['plan_id']);
if ($p) {
$dvc = Package::getDevice($p);
if ($_app_stage != 'demo') {
if (file_exists($dvc)) {
require_once $dvc;
(new $p['device'])->remove_customer($d, $p);
(new $p['device'])->remove_customer($c, $p);
} else {
new Exception(Lang::T("Devices Not Found"));
}
}
}
try {
$c->delete();
$tur->delete();
} catch (Exception $e) {
}
}
try {
$d->delete();
$c->delete();
} catch (Exception $e) {
} catch (Throwable $e) {
}
r2(U . 'customers/list', 's', Lang::T('User deleted Successfully'));
}

View File

@ -269,6 +269,7 @@ switch ($action) {
if ($d) {
run_hook('delete_customer_active_plan'); #HOOK
$p = ORM::for_table('tbl_plans')->find_one($d['plan_id']);
$c = User::_info($d['customer_id']);
$dvc = Package::getDevice($p);
if ($_app_stage != 'demo') {
if (file_exists($dvc)) {

View File

@ -135,7 +135,7 @@ switch ($action) {
if ($_app_stage != 'demo') {
if (file_exists($dvc)) {
require_once $dvc;
(new $p['device'])->remove_plan($d);
(new $d['device'])->remove_plan($d);
} else {
new Exception(Lang::T("Devices Not Found"));
}
@ -222,7 +222,7 @@ switch ($action) {
}
$d->expired_date = $expired_date;
} else {
$d->expired_date = 0;
$d->expired_date = 20;
}
$d->save();
@ -230,7 +230,7 @@ switch ($action) {
if ($_app_stage != 'demo') {
if (file_exists($dvc)) {
require_once $dvc;
(new $p['device'])->add_plan($d);
(new $d['device'])->add_plan($d);
} else {
new Exception(Lang::T("Devices Not Found"));
}
@ -324,7 +324,7 @@ switch ($action) {
}
$d->expired_date = $expired_date;
} else {
$d->expired_date = 0;
$d->expired_date = 20;
}
$d->save();
@ -437,7 +437,7 @@ switch ($action) {
if ($_app_stage != 'demo') {
if (file_exists($dvc)) {
require_once $dvc;
(new $p['device'])->remove_plan($d);
(new $d['device'])->remove_plan($d);
} else {
new Exception(Lang::T("Devices Not Found"));
}
@ -537,7 +537,7 @@ switch ($action) {
if ($_app_stage != 'demo') {
if (file_exists($dvc)) {
require_once $dvc;
(new $p['device'])->add_plan($d);
(new $d['device'])->add_plan($d);
} else {
new Exception(Lang::T("Devices Not Found"));
}

View File

@ -45,7 +45,7 @@
<label class="col-md-2 control-label">Radius
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="If you enable Radius, choose device to radius, except if you have custome device">?</a>
data-content="If you enable Radius, choose device to radius, except if you have custom device. *This option will be deleted and replaced by Device">?</a>
</label>
<div class="col-md-6">
<label class="radio-inline">

View File

@ -51,7 +51,7 @@
<label class="col-md-2 control-label">Radius
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="If you enable Radius, choose device to radius, except if you have custome device">?</a>
data-content="If you enable Radius, choose device to radius, except if you have custom device. *This option will be deleted and replaced by Device">?</a>
</label>
<div class="col-md-10">
<label class="label label-primary">RADIUS</label>
@ -102,7 +102,7 @@
</div>
</div>
</div>
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;"
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;"
{elseif ($d['time_limit']) eq '0'}
style="display:none;" {/if} id="TimeLimit">
<div class="form-group">
@ -121,7 +121,7 @@
</div>
</div>
</div>
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;"
<div {if $d['typebp'] eq 'Unlimited'} style="display:none;"
{elseif ($d['data_limit']) eq '0'}
style="display:none;" {/if} id="DataLimit">
<div class="form-group">
@ -214,7 +214,8 @@
</label>
<div class="col-md-6">
<input type="number" class="form-control" name="expired_date" maxlength="2"
value="{$d['expired_date']}" min="1" max="28" step="1">
value="{if $d['expired_date']}{$d['expired_date']}{else}20{/if}" min="1" max="28"
step="1">
</div>
</div>
<span id="routerChoose" class="{if $d['is_radius']}hidden{/if}">

View File

@ -44,7 +44,7 @@
<label class="col-md-2 control-label">Radius
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="If you enable Radius, choose device to radius, except if you have custome device">?</a>
data-content="If you enable Radius, choose device to radius, except if you have custom device. *This option will be deleted and replaced by Device">?</a>
</label>
<div class="col-md-6">
<input type="checkbox" name="radius" onclick="isRadius(this)" value="1"> Radius Plan

View File

@ -51,7 +51,7 @@
<label class="col-md-2 control-label">Radius
<a tabindex="0" class="btn btn-link btn-xs" role="button" data-toggle="popover"
data-trigger="focus" data-container="body"
data-content="If you enable Radius, choose device to radius, except if you have custome device">?</a>
data-content="If you enable Radius, choose device to radius, except if you have custom device. *This option will be deleted and replaced by Device">?</a>
</label>
<div class="col-md-10">
<label class="label label-primary">RADIUS</label>
@ -144,7 +144,8 @@
</label>
<div class="col-md-6">
<input type="number" class="form-control" name="expired_date" maxlength="2"
value="{$d['expired_date']}" min="1" max="28" step="1">
value="{if $d['expired_date']}{$d['expired_date']}{else}20{/if}" min="1" max="28"
step="1">
</div>
</div>
<div class="form-group">