Add Yellow line for plan not allowed to purchase

This commit is contained in:
Ibnu Maksum
2024-01-16 09:00:56 +07:00
parent 5867a0c9ca
commit 470c219e61
7 changed files with 35 additions and 3 deletions

View File

@ -96,6 +96,12 @@ if (isset($_GET['recharge']) && !empty($_GET['recharge'])) {
$router = ORM::for_table('tbl_routers')->where('name', $bill['routers'])->find_one();
if ($config['enable_balance'] == 'yes') {
$plan = ORM::for_table('tbl_plans')->find_one($bill['plan_id']);
if(!$plan['enabled']){
r2(U . "home", 'e', 'Plan is not exists');
}
if($plan['allow_purchase'] != 'yes'){
r2(U . "home", 'e', 'Cannot recharge this plan');
}
if ($user['balance'] > $plan['price']) {
r2(U . "order/pay/$router[id]/$bill[plan_id]", 'e', 'Order Plan');
} else {

View File

@ -149,6 +149,12 @@ switch ($action) {
if (empty($plan)) {
r2(U . "order/package", 'e', Lang::T("Plan Not found"));
}
if(!$plan['enabled']){
r2(U . "home", 'e', 'Plan is not exists');
}
if($plan['allow_purchase'] != 'yes'){
r2(U . "home", 'e', 'Cannot recharge this plan');
}
if ($routes['2'] == 'radius') {
$router_name = 'radius';
} else {
@ -166,7 +172,7 @@ switch ($action) {
"\nPrice: " . $p['price']);
}
} else {
echo "no renewall | plan enabled: $p[enabled] | User balance: $c[balance] | price $p[price]\n";
r2(U . "home", 'e', 'Plan is not exists');
}
break;
case 'send':
@ -179,6 +185,12 @@ switch ($action) {
if (empty($plan)) {
r2(U . "order/package", 'e', Lang::T("Plan Not found"));
}
if(!$plan['enabled']){
r2(U . "home", 'e', 'Plan is not exists');
}
if($plan['allow_purchase'] != 'yes'){
r2(U . "home", 'e', 'Cannot recharge this plan');
}
if ($routes['2'] == 'radius') {
$router_name = 'radius';
} else {

View File

@ -68,6 +68,8 @@ switch ($action) {
Mikrotik::removePool($client, $d['pool_name']);
} catch (Exception $e) {
//ignore exception, it means router has already deleted
} catch(Throwable $e){
//ignore exception, it means router has already deleted
}
}
$d->delete();

View File

@ -173,6 +173,8 @@ switch ($action) {
Mikrotik::removeHotspotPlan($client, $d['name_plan']);
} catch (Exception $e) {
//ignore exception, it means router has already deleted
} catch(Throwable $e){
//ignore exception, it means router has already deleted
}
}
@ -441,6 +443,8 @@ switch ($action) {
Mikrotik::removePpoePlan($client, $d['name_plan']);
} catch (Exception $e) {
//ignore exception, it means router has already deleted
} catch(Throwable $e){
//ignore exception, it means router has already deleted
}
}
$d->delete();