From 9f42beaeb308653d72afe145a5df44af73c50f11 Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 28 Apr 2020 16:24:30 +0200 Subject: [PATCH] Fixed: Query getAll in Ampel Class Query was not retrieving correctly active Ampeln. Adapted time conditions. --- include/ampel.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/ampel.class.php b/include/ampel.class.php index 445190955..3fff64451 100644 --- a/include/ampel.class.php +++ b/include/ampel.class.php @@ -129,8 +129,12 @@ class ampel extends basis_db $qry = "SELECT *,".$beschreibung.", ".$buttontext." FROM public.tbl_ampel"; if($aktiv) { - $qry .= " WHERE (NOW()>(deadline-(vorlaufzeit || ' days')::interval)::date)"; - $qry .= " AND (NOW()<(deadline+(verfallszeit || ' days')::interval)::date)"; + // (ab sofort ODER innerhalb der Vorlaufzeit) + $qry .= " WHERE (vorlaufzeit IS NULL OR (NOW()>(deadline -(vorlaufzeit || ' days')::interval)::date))"; + // UND (nicht abgelaufen... + $qry .= " AND ((NOW()<(deadline+(verfallszeit || ' days')::interval)::date)"; + // ...ODER ohne Verfallszeit) + $qry .= " OR verfallszeit IS NULL)"; } $qry .= " ORDER BY deadline";