Update Multiple Active plan when change pass or username
This commit is contained in:
parent
f08d8e127e
commit
a2eda99f88
@ -36,8 +36,8 @@ switch ($action) {
|
|||||||
r2(U . 'accounts/change-password', 'e', 'Both Password should be same');
|
r2(U . 'accounts/change-password', 'e', 'Both Password should be same');
|
||||||
}
|
}
|
||||||
$user->password = $npass;
|
$user->password = $npass;
|
||||||
$tur = ORM::for_table('tbl_user_recharges')->where('customer_id', $user['id'])->find_one();
|
$turs = ORM::for_table('tbl_user_recharges')->where('customer_id', $user['id'])->find_many();
|
||||||
if ($tur) {
|
foreach($turs as $tur) {
|
||||||
// if has active plan, change the password to devices
|
// if has active plan, change the password to devices
|
||||||
if ($tur['status'] == 'on') {
|
if ($tur['status'] == 'on') {
|
||||||
$p = ORM::for_table('tbl_plans')->where('id', $tur['plan_id'])->find_one();
|
$p = ORM::for_table('tbl_plans')->where('id', $tur['plan_id'])->find_one();
|
||||||
@ -45,7 +45,10 @@ switch ($action) {
|
|||||||
if ($_app_stage != 'demo') {
|
if ($_app_stage != 'demo') {
|
||||||
if (file_exists($dvc)) {
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
|
$exp = $p['plan_expired'];
|
||||||
|
$p['plan_expired'] = 0;
|
||||||
(new $p['device'])->remove_customer($user, $p);
|
(new $p['device'])->remove_customer($user, $p);
|
||||||
|
$p['plan_expired'] = $exp;
|
||||||
(new $p['device'])->add_customer($user, $p);
|
(new $p['device'])->add_customer($user, $p);
|
||||||
} else {
|
} else {
|
||||||
new Exception(Lang::T("Devices Not Found"));
|
new Exception(Lang::T("Devices Not Found"));
|
||||||
|
@ -564,8 +564,8 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($userDiff || $pppoeDiff || $passDiff) {
|
if ($userDiff || $pppoeDiff || $passDiff) {
|
||||||
$tur = ORM::for_table('tbl_user_recharges')->where('customer_id', $c['id'])->find_one();
|
$turs = ORM::for_table('tbl_user_recharges')->where('customer_id', $c['id'])->findMany();
|
||||||
if ($tur) {
|
foreach ($turs as $tur) {
|
||||||
$tur->username = $username;
|
$tur->username = $username;
|
||||||
$tur->save();
|
$tur->save();
|
||||||
$p = ORM::for_table('tbl_plans')->find_one($tur['plan_id']);
|
$p = ORM::for_table('tbl_plans')->find_one($tur['plan_id']);
|
||||||
@ -576,9 +576,12 @@ switch ($action) {
|
|||||||
if (file_exists($dvc)) {
|
if (file_exists($dvc)) {
|
||||||
require_once $dvc;
|
require_once $dvc;
|
||||||
if ($userDiff) {
|
if ($userDiff) {
|
||||||
$c->username = $oldusername;
|
$c['username'] = $oldusername;
|
||||||
|
$exp = $p['plan_expired'];
|
||||||
|
$p['plan_expired'] = 0;
|
||||||
(new $p['device'])->remove_customer($c, $p);
|
(new $p['device'])->remove_customer($c, $p);
|
||||||
$c->username = $username;
|
$c['username'] = $username;
|
||||||
|
$p['plan_expired'] = $exp;
|
||||||
}
|
}
|
||||||
(new $p['device'])->add_customer($c, $p);
|
(new $p['device'])->add_customer($c, $p);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user