admin can recharge disabled plan
This commit is contained in:
parent
9b2d42610a
commit
46a56c12e3
@ -30,7 +30,7 @@ class Package
|
|||||||
}
|
}
|
||||||
|
|
||||||
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
|
$c = ORM::for_table('tbl_customers')->where('id', $id_customer)->find_one();
|
||||||
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->where('enabled', '1')->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->find_one();
|
||||||
if ($p['validity_unit'] == 'Period') {
|
if ($p['validity_unit'] == 'Period') {
|
||||||
$f = ORM::for_table('tbl_customers_fields')->where('field_name', 'Expired Date')->where('customer_id', $c['id'])->find_one();
|
$f = ORM::for_table('tbl_customers_fields')->where('field_name', 'Expired Date')->where('customer_id', $c['id'])->find_one();
|
||||||
if (!$f) {
|
if (!$f) {
|
||||||
@ -511,7 +511,7 @@ class Package
|
|||||||
public static function changeTo($username, $plan_id, $from_id)
|
public static function changeTo($username, $plan_id, $from_id)
|
||||||
{
|
{
|
||||||
$c = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
|
$c = ORM::for_table('tbl_customers')->where('username', $username)->find_one();
|
||||||
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->where('enabled', '1')->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $plan_id)->find_one();
|
||||||
$b = ORM::for_table('tbl_user_recharges')->find_one($from_id);
|
$b = ORM::for_table('tbl_user_recharges')->find_one($from_id);
|
||||||
if ($p['routers'] == $b['routers'] && $b['routers'] != 'radius') {
|
if ($p['routers'] == $b['routers'] && $b['routers'] != 'radius') {
|
||||||
$mikrotik = Mikrotik::info($p['routers']);
|
$mikrotik = Mikrotik::info($p['routers']);
|
||||||
|
@ -38,11 +38,19 @@ switch ($action) {
|
|||||||
case 'plan':
|
case 'plan':
|
||||||
$server = _post('server');
|
$server = _post('server');
|
||||||
$jenis = _post('jenis');
|
$jenis = _post('jenis');
|
||||||
|
if(in_array($admin['user_type'], array('SuperAdmin', 'Admin'))){
|
||||||
|
if($server=='radius'){
|
||||||
|
$d = ORM::for_table('tbl_plans')->where('is_radius', 1)->where('type', $jenis)->find_many();
|
||||||
|
}else{
|
||||||
|
$d = ORM::for_table('tbl_plans')->where('routers', $server)->where('type', $jenis)->find_many();
|
||||||
|
}
|
||||||
|
}else{
|
||||||
if($server=='radius'){
|
if($server=='radius'){
|
||||||
$d = ORM::for_table('tbl_plans')->where('is_radius', 1)->where('type', $jenis)->where('enabled', '1')->find_many();
|
$d = ORM::for_table('tbl_plans')->where('is_radius', 1)->where('type', $jenis)->where('enabled', '1')->find_many();
|
||||||
}else{
|
}else{
|
||||||
$d = ORM::for_table('tbl_plans')->where('routers', $server)->where('type', $jenis)->where('enabled', '1')->find_many();
|
$d = ORM::for_table('tbl_plans')->where('routers', $server)->where('type', $jenis)->where('enabled', '1')->find_many();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$ui->assign('d', $d);
|
$ui->assign('d', $d);
|
||||||
|
|
||||||
$ui->display('autoload.tpl');
|
$ui->display('autoload.tpl');
|
||||||
|
@ -89,10 +89,6 @@ switch ($action) {
|
|||||||
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
|
_alert(Lang::T('You do not have permission to access this page'), 'danger', "dashboard");
|
||||||
}
|
}
|
||||||
$ui->assign('xfooter', $select2_customer);
|
$ui->assign('xfooter', $select2_customer);
|
||||||
$p = ORM::for_table('tbl_plans')->where('enabled', '1')->find_many();
|
|
||||||
$ui->assign('p', $p);
|
|
||||||
$r = ORM::for_table('tbl_routers')->where('enabled', '1')->find_many();
|
|
||||||
$ui->assign('r', $r);
|
|
||||||
if (isset($routes['2']) && !empty($routes['2'])) {
|
if (isset($routes['2']) && !empty($routes['2'])) {
|
||||||
$ui->assign('cust', ORM::for_table('tbl_customers')->find_one($routes['2']));
|
$ui->assign('cust', ORM::for_table('tbl_customers')->find_one($routes['2']));
|
||||||
}
|
}
|
||||||
@ -193,7 +189,11 @@ switch ($action) {
|
|||||||
$d = ORM::for_table('tbl_user_recharges')->find_one($id);
|
$d = ORM::for_table('tbl_user_recharges')->find_one($id);
|
||||||
if ($d) {
|
if ($d) {
|
||||||
$ui->assign('d', $d);
|
$ui->assign('d', $d);
|
||||||
|
if(in_array($admin['user_type'], array('SuperAdmin', 'Admin'))){
|
||||||
|
$p = ORM::for_table('tbl_plans')->where_not_equal('type', 'Balance')->find_many();
|
||||||
|
}else{
|
||||||
$p = ORM::for_table('tbl_plans')->where('enabled', '1')->where_not_equal('type', 'Balance')->find_many();
|
$p = ORM::for_table('tbl_plans')->where('enabled', '1')->where_not_equal('type', 'Balance')->find_many();
|
||||||
|
}
|
||||||
$ui->assign('p', $p);
|
$ui->assign('p', $p);
|
||||||
run_hook('view_edit_customer_plan'); #HOOK
|
run_hook('view_edit_customer_plan'); #HOOK
|
||||||
$ui->assign('_title', 'Edit Plan');
|
$ui->assign('_title', 'Edit Plan');
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<option value="">Select Plans</option>
|
<option value="">Select Plans</option>
|
||||||
{foreach $d as $ds}
|
{foreach $d as $ds}
|
||||||
<option value="{$ds['id']}">{$ds['name_plan']} • {Lang::moneyFormat($ds['price'])}</option>
|
<option value="{$ds['id']}">{if $ds['enabled'] neq 1}DISABLED PLAN • {/if}{$ds['name_plan']} • {Lang::moneyFormat($ds['price'])}</option>
|
||||||
{/foreach}
|
{/foreach}
|
@ -23,7 +23,8 @@
|
|||||||
<select id="id_plan" name="id_plan" class="form-control select2">
|
<select id="id_plan" name="id_plan" class="form-control select2">
|
||||||
{foreach $p as $ps}
|
{foreach $p as $ps}
|
||||||
<option value="{$ps['id']}" {if $d['plan_id'] eq $ps['id']} selected {/if}>
|
<option value="{$ps['id']}" {if $d['plan_id'] eq $ps['id']} selected {/if}>
|
||||||
{if $ps['is_radius']=='1'}Radius{else}{$ps['routers']}{/if} - {$ps['name_plan']}</option>
|
{if $ps['enabled'] neq 1}DISABLED PLAN • {/if}
|
||||||
|
{if $ps['is_radius']=='1'}Radius{else}{$ps['routers']}{/if} • {$ps['name_plan']}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user