Fix SQL error when there's no condition in AccountTypeTabs

This commit is contained in:
Hypolite Petovan 2018-11-17 14:15:25 -05:00
parent b4f7957f1c
commit 4790067527

View file

@ -29,13 +29,16 @@ class AccountTypeTabs
public function render(string $route_name, string $current_type = '', $condition = '', $values = [], array $queryParams = []): string
{
if ($condition) {
$condition .= 'AND ' . $condition;
}
$stmt = 'SELECT `account_type`, COUNT(*) AS `count`
FROM `profile` p
JOIN `server` s ON s.`id` = p.`server_id` AND s.`available` AND NOT s.`hidden`
WHERE p.`available`
AND NOT p.`hidden`
AND ' . $condition . '
' . $condition . '
GROUP BY p.`account_type`
ORDER BY `filled_fields` DESC, `last_activity` DESC, `updated` DESC';
$account_types = $this->connection->fetchAll($stmt, $values);