Merge branch 'ent-10793-fallo-de-filtro-en-welcome-tips' into 'develop'

Ent 10793 fallo de filtro en welcome tips

See merge request artica/pandorafms!5626
This commit is contained in:
Rafael Ameijeiras 2023-04-03 10:19:11 +00:00
commit 2a5bf21621
1 changed files with 11 additions and 14 deletions

View File

@ -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'] = '<span class="enable"></span>';
@ -626,8 +625,6 @@ class TipsWindow
if (empty($data) === true) {
$total = 0;
$data = [];
} else {
$total = $this->getTotalTips();
}
echo json_encode(