diff --git a/pandora_console/include/class/TipsWindow.class.php b/pandora_console/include/class/TipsWindow.class.php index 0dffdb7994..1c52aae4fd 100644 --- a/pandora_console/include/class/TipsWindow.class.php +++ b/pandora_console/include/class/TipsWindow.class.php @@ -301,17 +301,6 @@ class TipsWindow } - /** - * Get number of tips in database - * - * @return integer - */ - public function getTotalTips() - { - return db_get_sql('SELECT count(*) FROM twelcome_tip'); - } - - /** * Get totals tips that user can show * @@ -581,7 +570,7 @@ class TipsWindow $sql = sprintf( 'SELECT id, name AS language, title, text, url, enable FROM twelcome_tip t - LEFT JOIN tlanguage l ON t.id_lang = l.id_language + LEFT JOIN tlanguage l ON t.id_lang = l.id_language COLLATE utf8mb4_0900_ai_ci %s %s %s', $filter, $order, @@ -590,6 +579,16 @@ class TipsWindow $data = db_get_all_rows_sql($sql); + $sqlCount = sprintf( + 'SELECT count(*) + FROM twelcome_tip t + LEFT JOIN tlanguage l ON t.id_lang = l.id_language COLLATE utf8mb4_0900_ai_ci + %s', + $filter + ); + + $total = db_get_sql($sqlCount); + foreach ($data as $key => $row) { if ($row['enable'] === '1') { $data[$key]['enable'] = ''; @@ -626,8 +625,6 @@ class TipsWindow if (empty($data) === true) { $total = 0; $data = []; - } else { - $total = $this->getTotalTips(); } echo json_encode(