extend expiration after buy same package
This commit is contained in:
parent
1dd03168f0
commit
fe1310bd57
@ -102,6 +102,23 @@ class Package
|
|||||||
Mikrotik::addHotspotUser($client, $p, $c);
|
Mikrotik::addHotspotUser($client, $p, $c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($b['namebp'] == $p['name_plan']) {
|
||||||
|
// if it same internet plan, expired will extend
|
||||||
|
if ($p['validity_unit'] == 'Months') {
|
||||||
|
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
|
||||||
|
} else if ($p['validity_unit'] == 'Days') {
|
||||||
|
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
|
||||||
|
} else if ($p['validity_unit'] == 'Hrs') {
|
||||||
|
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
|
||||||
|
$date_exp = $datetime[0];
|
||||||
|
$time = $datetime[1];
|
||||||
|
} else if ($p['validity_unit'] == 'Mins') {
|
||||||
|
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' minutes')));
|
||||||
|
$date_exp = $datetime[0];
|
||||||
|
$time = $datetime[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$b->customer_id = $id_customer;
|
$b->customer_id = $id_customer;
|
||||||
$b->username = $c['username'];
|
$b->username = $c['username'];
|
||||||
$b->plan_id = $plan_id;
|
$b->plan_id = $plan_id;
|
||||||
@ -182,6 +199,24 @@ class Package
|
|||||||
Mikrotik::addPpoeUser($client, $p, $c);
|
Mikrotik::addPpoeUser($client, $p, $c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($b['namebp'] == $p['name_plan']) {
|
||||||
|
// if it same internet plan, expired will extend
|
||||||
|
if ($p['validity_unit'] == 'Months') {
|
||||||
|
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' months'));
|
||||||
|
} else if ($p['validity_unit'] == 'Days') {
|
||||||
|
$date_exp = date("Y-m-d", strtotime($b['expiration'] . ' +' . $p['validity'] . ' days'));
|
||||||
|
} else if ($p['validity_unit'] == 'Hrs') {
|
||||||
|
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' hours')));
|
||||||
|
$date_exp = $datetime[0];
|
||||||
|
$time = $datetime[1];
|
||||||
|
} else if ($p['validity_unit'] == 'Mins') {
|
||||||
|
$datetime = explode(' ', date("Y-m-d H:i:s", strtotime($b['expiration'] . ' ' . $b['time'] . ' +' . $p['validity'] . ' minutes')));
|
||||||
|
$date_exp = $datetime[0];
|
||||||
|
$time = $datetime[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$b->customer_id = $id_customer;
|
$b->customer_id = $id_customer;
|
||||||
$b->username = $c['username'];
|
$b->username = $c['username'];
|
||||||
$b->plan_id = $plan_id;
|
$b->plan_id = $plan_id;
|
||||||
|
@ -28,9 +28,9 @@ switch ($action) {
|
|||||||
$v1 = ORM::for_table('tbl_voucher')->where('code', $code)->where('status', 0)->find_one();
|
$v1 = ORM::for_table('tbl_voucher')->where('code', $code)->where('status', 0)->find_one();
|
||||||
run_hook('customer_activate_voucher'); #HOOK
|
run_hook('customer_activate_voucher'); #HOOK
|
||||||
if ($v1) {
|
if ($v1) {
|
||||||
if (Package::rechargeUser($user, $v1['routers'], $v1['id_plan'], "Activation", "Voucher")) {
|
if (Package::rechargeUser($user['id'], $v1['routers'], $v1['id_plan'], "Activation", "Voucher")) {
|
||||||
$v1->status = "1";
|
$v1->status = "1";
|
||||||
$v1->user = $c['username'];
|
$v1->user = $user['username'];
|
||||||
$v1->save();
|
$v1->save();
|
||||||
r2(U . "voucher/list-activated", 's', $_L['Activation_Vouchers_Successfully']);
|
r2(U . "voucher/list-activated", 's', $_L['Activation_Vouchers_Successfully']);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user