[BUGFIX] Active constraint must consider one-day events without time 74/37674/2
authorLorenz Ulrich <lorenz.ulrich@visol.ch>
Mon, 22 Sep 2014 19:01:42 +0000 (21:01 +0200)
committerPatrick Wiggelman <patrickwiggelman@roquin.nl>
Fri, 20 Mar 2015 09:39:57 +0000 (10:39 +0100)
If you have a one-day event without a time, normally you just enter a
start date, but neither a start time nor an end date nor an end time.

That way the event won't be active the whole day because for
roq_newsevent the event starts and ends at 0:00:00 of the day.

To also consider such events, an additional constraint "current single
day events without time" should be added.

Resolves: #60291
Releases: 3.1
Change-Id: Ibb3686ac1bd1946fe2dee7b5844e83919ff49a9e
Reviewed-on: http://review.typo3.org/37674
Reviewed-by: Patrick Wiggelman <patrickwiggelman@roquin.nl>
Tested-by: Patrick Wiggelman <patrickwiggelman@roquin.nl>
Classes/Domain/Repository/EventRepository.php

index b50a9b3..e2d3cb8 100644 (file)
@@ -39,7 +39,14 @@ class Tx_RoqNewsevent_Domain_Repository_EventRepository extends Tx_News_Domain_R
                 $query->lessThan('tx_roqnewsevent_startdate + tx_roqnewsevent_starttime', $timestamp),
                 $query->greaterThan('tx_roqnewsevent_startdate + tx_roqnewsevent_endtime', $timestamp),
                 $query->equals('tx_roqnewsevent_enddate', 0)
-            )
+            ),
+            // current single day event without time:
+            $query->logicalAnd(
+                               $query->greaterThan('tx_roqnewsevent_startdate + 86399', $timestamp),
+                               $query->equals('tx_roqnewsevent_starttime', 0),
+                               $query->equals('tx_roqnewsevent_enddate', 0),
+                               $query->equals('tx_roqnewsevent_endtime', 0)
+                       )
         );
 
         return $constraint;