diff --git a/CRM/Core/Form/RecurringEntity.php b/CRM/Core/Form/RecurringEntity.php index 8f3b4d8898da..d5367e1e9fe6 100644 --- a/CRM/Core/Form/RecurringEntity.php +++ b/CRM/Core/Form/RecurringEntity.php @@ -138,7 +138,7 @@ public static function setDefaultValues() { if (self::$_scheduleReminderDetails->start_action_offset) { $defaults['ends'] = 1; } - list($defaults['repeat_absolute_date']) = CRM_Utils_Date::setDateDefaults(self::$_scheduleReminderDetails->absolute_date); + $defaults['repeat_absolute_date'] = self::$_scheduleReminderDetails->absolute_date; if (self::$_scheduleReminderDetails->absolute_date) { $defaults['ends'] = 2; } @@ -184,7 +184,7 @@ public static function buildQuickForm(&$form) { $form->add('select', 'repetition_frequency_unit', ts('Repeats every'), CRM_Core_SelectValues::getRecurringFrequencyUnits(), FALSE, array('class' => 'required')); $numericOptions = CRM_Core_SelectValues::getNumericOptions(1, 30); $form->add('select', 'repetition_frequency_interval', NULL, $numericOptions, FALSE, array('class' => 'required')); - $form->addDateTime('repetition_start_date', ts('Repetition Start Date'), FALSE, array('formatType' => 'activityDateTime')); + $form->add('datepicker', 'repetition_start_date', ts('Start Date'), array(), FALSE, array('time' => TRUE)); foreach ($dayOfTheWeek as $key => $val) { $startActionCondition[] = $form->createElement('checkbox', $key, NULL, $val); } @@ -193,7 +193,7 @@ public static function buildQuickForm(&$form) { '1' => ts('day of the month'), '2' => ts('day of the week'), ); - $form->addRadio('repeats_by', ts("Repeats by"), $roptionTypes, array('required' => TRUE), NULL); + $form->addRadio('repeats_by', ts("Repeats on"), $roptionTypes, array('required' => TRUE), NULL); $form->add('select', 'limit_to', '', CRM_Core_SelectValues::getNumericOptions(1, 31)); $dayOfTheWeekNo = array( 'first' => ts('First'), @@ -215,10 +215,8 @@ public static function buildQuickForm(&$form) { unset($offsetOptions[0]); $form->add('select', 'start_action_offset', NULL, $offsetOptions, FALSE); $form->addFormRule(array('CRM_Core_Form_RecurringEntity', 'formRule')); - $form->addDate('repeat_absolute_date', ts('On'), FALSE, array('formatType' => 'mailing')); - $form->add('text', 'exclude_date_list', ts('Exclude Dates'), array( - 'class' => 'twenty', - )); + $form->add('datepicker', 'repeat_absolute_date', ts('On'), array(), FALSE, array('time' => FALSE)); + $form->add('text', 'exclude_date_list', ts('Exclude Dates'), array('class' => 'twenty')); $form->addElement('hidden', 'allowRepeatConfigToSubmit', '', array('id' => 'allowRepeatConfigToSubmit')); $form->addButtons(array( array( @@ -334,7 +332,7 @@ public static function formRule($values) { * @throws \CiviCRM_API3_Exception */ public static function postProcess($params = array(), $type, $linkedEntities = array()) { - //Check entity_id not present in params take it from class variable + // Check entity_id not present in params take it from class variable if (empty($params['entity_id'])) { $params['entity_id'] = self::$_entityId; } diff --git a/templates/CRM/Core/Form/RecurringEntity.tpl b/templates/CRM/Core/Form/RecurringEntity.tpl index 0824767dbf99..2aeb99345f5c 100644 --- a/templates/CRM/Core/Form/RecurringEntity.tpl +++ b/templates/CRM/Core/Form/RecurringEntity.tpl @@ -35,10 +35,6 @@ {/if} - - - - @@ -52,23 +48,27 @@ - - + - - + + + + + + - - + + - - + + @@ -111,19 +111,21 @@ } $('#repetition_frequency_unit', $form).each(changeFrequencyUnit).change(changeFrequencyUnit); - function disableUnselected() { - $('input:radio[name=ends], input[name=repeats_by]', $form).not(':checked').siblings(':input').prop('disabled', true).removeClass('required'); - } - disableUnselected(); + function disableEnds() { + $("#repeat_absolute_date, #start_action_offset").prop('disabled', true).removeClass('required'); - $('input:radio[name=ends], input[name=repeats_by]', $form).click(function() { - $(this).siblings(':input').prop('disabled', false).filter(':visible').addClass('required').focus(); - disableUnselected(); - }); + if ($('input[name=ends][value=2]').prop('checked')) { + $("#repeat_absolute_date").prop('disabled', false).addClass('required').focus(); + } + else if ($('input[name=ends][value=1]').prop('checked')) { + $('#start_action_offset').prop('disabled', false).addClass('required').focus(); + } + } - $('input:radio[name=ends]').siblings('.crm-clear-link').click(function() { - $('input:radio[name=ends][value=1]').prop('checked', true).trigger('click'); + $('input[name=ends]').click(function() { + disableEnds(); }); + disableEnds(); function validate() { var valid = $(':input', '#recurring-entity-block').valid(),
{$form.repetition_start_date.label}{include file="CRM/common/jcalendar.tpl" elementName=repetition_start_date}
{$form.repetition_frequency_unit.label} * {help id="id-repeats" entityType=$recurringEntityType file="CRM/Core/Form/RecurringEntity.hlp"} {$form.repetition_frequency_interval.html} {$form.repetition_frequency_unit.html}
{$form.repeats_by.label} {help id="id-repeats-by-month" entityType=$recurringEntityType file="CRM/Core/Form/RecurringEntity.hlp"}{$form.repeats_by.1.html}  {$form.limit_to.html} + {$form.repeats_by.label} *{help id="id-repeats-by-month" entityType=$recurringEntityType file="CRM/Core/Form/RecurringEntity.hlp"} {$form.repeats_by.1.html} {$form.limit_to.html}
{help id="id-repeats-by-week" entityType=$recurringEntityType file="CRM/Core/Form/RecurringEntity.hlp"}{$form.repeats_by.2.html}  {$form.entity_status_1.html}  {$form.entity_status_2.html} + {help id="id-repeats-by-week" entityType=$recurringEntityType file="CRM/Core/Form/RecurringEntity.hlp"} {$form.repeats_by.2.html} {$form.entity_status_1.html} {$form.entity_status_2.html}
  
{$form.repetition_start_date.label}{$form.repetition_start_date.html}
{$form.ends.label} * {help id="id-ends-after" entityType=$recurringEntityType file="CRM/Core/Form/RecurringEntity.hlp"}{$form.ends.1.html} {$form.start_action_offset.html} {ts}occurrences{/ts}{$form.ends.label} *{help id="id-ends-after" entityType=$recurringEntityType file="CRM/Core/Form/RecurringEntity.hlp"} {$form.ends.1.html} {$form.start_action_offset.html} {ts}occurrences{/ts}
{help id="id-ends-on" entityType=$recurringEntityType file="CRM/Core/Form/RecurringEntity.hlp"}{$form.ends.2.html} {include file="CRM/common/jcalendar.tpl" elementName=repeat_absolute_date} - {help id="id-ends-on" entityType=$recurringEntityType file="CRM/Core/Form/RecurringEntity.hlp"} {$form.ends.2.html} {$form.repeat_absolute_date.html}
{$form.exclude_date_list.label} {help id="id-exclude-date" entityType=$recurringEntityType file="CRM/Core/Form/RecurringEntity.hlp"}