Add effective end and start date, extend unit test
[civicrm-core.git] / Civi / ActionSchedule / RecipientBuilder.php
index c52f64adbb6549278a2c6a0dd83b8a945442243a..8871a4e6b6e05ae3f21182e3506411fb3bd704cb 100644 (file)
@@ -409,6 +409,12 @@ class RecipientBuilder {
       else {
         $startDateClauses[] = "DATE_SUB(!casNow, INTERVAL 1 DAY ) <= {$date}";
       }
+      if (!empty($actionSchedule->effective_start_date)) {
+        $startDateClauses[] = "'{$actionSchedule->effective_start_date}' <= {$date}";
+      }
+      if (!empty($actionSchedule->effective_end_date)) {
+        $startDateClauses[] = "'{$actionSchedule->effective_end_date}' > {$date}";
+      }
     }
     elseif ($actionSchedule->absolute_date) {
       $startDateClauses[] = "DATEDIFF(DATE('!casNow'),'{$actionSchedule->absolute_date}') = 0";