Merge pull request #23101 from MegaphoneJon/core-1836-js
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 11 Apr 2022 19:34:44 +0000 (07:34 +1200)
committerGitHub <noreply@github.com>
Mon, 11 Apr 2022 19:34:44 +0000 (07:34 +1200)
core#1836 - restrict scheduled reminder 'Also Include' to non-events

templates/CRM/Admin/Form/ScheduleReminders.tpl

index 95d5cefe17874cc59cf9041425bafa8f7ae93bd7..25fb8e16fdd143887056b09b074d395b2003f7a2 100644 (file)
 
       // CRM-14070 Hide limit-to when entity is activity
       function showHideLimitTo() {
+        // '1' is the value of "Activity" in the entity select box.
         $('#limit_to', $form).toggle(!($('#entity_0', $form).val() == '1'));
         if ($('#entity_0', $form).val() != '1' || !($('#entity_0').length)) {
+          // Some Event entity is selected.
+          if (['2', '3', '5'].includes($('#entity_0', $form).val())) {
+            $('#limit_to option[value="0"]', $form).attr('disabled','disabled').removeAttr('selected');
+          }
+          else {
+            $('#limit_to option[value="0"]', $form).removeAttr('disabled');
+          }
+          // Anything but Activity is selected.
           if ($('#limit_to', $form).val() == '') {
             $('tr.recipient:visible, #recipientList, #recipient, a.recipient').hide();
             $('a.limit_to').show();
           $("label[for='recipient']").text('{/literal}{$recipientLabels.other}{literal}');
         }
         else {
+          // Activity is selected.
           $('#recipient, a.recipient').show()
           $('#recipient').css("margin-left", "-2px");
           $('a.limit_to').hide();