Compare commits

...

3 Commits

Author SHA1 Message Date
Jürgen Mummert 3a24b24b84 Fix event filter location and tags column mapping 2026-02-22 11:13:03 +01:00
Jürgen Mummert 68d7f9ef66 Fix calendar query for instances without tl_calendar.published 2026-02-22 11:08:07 +01:00
Jürgen Mummert 9668a455f3 Fix DBAL parameter types in event filter queries 2026-02-22 11:04:09 +01:00
@@ -11,6 +11,7 @@ use Contao\ModuleModel;
use Contao\StringUtil;
use Doctrine\DBAL\ArrayParameterType;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ParameterType;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
@@ -48,29 +49,25 @@ class EventFilterController extends AbstractFrontendModuleController
<<<'SQL'
SELECT e.id
FROM tl_calendar_events e
INNER JOIN tl_calendar c ON c.id=e.pid
WHERE e.published='1'
AND c.published='1'
AND (e.startTime>=? OR e.endTime>=?)
ORDER BY e.startTime ASC
SQL,
[$today, $today],
[\PDO::PARAM_INT, \PDO::PARAM_INT],
[ParameterType::INTEGER, ParameterType::INTEGER],
)->fetchFirstColumn();
} else {
$rows = $this->connection->executeQuery(
<<<'SQL'
SELECT e.id
FROM tl_calendar_events e
INNER JOIN tl_calendar c ON c.id=e.pid
WHERE e.pid IN (?)
AND e.published='1'
AND c.published='1'
AND (e.startTime>=? OR e.endTime>=?)
ORDER BY e.startTime ASC
SQL,
[$calendarIds, $today, $today],
[ArrayParameterType::INTEGER, \PDO::PARAM_INT, \PDO::PARAM_INT],
[ArrayParameterType::INTEGER, ParameterType::INTEGER, ParameterType::INTEGER],
)->fetchFirstColumn();
}
@@ -90,12 +87,12 @@ class EventFilterController extends AbstractFrontendModuleController
$rows = $this->connection->executeQuery(
<<<'SQL'
SELECT t.id, t.tag, COUNT(DISTINCT r.item_id) AS total
SELECT t.id, t.tag, COUNT(DISTINCT r.pid) AS total
FROM tl_tags_rel r
INNER JOIN tl_tags t ON t.id=r.tag_id
WHERE r.ptable='tl_calendar_events'
AND r.field='tags'
AND r.item_id IN (?)
AND r.pid IN (?)
GROUP BY t.id, t.tag
ORDER BY t.tag ASC
SQL,
@@ -131,9 +128,9 @@ class EventFilterController extends AbstractFrontendModuleController
<<<'SQL'
SELECT l.id, l.title, COUNT(e.id) AS total
FROM tl_calendar_events e
INNER JOIN tl_location l ON l.id=e.location
INNER JOIN tl_location l ON l.id=e.location_id
WHERE e.id IN (?)
AND e.location>0
AND e.location_id>0
GROUP BY l.id, l.title
ORDER BY l.title ASC
SQL,