Patch Update: Enhancement
Fixed Activation and Order History disappear when customer username is Changed
This commit is contained in:
parent
92491e22ec
commit
c8d5861f2e
@ -72,6 +72,7 @@ DROP TABLE IF EXISTS `tbl_payment_gateway`;
|
||||
CREATE TABLE `tbl_payment_gateway` (
|
||||
`id` int NOT NULL,
|
||||
`username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`user_id` int(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
|
||||
`gateway` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'xendit | midtrans',
|
||||
`gateway_trx_id` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '',
|
||||
`plan_id` int NOT NULL,
|
||||
@ -150,6 +151,7 @@ CREATE TABLE `tbl_transactions` (
|
||||
`id` int NOT NULL,
|
||||
`invoice` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`username` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`user_id` int(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL,
|
||||
`plan_name` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`price` varchar(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`recharged_on` date NOT NULL,
|
||||
|
@ -283,6 +283,7 @@ class Package
|
||||
$t = ORM::for_table('tbl_transactions')->create();
|
||||
$t->invoice = $inv = "INV-" . Package::_raid();
|
||||
$t->username = $c['username'];
|
||||
$t->user_id = $c['id'];
|
||||
$t->plan_name = $p['name_plan'];
|
||||
if ($gateway == 'Voucher' && User::isUserVoucher($channel)) {
|
||||
//its already paid
|
||||
@ -398,6 +399,7 @@ class Package
|
||||
$t = ORM::for_table('tbl_transactions')->create();
|
||||
$t->invoice = $inv = "INV-" . Package::_raid();
|
||||
$t->username = $c['username'];
|
||||
$t->user_id = $c['id'];
|
||||
$t->plan_name = $p['name_plan'];
|
||||
if ($gateway == 'Voucher' && User::isUserVoucher($channel)) {
|
||||
$t->price = 0;
|
||||
@ -480,6 +482,7 @@ class Package
|
||||
$t = ORM::for_table('tbl_transactions')->create();
|
||||
$t->invoice = $inv = "INV-" . Package::_raid();
|
||||
$t->username = $customer['username'];
|
||||
$t->user_id = $customer['id'];
|
||||
$t->plan_name = $plan['name_plan'];
|
||||
$t->price = $plan['price'];
|
||||
$t->recharged_on = date("Y-m-d");
|
||||
@ -545,6 +548,7 @@ class Package
|
||||
$t = ORM::for_table('tbl_transactions')->create();
|
||||
$t->invoice = $inv = "INV-" . Package::_raid();
|
||||
$t->username = $customer['username'];
|
||||
$t->user_id = $customer['id'];
|
||||
$t->plan_name = 'Custom Balance';
|
||||
$t->price = $plan['price'];
|
||||
$t->recharged_on = date("Y-m-d");
|
||||
|
@ -333,15 +333,30 @@ switch ($action) {
|
||||
if (empty($v)) {
|
||||
$v = 'activation';
|
||||
}
|
||||
if ($v == 'order') {
|
||||
switch ($v) {
|
||||
case 'order':
|
||||
$v = 'order';
|
||||
$query = ORM::for_table('tbl_payment_gateway')->where('user_id', $customer['id'])->order_by_desc('id');
|
||||
$order = Paginator::findMany($query);
|
||||
|
||||
if (empty($order) || $order < 5) {
|
||||
$query = ORM::for_table('tbl_payment_gateway')->where('username', $customer['username'])->order_by_desc('id');
|
||||
$order = Paginator::findMany($query);
|
||||
}
|
||||
|
||||
$ui->assign('order', $order);
|
||||
} else if ($v == 'activation') {
|
||||
break;
|
||||
case 'activation':
|
||||
$query = ORM::for_table('tbl_transactions')->where('user_id', $customer['id'])->order_by_desc('id');
|
||||
$activation = Paginator::findMany($query);
|
||||
|
||||
if (empty($activation) || $activation < 5) {
|
||||
$query = ORM::for_table('tbl_transactions')->where('username', $customer['username'])->order_by_desc('id');
|
||||
$activation = Paginator::findMany($query);
|
||||
}
|
||||
|
||||
$ui->assign('activation', $activation);
|
||||
break;
|
||||
}
|
||||
$ui->assign('packages', User::_billing($customer['id']));
|
||||
$ui->assign('v', $v);
|
||||
|
@ -19,8 +19,14 @@ switch ($action) {
|
||||
break;
|
||||
case 'history':
|
||||
$ui->assign('_system_menu', 'history');
|
||||
$query = ORM::for_table('tbl_payment_gateway')->where('user_id', $user['id'])->order_by_desc('id');
|
||||
$d = Paginator::findMany($query);
|
||||
|
||||
if (empty($order) || $order < 5) {
|
||||
$query = ORM::for_table('tbl_payment_gateway')->where('username', $user['username'])->order_by_desc('id');
|
||||
$d = Paginator::findMany($query);
|
||||
}
|
||||
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('_title', Lang::T('Order History'));
|
||||
run_hook('customer_view_order_history'); #HOOK
|
||||
@ -329,6 +335,7 @@ switch ($action) {
|
||||
//sender
|
||||
$d = ORM::for_table('tbl_payment_gateway')->create();
|
||||
$d->username = $user['username'];
|
||||
$d->user_id = $user['id'];
|
||||
$d->gateway = $target['username'];
|
||||
$d->plan_id = $plan['id'];
|
||||
$d->plan_name = $plan['name_plan'];
|
||||
@ -348,6 +355,7 @@ switch ($action) {
|
||||
//receiver
|
||||
$d = ORM::for_table('tbl_payment_gateway')->create();
|
||||
$d->username = $target['username'];
|
||||
$d->user_id = $target['id'];
|
||||
$d->gateway = $user['username'];
|
||||
$d->plan_id = $plan['id'];
|
||||
$d->plan_name = $plan['name_plan'];
|
||||
@ -484,6 +492,7 @@ switch ($action) {
|
||||
}
|
||||
$d = ORM::for_table('tbl_payment_gateway')->create();
|
||||
$d->username = $user['username'];
|
||||
$d->user_id = $user['id'];
|
||||
$d->gateway = $gateway;
|
||||
$d->plan_id = 0;
|
||||
$d->plan_name = 'Custom';
|
||||
@ -547,6 +556,7 @@ switch ($action) {
|
||||
if (empty($id)) {
|
||||
$d = ORM::for_table('tbl_payment_gateway')->create();
|
||||
$d->username = $user['username'];
|
||||
$d->user_id = $user['id'];
|
||||
$d->gateway = $gateway;
|
||||
$d->plan_id = $plan['id'];
|
||||
$d->plan_name = $plan['name_plan'];
|
||||
@ -569,6 +579,7 @@ switch ($action) {
|
||||
$id = $d->id();
|
||||
} else {
|
||||
$d->username = $user['username'];
|
||||
$d->user_id = $user['id'];
|
||||
$d->gateway = $gateway;
|
||||
$d->plan_id = $plan['id'];
|
||||
$d->plan_name = $plan['name_plan'];
|
||||
|
@ -41,10 +41,16 @@ switch ($action) {
|
||||
|
||||
case 'list-activated':
|
||||
$ui->assign('_system_menu', 'list-activated');
|
||||
$query = ORM::for_table('tbl_transactions')->where('username', $user['username'])->order_by_desc('id');
|
||||
$query = ORM::for_table('tbl_transactions')->where('user_id', $user['id'])->order_by_desc('id');
|
||||
$d = Paginator::findMany($query);
|
||||
|
||||
if (empty($d) || $d < 5) {
|
||||
$query = ORM::for_table('tbl_transactions')->where('username', $user['username'])->order_by_desc('id');
|
||||
$d = Paginator::findMany($query);
|
||||
}
|
||||
|
||||
$ui->assign('d', $d);
|
||||
$ui->assign('_title', Lang::T('Activation History'));
|
||||
run_hook('customer_view_activation_list'); #HOOK
|
||||
$ui->display('customer/activation-list.tpl');
|
||||
|
||||
|
@ -174,5 +174,9 @@
|
||||
],
|
||||
"2024.10.31" : [
|
||||
"ALTER TABLE `tbl_customers` ADD `photo` VARCHAR(128) NOT NULL DEFAULT '/user.default.jpg' AFTER `password`;"
|
||||
],
|
||||
"2024.12.5" : [
|
||||
"ALTER TABLE `tbl_transactions` ADD `user_id` INT(11) NULL AFTER `username`;",
|
||||
"ALTER TABLE `tbl_payment_gateway` ADD `user_id` INT(11) NULL AFTER `username`;"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user