From 94e6f7fe6cf1218469dd29405a5eaf0d339df130 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Tue, 21 May 2024 11:45:23 +0700 Subject: [PATCH] change join to left_outer_join --- system/autoload/Package.php | 2 +- system/autoload/User.php | 2 +- system/controllers/customers.php | 2 +- system/controllers/plan.php | 24 +++++------ system/controllers/services.php | 12 +++--- ui/ui/community-rollback.tpl | 68 +++++++++++++++++--------------- 6 files changed, 57 insertions(+), 53 deletions(-) diff --git a/system/autoload/Package.php b/system/autoload/Package.php index a81a3da..a2210d2 100644 --- a/system/autoload/Package.php +++ b/system/autoload/Package.php @@ -157,7 +157,7 @@ class Package # 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']) - ->join('tbl_plans', array('tbl_plans.id', '=', 'tbl_user_recharges.plan_id')) + ->left_outer_join('tbl_plans', array('tbl_plans.id', '=', 'tbl_user_recharges.plan_id')) ->find_one(); run_hook("recharge_user"); diff --git a/system/autoload/User.php b/system/autoload/User.php index b0cc980..a18b1aa 100644 --- a/system/autoload/User.php +++ b/system/autoload/User.php @@ -187,7 +187,7 @@ class User 'admin_id', 'prepaid' ]) ->where('customer_id', $id) - ->join('tbl_plans', array('tbl_plans.id', '=', 'tbl_user_recharges.plan_id')) + ->left_outer_join('tbl_plans', array('tbl_plans.id', '=', 'tbl_user_recharges.plan_id')) ->find_many(); return $d; } diff --git a/system/controllers/customers.php b/system/controllers/customers.php index 2375ad8..93477f8 100644 --- a/system/controllers/customers.php +++ b/system/controllers/customers.php @@ -96,7 +96,7 @@ switch ($action) { ->select('routers') ->select('status') ->select('method', 'Payment') - ->join('tbl_user_recharges', array('tbl_customers.id', '=', 'tbl_user_recharges.customer_id')) + ->left_outer_join('tbl_user_recharges', array('tbl_customers.id', '=', 'tbl_user_recharges.customer_id')) ->order_by_asc('tbl_customers.id') ->find_array(); diff --git a/system/controllers/plan.php b/system/controllers/plan.php index a14053d..6c2f1dc 100644 --- a/system/controllers/plan.php +++ b/system/controllers/plan.php @@ -341,7 +341,7 @@ switch ($action) { if ($search != '') { if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { $query = ORM::for_table('tbl_plans')->where('enabled', '1') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where_like('tbl_voucher.code', '%' . $search . '%'); $d = Paginator::findMany($query, ["search" => $search]); } else if ($admin['user_type'] == 'Agent') { @@ -352,7 +352,7 @@ switch ($action) { } $sales[] = $admin['id']; $query = ORM::for_table('tbl_plans') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where_in('generated_by', $sales) ->where_like('tbl_voucher.code', '%' . $search . '%'); $d = Paginator::findMany($query, ["search" => $search]); @@ -360,7 +360,7 @@ switch ($action) { } else { if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { $query = ORM::for_table('tbl_plans')->where('enabled', '1') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')); + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')); $d = Paginator::findMany($query); } else if ($admin['user_type'] == 'Agent') { $sales = []; @@ -370,7 +370,7 @@ switch ($action) { } $sales[] = $admin['id']; $query = ORM::for_table('tbl_plans') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where_in('generated_by', $sales); $d = Paginator::findMany($query); } @@ -453,43 +453,43 @@ switch ($action) { if ($from_id > 0 && $planid > 0) { $v = ORM::for_table('tbl_plans') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where('tbl_voucher.status', '0') ->where('tbl_plans.id', $planid) ->where_gt('tbl_voucher.id', $from_id) ->limit($limit); $vc = ORM::for_table('tbl_plans') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where('tbl_voucher.status', '0') ->where('tbl_plans.id', $planid) ->where_gt('tbl_voucher.id', $from_id); } else if ($from_id == 0 && $planid > 0) { $v = ORM::for_table('tbl_plans') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where('tbl_voucher.status', '0') ->where('tbl_plans.id', $planid) ->limit($limit); $vc = ORM::for_table('tbl_plans') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where('tbl_voucher.status', '0') ->where('tbl_plans.id', $planid); } else if ($from_id > 0 && $planid == 0) { $v = ORM::for_table('tbl_plans') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where('tbl_voucher.status', '0') ->where_gt('tbl_voucher.id', $from_id) ->limit($limit); $vc = ORM::for_table('tbl_plans') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where('tbl_voucher.status', '0') ->where_gt('tbl_voucher.id', $from_id); } else { $v = ORM::for_table('tbl_plans') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where('tbl_voucher.status', '0') ->limit($limit); $vc = ORM::for_table('tbl_plans') - ->join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) + ->left_outer_join('tbl_voucher', array('tbl_plans.id', '=', 'tbl_voucher.id_plan')) ->where('tbl_voucher.status', '0'); } if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { diff --git a/system/controllers/services.php b/system/controllers/services.php index a0f85ec..e1d1f8e 100644 --- a/system/controllers/services.php +++ b/system/controllers/services.php @@ -23,7 +23,7 @@ switch ($action) { case 'sync': set_time_limit(-1); if ($routes['2'] == 'hotspot') { - $plans = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot')->where('tbl_plans.enabled', '1')->find_many(); + $plans = ORM::for_table('tbl_bandwidth')->left_outer_join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot')->where('tbl_plans.enabled', '1')->find_many(); $log = ''; $router = ''; foreach ($plans as $plan) { @@ -68,7 +68,7 @@ switch ($action) { } r2(U . 'services/hotspot', 's', $log); } else if ($routes['2'] == 'pppoe') { - $plans = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->where('tbl_plans.enabled', '1')->find_many(); + $plans = ORM::for_table('tbl_bandwidth')->left_outer_join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->where('tbl_plans.enabled', '1')->find_many(); $log = ''; $router = ''; foreach ($plans as $plan) { @@ -119,10 +119,10 @@ switch ($action) { $name = _post('name'); if ($name != '') { - $query = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot')->where_like('tbl_plans.name_plan', '%' . $name . '%'); + $query = ORM::for_table('tbl_bandwidth')->left_outer_join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot')->where_like('tbl_plans.name_plan', '%' . $name . '%'); $d = Paginator::findMany($query, ['name' => $name]); } else { - $query = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot'); + $query = ORM::for_table('tbl_bandwidth')->left_outer_join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'Hotspot'); $d = Paginator::findMany($query); } @@ -391,10 +391,10 @@ switch ($action) { $name = _post('name'); if ($name != '') { - $query = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->where_like('tbl_plans.name_plan', '%' . $name . '%'); + $query = ORM::for_table('tbl_bandwidth')->left_outer_join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE')->where_like('tbl_plans.name_plan', '%' . $name . '%'); $d = Paginator::findMany($query, ['name' => $name]); } else { - $query = ORM::for_table('tbl_bandwidth')->join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE'); + $query = ORM::for_table('tbl_bandwidth')->left_outer_join('tbl_plans', array('tbl_bandwidth.id', '=', 'tbl_plans.id_bw'))->where('tbl_plans.type', 'PPPOE'); $d = Paginator::findMany($query); } diff --git a/ui/ui/community-rollback.tpl b/ui/ui/community-rollback.tpl index 4015985..02a59c9 100644 --- a/ui/ui/community-rollback.tpl +++ b/ui/ui/community-rollback.tpl @@ -10,22 +10,24 @@

Master

- - - {foreach $masters as $data} - - - - - - {/foreach} - -
{nl2br($data['commit']['message'])}{Lang::dateTimeFormat(str_replace(['Z','T'],'',$data['commit']['author']['date']))} - - update - -
+
+ + + {foreach $masters as $data} + + + + + + {/foreach} + +
{nl2br($data['commit']['message'])}{Lang::dateTimeFormat(str_replace(['Z','T'],'',$data['commit']['author']['date']))} + + update + +
+
@@ -33,22 +35,24 @@

Development

- - - {foreach $devs as $data} - - - - - - {/foreach} - -
{nl2br($data['commit']['message'])}{Lang::dateTimeFormat(str_replace(['Z','T'],'',$data['commit']['author']['date']))} - - update - -
+
+ + + {foreach $devs as $data} + + + + + + {/foreach} + +
{nl2br($data['commit']['message'])}{Lang::dateTimeFormat(str_replace(['Z','T'],'',$data['commit']['author']['date']))} + + update + +
+