diff --git a/system/autoload/Package.php b/system/autoload/Package.php index 1dff5f8d..bc347a8c 100644 --- a/system/autoload/Package.php +++ b/system/autoload/Package.php @@ -80,8 +80,14 @@ class Package return true; } - - $b = ORM::for_table('tbl_user_recharges')->where('customer_id', $id_customer)->where('routers', $router_name)->find_one(); + /** + * 1 Customer only can have 1 PPPOE and 1 Hotspot Plan + */ + $b = ORM::for_table('tbl_user_recharges') + ->where('customer_id', $id_customer) + ->where('routers', $router_name) + ->where('Type', $p['type']) + ->find_one(); $mikrotik = Mikrotik::info($router_name); if ($p['validity_unit'] == 'Months') { @@ -124,9 +130,7 @@ class Package }else{ $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); Mikrotik::removeHotspotUser($client, $c['username']); - Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::removeHotspotActiveUser($client, $c['username']); - Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::addHotspotUser($client, $p, $c); } @@ -164,9 +168,7 @@ class Package }else{ $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); Mikrotik::removeHotspotUser($client, $c['username']); - Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::removeHotspotActiveUser($client, $c['username']); - Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::addHotspotUser($client, $p, $c); } @@ -231,9 +233,7 @@ class Package Radius::customerAddPlan($c, $p, "$date_exp $time"); }else{ $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); - Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); - Mikrotik::removeHotspotActiveUser($client, $c['username']); Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::addPpoeUser($client, $p, $c); } @@ -271,9 +271,7 @@ class Package Radius::customerAddPlan($c, $p, "$date_exp $time"); }else{ $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); - Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); - Mikrotik::removeHotspotActiveUser($client, $c['username']); Mikrotik::removePpoeActive($client, $c['username']); Mikrotik::addPpoeUser($client, $p, $c); } @@ -335,34 +333,26 @@ class Package if (!$p['is_radius']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); Mikrotik::removeHotspotUser($client, $c['username']); - Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::removeHotspotActiveUser($client, $c['username']); - Mikrotik::removePpoeActive($client, $c['username']); } } else { if (!$p['is_radius']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); Mikrotik::removeHotspotUser($client, $c['username']); - Mikrotik::removePpoeUser($client, $c['username']); Mikrotik::removeHotspotActiveUser($client, $c['username']); - Mikrotik::removePpoeActive($client, $c['username']); } } } else { if ($b) { if (!$p['is_radius']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); - Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); - Mikrotik::removeHotspotActiveUser($client, $c['username']); Mikrotik::removePpoeActive($client, $c['username']); } } else { if (!$p['is_radius']) { $client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']); - Mikrotik::removeHotspotUser($client, $c['username']); Mikrotik::removePpoeUser($client, $c['username']); - Mikrotik::removeHotspotActiveUser($client, $c['username']); Mikrotik::removePpoeActive($client, $c['username']); } } diff --git a/ui/ui/user-dashboard.tpl b/ui/ui/user-dashboard.tpl index 6eeb2747..bf9f2d8e 100644 --- a/ui/ui/user-dashboard.tpl +++ b/ui/ui/user-dashboard.tpl @@ -76,16 +76,16 @@ {Lang::T('Service Type')} - - {if $_user.service_type == 'Hotspot'} - Hotspot - {elseif $_user.service_type == 'PPPoE'} - PPPoE - {elseif $_user.service_type == 'Others' || $_user.service_type == null} - Others - {/if} - - + + {if $_user.service_type == 'Hotspot'} + Hotspot + {elseif $_user.service_type == 'PPPoE'} + PPPoE + {elseif $_user.service_type == 'Others' || $_user.service_type == null} + Others + {/if} + + {if $_c['enable_balance'] == 'yes'} @@ -103,11 +103,20 @@ {/if} - {if $_bills} + + {if $_bills} +
{foreach $_bills as $_bill} {if $_bill['routers'] != 'radius'}

{$_bill['routers']}

+
+ {if $_bill['type'] != 'Hotspot'} + {if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if} + {else} + {if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if} + {/if} +
{else}
@@ -163,8 +172,8 @@ {/if} {/foreach} - {/if} -
+
+ {/if} {if $_c['disable_voucher'] == 'yes'} -{include file="sections/user-footer.tpl"} +{include file="sections/user-footer.tpl"} \ No newline at end of file diff --git a/ui/ui/user-orderPlan.tpl b/ui/ui/user-orderPlan.tpl index 8a7aa3d1..26c3b812 100644 --- a/ui/ui/user-orderPlan.tpl +++ b/ui/ui/user-orderPlan.tpl @@ -6,367 +6,417 @@
{Lang::T('Order Internet Package')}
{if $_c['radius_enable']} - {if $_user['service_type'] == 'PPPoE'} - {if Lang::arrayCount($radius_pppoe)>0} - -
- {foreach $radius_pppoe as $plan} -
-
-
{$plan['name_plan']}
-
- - - - - - - - - - - - - - - -
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
+ {if $_user['service_type'] == 'PPPoE'} + {if Lang::arrayCount($radius_pppoe)>0} + +
+ {foreach $radius_pppoe as $plan} +
+
+
{$plan['name_plan']}
+
+ + + + + + + + + + + + + + + +
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
+
+
+
+ Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
+ {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
+
+
+ {/foreach}
-
-
- Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
- {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} + {/if} + {elseif $_user['service_type'] == 'Hotspot'} + {if Lang::arrayCount($radius_hotspot)>0} + +
+ {foreach $radius_hotspot as $plan} +
+
+
{$plan['name_plan']}
+
+ + + + + + + + + + + + + + + +
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
+
+
+
+ Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
+ {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
+
+
+ {/foreach}
-
-
- {/foreach} -
- {/if} - {elseif $_user['service_type'] == 'Hotspot'} - {if Lang::arrayCount($radius_hotspot)>0} - -
- {foreach $radius_hotspot as $plan} -
-
-
{$plan['name_plan']}
-
- - - - - - - - - - - - - - - -
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
-
-
-
- Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
- {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} -
-
-
- {/foreach} -
- {/if} - {elseif $_user['service_type'] == 'Others' || $_user['service_type'] == '' && (Lang::arrayCount($radius_pppoe)>0 || Lang::arrayCount($radius_hotspot)>0)} - -
- {if Lang::arrayCount($radius_pppoe)>0} - {foreach $radius_pppoe as $plan} -
-
-
{$plan['name_plan']}
-
- - - - - - - - - - - - - - - -
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
-
-
-
- Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
- {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} -
-
-
- {/foreach} - {/if} + {/if} + {elseif $_user['service_type'] == 'Others' || $_user['service_type'] == '' && (Lang::arrayCount($radius_pppoe)>0 || Lang::arrayCount($radius_hotspot)>0)} + +
+ {if Lang::arrayCount($radius_pppoe)>0} + {foreach $radius_pppoe as $plan} +
+
+
{$plan['name_plan']}
+
+ + + + + + + + + + + + + + + +
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
+
+
+
+ Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
+ {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
+
+
+ {/foreach} + {/if} - {if Lang::arrayCount($radius_hotspot)>0} - - {foreach $radius_hotspot as $plan} -
-
-
{$plan['name_plan']}
-
- - - - - - - - - - - - - - - -
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
-
-
-
- Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
- {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} -
+ {if Lang::arrayCount($radius_hotspot)>0} + + {foreach $radius_hotspot as $plan} +
+
+
{$plan['name_plan']}
+
+ + + + + + + + + + + + + + + +
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
+
+
+
+ Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
+ {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
+
+
+ {/foreach} + {/if}
-
- {/foreach} {/if} -
- {/if} {/if} {foreach $routers as $router} - {if Validator::isRouterHasPlan($plans_hotspot, $router['name']) || Validator::isRouterHasPlan($plans_pppoe, $router['name'])} -
-
{$router['name']}
- {if $router['description'] != ''} -
- {$router['description']} -
- {/if} - {if $_user['service_type'] == 'Hotspot' && Validator::countRouterPlan($plans_hotspot, $router['name'])>0} -
{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}
-
- {foreach $plans_hotspot as $plan} - {if $router['name'] eq $plan['routers']} -
-
-
{$plan['name_plan']}
-
- - - - - - - - - - - - - - - -
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
-
+ {if Validator::isRouterHasPlan($plans_hotspot, $router['name']) || Validator::isRouterHasPlan($plans_pppoe, $router['name'])} +
+
{$router['name']}
+ {if $router['description'] != ''}
-
- Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
- {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} + {$router['description']}
-
+ {/if} + {if $_user['service_type'] == 'Hotspot' && Validator::countRouterPlan($plans_hotspot, $router['name'])>0} +
{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if} +
+
+ {foreach $plans_hotspot as $plan} + {if $router['name'] eq $plan['routers']} +
+
+
{$plan['name_plan']}
+
+ + + + + + + + + + + + + + + +
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
+
+
+
+ Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
+ {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
+
+
+ {/if} + {/foreach} +
+ {/if} + {if $_user['service_type'] == 'PPPoE' && Validator::countRouterPlan($plans_pppoe,$router['name'])>0} +
{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}
+
+ {foreach $plans_pppoe as $plan} + {if $router['name'] eq $plan['routers']} +
+
+
{$plan['name_plan']}
+
+ + + + + + + + + + + + + + + +
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
+
+
+
+ Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
+ {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
+
+
+ {/if} + {/foreach} +
+ {/if} + {if $_user['service_type'] == 'Others' || $_user['service_type'] == '' && (Validator::countRouterPlan($plans_hotspot, $router['name'])>0 || Validator::countRouterPlan($plans_pppoe, $router['name'])>0)} +
{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if} +
+
+ {foreach $plans_hotspot as $plan} + {if $router['name'] eq $plan['routers']} +
+
+
{$plan['name_plan']}
+
+ + + + + + + + + + + + + + + +
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
+
+
+
+ Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
+ {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
+
+
+ {/if} + {/foreach} +
+
{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}
+
+ {foreach $plans_pppoe as $plan} + {if $router['name'] eq $plan['routers']} +
+
+
{$plan['name_plan']}
+
+ + + + + + + + + + + + + + + +
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
+
+
+
+ Buy + {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Pay With Balance')} + {/if} +
+ {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} + {Lang::T('Buy for friend')} + {/if} +
+
+
+ {/if} + {/foreach} +
+ {/if}
- {/if} - {/foreach} -
{/if} - {if $_user['service_type'] == 'PPPoE' && Validator::countRouterPlan($plans_pppoe,$router['name'])>0} -
{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}
-
- {foreach $plans_pppoe as $plan} - {if $router['name'] eq $plan['routers']} -
-
-
{$plan['name_plan']}
-
- - - - - - - - - - - - - - - -
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
-
-
-
- Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
- {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} -
-
-
- {/if} - {/foreach} -
- {/if} - {if $_user['service_type'] == 'Others' || $_user['service_type'] == '' && (Validator::countRouterPlan($plans_hotspot, $router['name'])>0 || Validator::countRouterPlan($plans_pppoe, $router['name'])>0)} -
{if $_c['hotspot_plan']==''}Hotspot Plan{else}{$_c['hotspot_plan']}{/if}
-
- {foreach $plans_hotspot as $plan} - {if $router['name'] eq $plan['routers']} -
-
-
{$plan['name_plan']}
-
- - - - - - - - - - - - - - - -
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
-
-
-
- Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
- {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} -
-
-
- {/if} - {/foreach} -
-
{if $_c['pppoe_plan']==''}PPPOE Plan{else}{$_c['pppoe_plan']}{/if}
-
- {foreach $plans_pppoe as $plan} - {if $router['name'] eq $plan['routers']} -
-
-
{$plan['name_plan']}
-
- - - - - - - - - - - - - - - -
{Lang::T('Type')}{$plan['type']}
{Lang::T('Price')}{Lang::moneyFormat($plan['price'])}
{Lang::T('Validity')}{$plan['validity']} {$plan['validity_unit']}
-
-
-
- Buy - {if $_c['enable_balance'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Pay With Balance')} - {/if} -
- {if $_c['enable_balance'] == 'yes' && $_c['allow_balance_transfer'] == 'yes' && $_user['balance']>=$plan['price']} - {Lang::T('Buy for friend')} - {/if} -
-
-
- {/if} - {/foreach} -
- {/if} -
- {/if} {/foreach}