Skip to content

Commit

Permalink
Merge pull request #11377 from lcdservices/CRM-21523
Browse files Browse the repository at this point in the history
CRM-21523 add form rule for repetition fields in scheduled reminder form
  • Loading branch information
colemanw authored Apr 9, 2018
2 parents 2834e51 + d1095f4 commit 0699492
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CRM/Admin/Form/ScheduleReminders.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,13 @@ public static function formRule($fields, $files, $self) {
$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);
Expand Down
4 changes: 2 additions & 2 deletions templates/CRM/Admin/Form/ScheduleReminders.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@
<tr id="repeatFields" class="crm-scheduleReminder-form-block-repeatFields"><td></td><td>
<table class="form-layout-compressed">
<tr class="crm-scheduleReminder-form-block-repetition_frequency_interval">
<td class="label">{$form.repetition_frequency_interval.label}&nbsp;&nbsp;&nbsp;{$form.repetition_frequency_interval.html}</td>
<td class="label">{$form.repetition_frequency_interval.label} <span class="crm-marker">*</span>&nbsp;&nbsp;{$form.repetition_frequency_interval.html}</td>
<td>{$form.repetition_frequency_unit.html}</td>
</tr>
<tr class="crm-scheduleReminder-form-block-repetition_frequency_interval">
<td class="label">{$form.end_frequency_interval.label}&nbsp;&nbsp;&nbsp;{$form.end_frequency_interval.html}
<td class="label">{$form.end_frequency_interval.label} <span class="crm-marker">*</span>&nbsp;&nbsp;{$form.end_frequency_interval.html}
<td>{$form.end_frequency_unit.html}&nbsp;&nbsp;&nbsp;{$form.end_action.html}&nbsp;&nbsp;&nbsp;{$form.end_date.html}</td>
</tr>
</table>
Expand Down

0 comments on commit 0699492

Please sign in to comment.