CRM-19853 replace interval controls with numeric
authorDavid Reedy Jr <davidrjr.konadave@gmail.com>
Wed, 11 Jan 2017 03:26:58 +0000 (21:26 -0600)
committerDavid Reedy Jr <davidrjr.konadave@gmail.com>
Wed, 11 Jan 2017 03:26:58 +0000 (21:26 -0600)
CRM/Admin/Form/ScheduleReminders.php

index 9df937354d1e55740aebfd9c4a6215291f8a985b..bda05dee482a724dff39abd50c9d0c8cab9ea18e 100644 (file)
@@ -161,10 +161,10 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
     //get the frequency units.
     $this->_freqUnits = CRM_Core_SelectValues::getRecurringFrequencyUnits();
 
-    $numericOptions = CRM_Core_SelectValues::getNumericOptions(0, 30);
-
     //reminder_interval
-    $this->add('select', 'start_action_offset', ts('When'), $numericOptions);
+    $this->add('number', 'start_action_offset', ts('When'), array('style' => 'width:5em'));
+    $this->addRule('start_action_offset', ts('Value should be a positive number'), 'positiveInteger');
+
     $isActive = ts('Send email');
     $recordActivity = ts('Record activity for automated email');
     if ($providersCount) {
@@ -208,9 +208,13 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
     );
 
     $this->add('select', 'repetition_frequency_unit', ts('every'), $freqUnitsDisplay);
-    $this->add('select', 'repetition_frequency_interval', ts('every'), $numericOptions);
+    $this->add('number', 'repetition_frequency_interval', ts('every'), array('style' => 'width:5em'));
+    $this->addRule('repetition_frequency_interval', ts('Value should be a positive number'), 'positiveInteger');
+
     $this->add('select', 'end_frequency_unit', ts('until'), $freqUnitsDisplay);
-    $this->add('select', 'end_frequency_interval', ts('until'), $numericOptions);
+    $this->add('number', 'end_frequency_interval', ts('until'), array('style' => 'width:5em'));
+    $this->addRule('end_frequency_interval', ts('Value should be a positive number'), 'positiveInteger');
+
     $this->add('select', 'end_action', ts('Repetition Condition'), $condition, TRUE);
     $this->add('select', 'end_date', ts('Date Field'), $selectedMapping->getDateFields(), TRUE);