From dec4258a6f753348b6bd10f513d6141ca0fc7fd1 Mon Sep 17 00:00:00 2001 From: Focuslinkstech <45756999+Focuslinkstech@users.noreply.github.com> Date: Sat, 3 Aug 2024 14:16:51 +0100 Subject: [PATCH] Fixed Customer List Bug fix the package not listing on next page in customer list --- system/controllers/customers.php | 25 ++++++++++++++++++++++--- ui/ui/customers.tpl | 6 +++--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/system/controllers/customers.php b/system/controllers/customers.php index 8328c7b9..da0299cc 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -655,12 +655,28 @@ switch ($action) { $query = ORM::for_table('tbl_customers'); $query->where("status", $filter); } + if ($orderby == 'asc') { $query->order_by_asc($order); } else { $query->order_by_desc($order); } - $d = $query->findMany(); + + $customers = $query->findMany(); + + foreach ($customers as $customer) { + $d = ORM::for_table('tbl_user_recharges')->where('customer_id', $customer->id)->findOne(); + if ($d) { + if ($d['status'] == 'on') { + $customer->recharge_status = '' . $d['namebp'] . ''; + } else { + $customer->recharge_status = '' . $d['namebp'] . ''; + } + } else { + $customer->recharge_status = '•'; + } + } + if (_post('export', '') == 'csv') { $h = false; set_time_limit(-1); @@ -680,13 +696,14 @@ switch ($action) { 'email', 'balance', 'service_type', + 'recharge_status' ]; $fp = fopen('php://output', 'wb'); if (!$h) { fputcsv($fp, $headers, ";"); $h = true; } - foreach ($d as $c) { + foreach ($customers as $c) { $row = [ $c['id'], $c['username'], @@ -696,14 +713,16 @@ switch ($action) { $c['email'], $c['balance'], $c['service_type'], + $c->recharge_status ]; fputcsv($fp, $row, ";"); } fclose($fp); die(); } + $ui->assign('xheader', ''); - $ui->assign('d', $d); + $ui->assign('customers', $customers); $ui->assign('statuses', ORM::for_table('tbl_customers')->getEnum("status")); $ui->assign('filter', $filter); $ui->assign('search', $search); diff --git a/ui/ui/customers.tpl b/ui/ui/customers.tpl index 534b5941..77f159bf 100644 --- a/ui/ui/customers.tpl +++ b/ui/ui/customers.tpl @@ -99,7 +99,7 @@
- {foreach $d as $ds} + {foreach $customers as $ds}