change join to left_outer_join

This commit is contained in:
Ibnu Maksum 2024-05-21 11:45:23 +07:00
parent fc74589a2a
commit 94e6f7fe6c
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5
6 changed files with 57 additions and 53 deletions

View File

@ -157,7 +157,7 @@ class Package
# PPPOE or Hotspot only can have 1 per customer prepaid or postpaid # 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 # because 1 customer can have 1 PPPOE and 1 Hotspot Plan in mikrotik
//->where('prepaid', $p['prepaid']) //->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(); ->find_one();
run_hook("recharge_user"); run_hook("recharge_user");

View File

@ -187,7 +187,7 @@ class User
'admin_id', 'prepaid' 'admin_id', 'prepaid'
]) ])
->where('customer_id', $id) ->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(); ->find_many();
return $d; return $d;
} }

View File

@ -96,7 +96,7 @@ switch ($action) {
->select('routers') ->select('routers')
->select('status') ->select('status')
->select('method', 'Payment') ->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') ->order_by_asc('tbl_customers.id')
->find_array(); ->find_array();

View File

@ -341,7 +341,7 @@ switch ($action) {
if ($search != '') { if ($search != '') {
if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
$query = ORM::for_table('tbl_plans')->where('enabled', '1') $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 . '%'); ->where_like('tbl_voucher.code', '%' . $search . '%');
$d = Paginator::findMany($query, ["search" => $search]); $d = Paginator::findMany($query, ["search" => $search]);
} else if ($admin['user_type'] == 'Agent') { } else if ($admin['user_type'] == 'Agent') {
@ -352,7 +352,7 @@ switch ($action) {
} }
$sales[] = $admin['id']; $sales[] = $admin['id'];
$query = ORM::for_table('tbl_plans') $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_in('generated_by', $sales)
->where_like('tbl_voucher.code', '%' . $search . '%'); ->where_like('tbl_voucher.code', '%' . $search . '%');
$d = Paginator::findMany($query, ["search" => $search]); $d = Paginator::findMany($query, ["search" => $search]);
@ -360,7 +360,7 @@ switch ($action) {
} else { } else {
if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {
$query = ORM::for_table('tbl_plans')->where('enabled', '1') $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); $d = Paginator::findMany($query);
} else if ($admin['user_type'] == 'Agent') { } else if ($admin['user_type'] == 'Agent') {
$sales = []; $sales = [];
@ -370,7 +370,7 @@ switch ($action) {
} }
$sales[] = $admin['id']; $sales[] = $admin['id'];
$query = ORM::for_table('tbl_plans') $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_in('generated_by', $sales);
$d = Paginator::findMany($query); $d = Paginator::findMany($query);
} }
@ -453,43 +453,43 @@ switch ($action) {
if ($from_id > 0 && $planid > 0) { if ($from_id > 0 && $planid > 0) {
$v = ORM::for_table('tbl_plans') $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_voucher.status', '0')
->where('tbl_plans.id', $planid) ->where('tbl_plans.id', $planid)
->where_gt('tbl_voucher.id', $from_id) ->where_gt('tbl_voucher.id', $from_id)
->limit($limit); ->limit($limit);
$vc = ORM::for_table('tbl_plans') $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_voucher.status', '0')
->where('tbl_plans.id', $planid) ->where('tbl_plans.id', $planid)
->where_gt('tbl_voucher.id', $from_id); ->where_gt('tbl_voucher.id', $from_id);
} else if ($from_id == 0 && $planid > 0) { } else if ($from_id == 0 && $planid > 0) {
$v = ORM::for_table('tbl_plans') $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_voucher.status', '0')
->where('tbl_plans.id', $planid) ->where('tbl_plans.id', $planid)
->limit($limit); ->limit($limit);
$vc = ORM::for_table('tbl_plans') $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_voucher.status', '0')
->where('tbl_plans.id', $planid); ->where('tbl_plans.id', $planid);
} else if ($from_id > 0 && $planid == 0) { } else if ($from_id > 0 && $planid == 0) {
$v = ORM::for_table('tbl_plans') $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_voucher.status', '0')
->where_gt('tbl_voucher.id', $from_id) ->where_gt('tbl_voucher.id', $from_id)
->limit($limit); ->limit($limit);
$vc = ORM::for_table('tbl_plans') $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_voucher.status', '0')
->where_gt('tbl_voucher.id', $from_id); ->where_gt('tbl_voucher.id', $from_id);
} else { } else {
$v = ORM::for_table('tbl_plans') $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_voucher.status', '0')
->limit($limit); ->limit($limit);
$vc = ORM::for_table('tbl_plans') $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_voucher.status', '0');
} }
if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) { if (in_array($admin['user_type'], ['SuperAdmin', 'Admin'])) {

View File

@ -23,7 +23,7 @@ switch ($action) {
case 'sync': case 'sync':
set_time_limit(-1); set_time_limit(-1);
if ($routes['2'] == 'hotspot') { 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 = ''; $log = '';
$router = ''; $router = '';
foreach ($plans as $plan) { foreach ($plans as $plan) {
@ -68,7 +68,7 @@ switch ($action) {
} }
r2(U . 'services/hotspot', 's', $log); r2(U . 'services/hotspot', 's', $log);
} else if ($routes['2'] == 'pppoe') { } 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 = ''; $log = '';
$router = ''; $router = '';
foreach ($plans as $plan) { foreach ($plans as $plan) {
@ -119,10 +119,10 @@ switch ($action) {
$name = _post('name'); $name = _post('name');
if ($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]); $d = Paginator::findMany($query, ['name' => $name]);
} else { } 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); $d = Paginator::findMany($query);
} }
@ -391,10 +391,10 @@ switch ($action) {
$name = _post('name'); $name = _post('name');
if ($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]); $d = Paginator::findMany($query, ['name' => $name]);
} else { } 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); $d = Paginator::findMany($query);
} }

View File

@ -10,22 +10,24 @@
<div class="box-header"> <div class="box-header">
<h3 class="box-title">Master</h3> <h3 class="box-title">Master</h3>
</div> </div>
<table class="table table-bordered table-striped"> <div class="table-responsive">
<tbody> <table class="table table-bordered table-striped">
{foreach $masters as $data} <tbody>
<tr> {foreach $masters as $data}
<td>{nl2br($data['commit']['message'])}</td> <tr>
<td>{Lang::dateTimeFormat(str_replace(['Z','T'],'',$data['commit']['author']['date']))}</td> <td>{nl2br($data['commit']['message'])}</td>
<td> <td>{Lang::dateTimeFormat(str_replace(['Z','T'],'',$data['commit']['author']['date']))}</td>
<a href="/update.php?update_url=https://github.com/hotspotbilling/phpnuxbill/archive/{$data['sha']}.zip" <td>
class="btn btn-sm btn-primary"> <a href="/update.php?update_url=https://github.com/hotspotbilling/phpnuxbill/archive/{$data['sha']}.zip"
update class="btn btn-sm btn-primary">
</a> update
</td> </a>
</tr> </td>
{/foreach} </tr>
</tbody> {/foreach}
</table> </tbody>
</table>
</div>
</div> </div>
</div> </div>
<div class="col-sm-6"> <div class="col-sm-6">
@ -33,22 +35,24 @@
<div class="box-header"> <div class="box-header">
<h3 class="box-title">Development</h3> <h3 class="box-title">Development</h3>
</div> </div>
<table class="table table-bordered table-striped"> <div class="table-responsive">
<tbody> <table class="table table-bordered table-striped">
{foreach $devs as $data} <tbody>
<tr> {foreach $devs as $data}
<td>{nl2br($data['commit']['message'])}</td> <tr>
<td>{Lang::dateTimeFormat(str_replace(['Z','T'],'',$data['commit']['author']['date']))}</td> <td>{nl2br($data['commit']['message'])}</td>
<td> <td>{Lang::dateTimeFormat(str_replace(['Z','T'],'',$data['commit']['author']['date']))}</td>
<a href="/update.php?update_url=https://github.com/hotspotbilling/phpnuxbill/archive/{$data['sha']}.zip" <td>
class="btn btn-sm btn-primary"> <a href="/update.php?update_url=https://github.com/hotspotbilling/phpnuxbill/archive/{$data['sha']}.zip"
update class="btn btn-sm btn-primary">
</a> update
</td> </a>
</tr> </td>
{/foreach} </tr>
</tbody> {/foreach}
</table> </tbody>
</table>
</div>
</div> </div>
</div> </div>
</div> </div>