Merge pull request #12206 from eileenmcnaughton/api_encoder
[civicrm-core.git] / CRM / Admin / Form / ScheduleReminders.php
index beec68bb85bea85de1dc57af7f282e4bc82b7586..612bcebff99ba3cc8370b4e72d1427b20acb435e 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.7                                                |
+ | CiviCRM version 5                                                  |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2018                                |
  +--------------------------------------------------------------------+
@@ -334,7 +334,9 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
         $errors['absolute_date'] = ts('Absolute date cannot be earlier than the current time.');
       }
     }
-
+    if (!CRM_Utils_Rule::email($fields['from_email'])) {
+      $errors['from_email'] = ts('Please enter a valid email address.');
+    }
     $recipientKind = array(
       'participant_role' => array(
         'name' => 'participant role',
@@ -349,6 +351,13 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
       $errors[$recipientKind[$fields['recipient']]['target_id']] = ts('If "Also include" or "Limit to" are selected, you must specify at least one %1', array(1 => $recipientKind[$fields['recipient']]['name']));
     }
 
+    //CRM-21523
+    if (!empty($fields['is_repeat']) &&
+      (empty($fields['repetition_frequency_interval']) || ($fields['end_frequency_interval'] == NULL))
+    ) {
+      $errors['is_repeat'] = ts('If you are enabling repetition you must indicate the frequency and ending term.');
+    }
+
     $actionSchedule = $self->parseActionSchedule($fields);
     if ($actionSchedule->mapping_id) {
       $mapping = CRM_Core_BAO_ActionSchedule::getMapping($actionSchedule->mapping_id);