<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.4 |
+ | CiviCRM version 4.5 |
+--------------------------------------------------------------------+
| Copyright (C) 2011 Marty Wright |
| Licensed to CiviCRM under the Academic Free License version 3.0. |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
* $Id$
*
*/
}
//get the frequency units.
- $this->_freqUnits = array('hour' => 'hour') + CRM_Core_OptionGroup::values('recur_frequency_units');
+ $this->_freqUnits = CRM_Core_SelectValues::getScheduleReminderFrequencyUnits();
//pass the mapping ID in UPDATE mode
$mappings = CRM_Core_BAO_ActionSchedule::getMapping($mappingID);
$isActive = ts('Send email');
$recordActivity = ts('Record activity for automated email');
if ($providersCount) {
+ $this->assign('sms', $providersCount);
$title = ts('Email or SMS');
$isActive = ts('Send email or SMS');
$recordActivity = ts('Record activity for automated email or SMS');
$this->add('select', 'end_action', ts('Repetition Condition'), $condition, TRUE);
$this->add('select', 'end_date', ts('Date Field'), $sel4, TRUE);
+ $this->add('text', 'from_name', ts('From Name'));
+ $this->add('text', 'from_email', ts('From Email'));
+
$recipient = 'activity_contacts';
$recipientListingOptions = array();
$recipientListing->setMultiple(TRUE);
$this->add('hidden', 'is_recipient_listing', empty($recipientListingOptions) ? FALSE : TRUE, array('id' => 'is_recipient_listing'));
- //auto-complete url
- $dataUrl = CRM_Utils_System::url('civicrm/ajax/rest',
- 'className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=activity&reset=1',
- FALSE, NULL, FALSE
- );
-
- $this->assign('dataUrl', $dataUrl);
- //token input url
- $tokenUrl = CRM_Utils_System::url('civicrm/ajax/checkemail',
- 'noemail=1',
- FALSE, NULL, FALSE
- );
- $this->assign('tokenUrl', $tokenUrl);
- $this->add('text', 'recipient_manual_id', ts('Manual Recipients'));
+ $this->addEntityRef('recipient_manual_id', ts('Manual Recipients'), array('multiple' => TRUE, 'create' => TRUE));
$this->addElement(
'select',
*/
static function formRule($fields) {
$errors = array();
- if ((array_key_exists(1, $fields['entity']) && $fields['entity'][1][0] == 0) ||
+ if ((array_key_exists(1, $fields['entity']) && $fields['entity'][1][0] === 0) ||
(array_key_exists(2, $fields['entity']) && $fields['entity'][2][0] == 0)
) {
$errors['entity'] = ts('Please select appropriate value');
}
+ if (array_key_exists(1, $fields['entity']) && !is_numeric($fields['entity'][1][0])) {
+ if (count($fields['entity'][1]) > 1) {
+ $errors['entity'] = ts('You may only select one contact field per reminder');
+ }
+ elseif (!(array_key_exists(2, $fields['entity']) && $fields['entity'][2][0] > 0)) {
+ $errors['entity'] = ts('Please select whether the reminder is sent each year.');
+ }
+ }
+
if (!empty($fields['is_active']) &&
CRM_Utils_System::isNull($fields['subject'])
) {
return empty($errors) ? TRUE : $errors;
}
+ /**
+ * @return int
+ */
function setDefaultValues() {
if ($this->_action & CRM_Core_Action::ADD) {
$defaults['is_active'] = 1;
}
elseif (!empty($defaults['recipient_manual'])) {
$defaults['recipient'] = 'manual';
- $recipients = array();
- foreach (explode(',', $defaults['recipient_manual']) as $cid) {
- $recipients[$cid] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
- $cid,
- 'sort_name'
- );
- }
- $this->assign('recipients', $recipients);
+ $defaults['recipient_manual_id'] = $defaults['recipient_manual'];
}
}
'record_activity',
'limit_to',
'mode',
- 'sms_provider_id'
+ 'sms_provider_id',
+ 'from_name',
+ 'from_email',
);
foreach ($keys as $key) {
$params[$key] = CRM_Utils_Array::value($key, $values);