<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.6 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
+ | Copyright CiviCRM LLC (c) 2004-2016 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
'modified_date',
);
+ /**
+ * Determine whether a schedule based on this mapping is sufficiently
+ * complete.
+ *
+ * @param \CRM_Core_DAO_ActionSchedule $schedule
+ * @return array
+ * Array (string $code => string $message).
+ * List of error messages.
+ */
+ public function validateSchedule($schedule) {
+ $errors = array();
+ if (CRM_Utils_System::isNull($schedule->entity_value) || $schedule->entity_value === '0') {
+ $errors['entity'] = ts('Please select a specific date field.');
+ }
+ elseif (count(CRM_Utils_Array::explodePadded($schedule->entity_value)) > 1) {
+ $errors['entity'] = ts('You may only select one contact field per reminder');
+ }
+ elseif (CRM_Utils_System::isNull($schedule->entity_status) || $schedule->entity_status === '0') {
+ $errors['entity'] = ts('Please select whether the reminder is sent each year.');
+ }
+
+ return $errors;
+ }
+
/**
* Generate a query to locate recipients who match the given
* schedule.
* The schedule as configured by the administrator.
* @param string $phase
* See, e.g., RecipientBuilder::PHASE_RELATION_FIRST.
+ * @param array $defaultParams
+ *
* @return \CRM_Utils_SQL_Select
- * @see RecipientBuilder
* @throws \CRM_Core_Exception
+ * @see RecipientBuilder
*/
public function createQuery($schedule, $phase, $defaultParams) {
$selectedValues = (array) \CRM_Utils_Array::explodePadded($schedule->entity_value);