From ee3dcc05a04646811bef681282a5edf7fa6a3f05 Mon Sep 17 00:00:00 2001 From: iBNu Maksum Date: Tue, 4 Mar 2025 13:37:52 +0700 Subject: [PATCH] fix reports by methods --- system/controllers/reports.php | 40 +++++++++++++++++++++++++++------- system/lan/english.json | 4 +++- system/orm.php | 8 +++++++ 3 files changed, 43 insertions(+), 9 deletions(-) diff --git a/system/controllers/reports.php b/system/controllers/reports.php index 3c4a7554..bb57b8ed 100644 --- a/system/controllers/reports.php +++ b/system/controllers/reports.php @@ -56,7 +56,13 @@ switch ($action) { if (count($mts) > 0) { if (count($mts) != count($methods)) { foreach ($mts as $mt) { - $query->where_like('method', "$mt - %"); + $w = []; + $v = []; + foreach ($mts as $mt) { + $w[] ='method'; + $v[] = "$mt - %"; + } + $query->where_likes($w, $v); } } } @@ -85,7 +91,13 @@ switch ($action) { if (count($mts) > 0) { if (count($mts) != count($methods)) { foreach ($mts as $mt) { - $query->where_like('method', "$mt - %"); + $w = []; + $v = []; + foreach ($mts as $mt) { + $w[] ='method'; + $v[] = "$mt - %"; + } + $query->where_likes($w, $v); } } } @@ -116,9 +128,13 @@ switch ($action) { } if (count($mts) > 0) { if (count($mts) != count($methods)) { + $w = []; + $v = []; foreach ($mts as $mt) { - $query->where_like('method', "$mt - %"); + $w[] ='method'; + $v[] = "$mt - %"; } + $query->where_likes($w, $v); } } $count = $query->count(); @@ -158,7 +174,13 @@ switch ($action) { if (count($mts) > 0) { if (count($mts) != count($methods)) { foreach ($mts as $mt) { - $query->where_like('method', "$mt - %"); + $w = []; + $v = []; + foreach ($mts as $mt) { + $w[] ='method'; + $v[] = "$mt - %"; + } + $query->where_likes($w, $v); } } } @@ -348,11 +370,13 @@ switch ($action) { $query->where_in('type', $tps); } if (count($mts) > 0) { - if (count($mts) != count($methods)) { - foreach ($mts as $mt) { - $query->where_like('method', "$mt - %"); - } + $w = []; + $v = []; + foreach ($mts as $mt) { + $w[] ='method'; + $v[] = "$mt - %"; } + $query->where_likes($w, $v); } if (count($rts) > 0) { $query->where_in('routers', $rts); diff --git a/system/lan/english.json b/system/lan/english.json index 8d17c61f..6dc644d3 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -1114,5 +1114,7 @@ "3_Days": "3 Days", "7_Days": "7 Days", "Reminder_Notification_Intervals": "Reminder Notification Intervals", - "Reminder_Notify_Intervals": "Reminder Notify Intervals" + "Reminder_Notify_Intervals": "Reminder Notify Intervals", + "read_documentation": "read documentation", + "Day": "Day" } \ No newline at end of file diff --git a/system/orm.php b/system/orm.php index 46fee905..516626c7 100644 --- a/system/orm.php +++ b/system/orm.php @@ -1483,6 +1483,14 @@ class ORM implements ArrayAccess return $this->_add_simple_where($column_name, 'LIKE', $value); } + /** + * Add any WHERE ... LIKE clause to your query. + */ + public function where_likes($column = null, $values = null) + { + return $this->_addWhere('(' . implode(' LIKE ? OR ', $column) . ' LIKE ? )', $values); + } + /** * Add where WHERE ... NOT LIKE clause to your query. */