CRM-15536 fix - Scheduled reminders: Clarify "Limit to" and "Also include" UI to...
authormonishdeb <monish.deb@webaccessglobal.com>
Sat, 15 Nov 2014 15:20:40 +0000 (20:50 +0530)
committermonishdeb <monish.deb@webaccessglobal.com>
Sat, 15 Nov 2014 15:20:40 +0000 (20:50 +0530)
https://issues.civicrm.org/jira/browse/CRM-15536

CRM/Admin/Form/ScheduleReminders.php
CRM/Core/BAO/ActionSchedule.php
templates/CRM/Admin/Form/ScheduleReminders.tpl

index 682f77432a7b077a4a7c7d4e0723f47dbff0aa0b..f957380940062327017096ef739076ffe48fc1ef 100644 (file)
@@ -77,6 +77,13 @@ class CRM_Admin_Form_ScheduleReminders extends CRM_Admin_Form {
       }
     }
 
+    if (!empty($_POST) && !empty($_POST['entity'])) {
+      $mappingID = $_POST['entity'][0];
+    }
+    elseif ($this->_mappingID) {
+      $mappingID = $this->_mappingID;
+    }
+
     $this->add(
       'text',
       'title',
index bfcba4953e92edb34ef09cae77d64d949d3bbe45..54919f065531a11d2752d21fb2116121b31a19ce 100755 (executable)
@@ -93,7 +93,7 @@ class CRM_Core_BAO_ActionSchedule extends CRM_Core_DAO_ActionSchedule {
    * @access public
    */
   static function getSelection($id = NULL) {
-    $mapping = self::getMapping($id);
+    $mapping = self::getMapping();
     $activityStatus = CRM_Core_PseudoConstant::activityStatus();
     $activityType   = CRM_Core_PseudoConstant::activityType(TRUE, TRUE);
 
index f5324e265c2c21a863877af739387e5226470622..3b565d06d4144a6155f58f77df6138f40f0b71b4 100644 (file)
             .done(function(result) {
               CRM.utils.setOptions($('#recipient_listing', $form), result.values);
             });
-          $("#recipientList, a.limit_to", $form).show();
-          $("#recipient").css("margin-left", "12px");
+          $("#recipientList", $form).show();
         } else {
           $("#recipientList", $form).hide();
           if ($('#entity_0', $form).val() !== '1' && $('#limit_to').val() == '') {
-            $('tr.recipient:visible, a.limit_to').hide();
+            $('tr.recipient:visible, a.limit_to, a.recipient').hide();
           }
         }
+        if ($('#limit_to').val() != '') {
+          $('a.limit_to, a.recipient').show();
+          $('#recipient').css("margin-left", "12px");
+        }
       }
       // CRM-14070 Hide limit-to when entity is activity
       function showHideLimitTo() {
         $('#limit_to', $form).toggle(!($('#entity_0', $form).val() == '1'));
         if ($('#entity_0', $form).val() != '1') {
           if ($('#limit_to', $form).val() == '') {
-            $('#recipient, a.limit_to').hide();
+            $('#recipient, a.limit_to, a.recipient').hide();
           }
           else {
-            $('a.limit_to').show();
+            $('a.limit_to, a.recipient').show();
           }
           $("label[for='recipient']").text('{/literal}{$recipientLabels.other}{literal}');
         }