added Voucher only Without username
This commit is contained in:
parent
922f24b630
commit
8061acbf9e
@ -138,8 +138,9 @@
|
||||
<td class="content-block"
|
||||
style="font-family: Helvetica, sans-serif; vertical-align: top; color: #9a9ea6; font-size: 16px; text-align: center;"
|
||||
valign="top" align="center">
|
||||
<p>
|
||||
<span class="apple-link"
|
||||
style="color: #9a9ea6; font-size: 16px; text-align: center;">[[Company_Address]]</span>
|
||||
style="color: #9a9ea6; font-size: 16px; text-align: center;">[[Company_Address]]</span></p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -44,8 +44,12 @@ class Package
|
||||
_alert(Lang::T('This account status') . ' : ' . Lang::T($c['status']), 'danger', "");
|
||||
}
|
||||
}else{
|
||||
$c['username'] = $channel;
|
||||
$c['fullname'] = $gateway;
|
||||
$c = [
|
||||
'fullname' => $gateway,
|
||||
'email' => '',
|
||||
'username' => $channel,
|
||||
'password' => $channel,
|
||||
];
|
||||
}
|
||||
|
||||
$add_cost = 0;
|
||||
@ -146,7 +150,8 @@ class Package
|
||||
/**
|
||||
* 1 Customer only can have 1 PPPOE and 1 Hotspot Plan, 1 prepaid and 1 postpaid
|
||||
*/
|
||||
$b = ORM::for_table('tbl_user_recharges')
|
||||
|
||||
$query = ORM::for_table('tbl_user_recharges')
|
||||
->select('tbl_user_recharges.id', 'id')
|
||||
->select('customer_id')
|
||||
->select('username')
|
||||
@ -162,14 +167,18 @@ class Package
|
||||
->select('tbl_user_recharges.type', 'type')
|
||||
->select('admin_id')
|
||||
->select('prepaid')
|
||||
->where('customer_id', $id_customer)
|
||||
->where('tbl_user_recharges.routers', $router_name)
|
||||
->where('tbl_user_recharges.Type', $p['type'])
|
||||
# PPPOE or Hotspot only can have 1 per customer prepaid or postpaid
|
||||
# because 1 customer can have 1 PPPOE and 1 Hotspot Plan in mikrotik
|
||||
//->where('prepaid', $p['prepaid'])
|
||||
->left_outer_join('tbl_plans', array('tbl_plans.id', '=', 'tbl_user_recharges.plan_id'))
|
||||
->find_one();
|
||||
->left_outer_join('tbl_plans', array('tbl_plans.id', '=', 'tbl_user_recharges.plan_id'));
|
||||
if($isVoucher){
|
||||
$query->where('username', $c['username']);
|
||||
}else{
|
||||
$query->where('customer_id', $id_customer);
|
||||
}
|
||||
$b = $query->find_one();
|
||||
|
||||
run_hook("recharge_user");
|
||||
|
||||
|
@ -56,6 +56,106 @@ switch ($do) {
|
||||
break;
|
||||
|
||||
case 'activation':
|
||||
if (!empty(_post('voucher_only'))) {
|
||||
$voucher = _post('voucher_only');
|
||||
$tur = ORM::for_table('tbl_user_recharges')
|
||||
->where('username', $voucher)
|
||||
->where('customer_id', '0') // Voucher Only will make customer ID as 0
|
||||
->find_one();
|
||||
if ($tur) {
|
||||
if ($tur['status'] == 'off') {
|
||||
_alert(Lang::T('Internet Voucher Expired'), 'danger', "login");
|
||||
}
|
||||
$p = ORM::for_table('tbl_plans')->where('id', $tur['plan_id'])->find_one();
|
||||
if ($p) {
|
||||
$dvc = Package::getDevice($p);
|
||||
if ($_app_stage != 'demo') {
|
||||
if (file_exists($dvc)) {
|
||||
if (file_exists($dvc)) {
|
||||
require_once $dvc;
|
||||
$c = [
|
||||
'fullname' => "Voucher",
|
||||
'email' => '',
|
||||
'username' => $voucher,
|
||||
'password' => $voucher,
|
||||
];
|
||||
(new $p['device'])->add_customer($c, $p);
|
||||
} else {
|
||||
new Exception(Lang::T("Devices Not Found"));
|
||||
}
|
||||
if (!empty($config['voucher_redirect'])) {
|
||||
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
|
||||
} else {
|
||||
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
|
||||
}
|
||||
} else {
|
||||
new Exception(Lang::T("Devices Not Found"));
|
||||
}
|
||||
}
|
||||
if (!empty($config['voucher_redirect'])) {
|
||||
_alert(Lang::T("Voucher activation success, now you can login"), 'danger', $config['voucher_redirect']);
|
||||
} else {
|
||||
r2(U . "login", 's', Lang::T("Voucher activation success, you are connected to internet"));
|
||||
}
|
||||
} else {
|
||||
_alert(Lang::T('Internet Plan Expired'), 'danger', "login");
|
||||
}
|
||||
} else {
|
||||
$v = ORM::for_table('tbl_voucher')->where('code', $voucher)->find_one();
|
||||
if (!$v) {
|
||||
_alert(Lang::T('Voucher invalid'), 'danger', "login");
|
||||
}
|
||||
if ($v['status'] == 0) {
|
||||
if (Package::rechargeUser(0, $v['routers'], $v['id_plan'], "Voucher", $voucher)) {
|
||||
$v->status = "1";
|
||||
$v->save();
|
||||
$tur = ORM::for_table('tbl_user_recharges')->where('username', $voucher)->find_one();
|
||||
if ($tur) {
|
||||
$p = ORM::for_table('tbl_plans')->where('id', $tur['plan_id'])->find_one();
|
||||
if ($p) {
|
||||
$dvc = Package::getDevice($p);
|
||||
if ($_app_stage != 'demo') {
|
||||
if (file_exists($dvc)) {
|
||||
if (file_exists($dvc)) {
|
||||
require_once $dvc;
|
||||
$c = [
|
||||
'fullname' => "Voucher",
|
||||
'email' => '',
|
||||
'username' => $voucher,
|
||||
'password' => $voucher,
|
||||
];
|
||||
(new $p['device'])->add_customer($c, $p);
|
||||
} else {
|
||||
new Exception(Lang::T("Devices Not Found"));
|
||||
}
|
||||
if (!empty($config['voucher_redirect'])) {
|
||||
r2($config['voucher_redirect'], 's', Lang::T("Voucher activation success, now you can login"));
|
||||
} else {
|
||||
r2(U . "login", 's', Lang::T("Voucher activation success, now you can login"));
|
||||
}
|
||||
} else {
|
||||
new Exception(Lang::T("Devices Not Found"));
|
||||
}
|
||||
}
|
||||
if (!empty($config['voucher_redirect'])) {
|
||||
_alert(Lang::T("Voucher activation success, now you can login"), 'danger', $config['voucher_redirect']);
|
||||
} else {
|
||||
r2(U . "login", 's', Lang::T("Voucher activation success, you are connected to internet"));
|
||||
}
|
||||
} else {
|
||||
_alert(Lang::T('Internet Plan Expired'), 'danger', "login");
|
||||
}
|
||||
} else {
|
||||
_alert(Lang::T('Voucher activation failed'), 'danger', "login");
|
||||
}
|
||||
} else {
|
||||
_alert(Lang::T('Voucher activation failed'), 'danger', "login");
|
||||
}
|
||||
} else {
|
||||
_alert(Lang::T('Internet Voucher Expired'), 'danger', "login");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$voucher = _post('voucher');
|
||||
$username = _post('username');
|
||||
$v1 = ORM::for_table('tbl_voucher')->where('code', $voucher)->find_one();
|
||||
@ -185,6 +285,7 @@ switch ($do) {
|
||||
_msglog('e', Lang::T('Invalid Username or Password'));
|
||||
r2(U . 'login');
|
||||
}
|
||||
}
|
||||
default:
|
||||
run_hook('customer_view_login'); #HOOK
|
||||
if ($config['disable_registration'] == 'yes') {
|
||||
|
@ -653,7 +653,11 @@
|
||||
"Http_Chap": "Http-Chap",
|
||||
"Hotspot_Authentication_Method__Make_sure_you_have_changed_your_hotspot_login_page_": "Hotspot Authentication Method. Make sure you have changed your hotspot login page.",
|
||||
"Business": "Business",
|
||||
"": "",
|
||||
"Source": "Source",
|
||||
"Destination": "Destination"
|
||||
"Destination": "Destination",
|
||||
"Activate_Voucher": "Activate Voucher",
|
||||
"Voucher_invalid": "Voucher invalid",
|
||||
"Account_Not_Found": "Account Not Found",
|
||||
"Voucher_activation_success__now_you_can_login": "Voucher activation success, now you can login",
|
||||
"Internet_Voucher_Expired": "Internet Voucher Expired"
|
||||
}
|
@ -60,10 +60,12 @@
|
||||
<div class="form-group">
|
||||
<label>{Lang::T('Enter voucher code here')}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="voucher" name="voucher" required value="{$code}"
|
||||
placeholder="{Lang::T('Enter voucher code here')}">
|
||||
<input type="text" class="form-control" id="voucher" name="voucher" required
|
||||
value="{$code}" placeholder="{Lang::T('Enter voucher code here')}">
|
||||
<span class="input-group-btn">
|
||||
<a class="btn btn-default" href="{APP_URL}/scan/?back={urlencode($_url)}{urlencode("login&code=")}"><i class="glyphicon glyphicon-qrcode"></i></a>
|
||||
<a class="btn btn-default"
|
||||
href="{APP_URL}/scan/?back={urlencode($_url)}{urlencode("login&code=")}"><i
|
||||
class="glyphicon glyphicon-qrcode"></i></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -73,15 +75,40 @@
|
||||
class="btn btn-primary">{Lang::T('Login / Activate Voucher')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading">{Lang::T('Activate Voucher')}</div>
|
||||
<div class="panel-body">
|
||||
<form action="{$_url}login/activation" method="post">
|
||||
<div class="form-group">
|
||||
<label>{Lang::T('Enter voucher code here')}</label>
|
||||
<div class="input-group">
|
||||
<input type="text" class="form-control" id="voucher_only" name="voucher_only" required
|
||||
value="{$code}" placeholder="{Lang::T('Enter voucher code here')}">
|
||||
<span class="input-group-btn">
|
||||
<a class="btn btn-default"
|
||||
href="{APP_URL}/scan/?back={urlencode($_url)}{urlencode("login&code=")}"><i
|
||||
class="glyphicon glyphicon-qrcode"></i></a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="btn-group btn-group-justified mb15">
|
||||
<div class="btn-group">
|
||||
<button type="submit"
|
||||
class="btn btn-primary">{Lang::T('Activate Voucher')}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<center>
|
||||
<a href="./pages/Privacy_Policy.html" target="_blank">Privacy</a>
|
||||
•
|
||||
<a href="./pages/Terms_of_Conditions.html" target="_blank">ToC</a>
|
||||
</center>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user