From 3b7d478635243a7fd3cce91c224aa2626d394d97 Mon Sep 17 00:00:00 2001 From: iBNu Maksum Date: Tue, 4 Mar 2025 15:16:48 +0700 Subject: [PATCH] fix method query --- system/controllers/reports.php | 47 +++++++++++----------------------- 1 file changed, 15 insertions(+), 32 deletions(-) diff --git a/system/controllers/reports.php b/system/controllers/reports.php index bb57b8ed..b24ce39c 100644 --- a/system/controllers/reports.php +++ b/system/controllers/reports.php @@ -55,15 +55,13 @@ switch ($action) { ->where('type', $tp); if (count($mts) > 0) { if (count($mts) != count($methods)) { + $w = []; + $v = []; foreach ($mts as $mt) { - $w = []; - $v = []; - foreach ($mts as $mt) { - $w[] ='method'; - $v[] = "$mt - %"; - } - $query->where_likes($w, $v); + $w[] ='method'; + $v[] = "$mt - %"; } + $query->where_likes($w, $v); } } if (count($rts) > 0) { @@ -90,15 +88,13 @@ switch ($action) { } if (count($mts) > 0) { if (count($mts) != count($methods)) { + $w = []; + $v = []; foreach ($mts as $mt) { - $w = []; - $v = []; - foreach ($mts as $mt) { - $w[] ='method'; - $v[] = "$mt - %"; - } - $query->where_likes($w, $v); + $w[] ='method'; + $v[] = "$mt - %"; } + $query->where_likes($w, $v); } } if (count($rts) > 0) { @@ -126,17 +122,6 @@ switch ($action) { if (count($plns) > 0) { $query->where_in('plan_name', $plns); } - if (count($mts) > 0) { - if (count($mts) != count($methods)) { - $w = []; - $v = []; - foreach ($mts as $mt) { - $w[] ='method'; - $v[] = "$mt - %"; - } - $query->where_likes($w, $v); - } - } $count = $query->count(); if ($count > 0) { $result['datas'][] = $count; @@ -173,15 +158,13 @@ switch ($action) { } if (count($mts) > 0) { if (count($mts) != count($methods)) { + $w = []; + $v = []; foreach ($mts as $mt) { - $w = []; - $v = []; - foreach ($mts as $mt) { - $w[] ='method'; - $v[] = "$mt - %"; - } - $query->where_likes($w, $v); + $w[] ='method'; + $v[] = "$mt - %"; } + $query->where_likes($w, $v); } } if (count($rts) > 0) {