show dialog for Recurring Entity - Centralised
authorunknown <priyanka.karan26@gmail.com>
Fri, 10 Oct 2014 14:35:14 +0000 (15:35 +0100)
committerunknown <priyanka.karan26@gmail.com>
Fri, 10 Oct 2014 14:35:14 +0000 (15:35 +0100)
CRM/Core/Form/RecurringEntity.php
CRM/Event/Form/ManageEvent.php
templates/CRM/Core/Form/RecurringEntity.tpl
templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl

index e59f77dc813f7d800050c199118bf4d40b3a9488..30a1cd45fdfb36ceac9c04bcbf808ad5b13309d1 100644 (file)
@@ -68,12 +68,18 @@ class CRM_Core_Form_RecurringEntity {
   */
   public static $_entityType;
   
+  /**
+   * Checks current entityID has parent
+   */
+  public static $_hasParent = FALSE;
+  
   static function preProcess($entityType) {
    self::$_entityId = (int) CRM_Utils_Request::retrieve('id', 'Positive');
    self::$_entityType = $entityType;
    if (self::$_entityId && $entityType) {
      $checkParentExistsForThisId = CRM_Core_BAO_RecurringEntity::getParentFor(self::$_entityId, 'civicrm_'.$entityType);    
      if ($checkParentExistsForThisId) {
+       self::$_hasParent = TRUE;
        self::$_parentEntityId = $checkParentExistsForThisId;
        self::$_scheduleReminderDetails = CRM_Core_BAO_RecurringEntity::getReminderDetailsByEntityId($checkParentExistsForThisId, $entityType);
      }
@@ -90,7 +96,7 @@ class CRM_Core_Form_RecurringEntity {
         $excludeOptionValues[$val['value']] = date('m/d/Y', strtotime($val['value']));
       }
       self::$_excludeDateInfo = $excludeOptionValues;
-    } 
+    }
   }
   
    /**
@@ -140,6 +146,7 @@ class CRM_Core_Form_RecurringEntity {
     $form->assign('currentEntityId', self::$_entityId);
     $form->assign('entityType', self::$_entityType);
     $form->assign('scheduleReminderId', self::$_scheduleReminderID);
+    $form->assign('hasParent', self::$_hasParent);
     
     $form->_freqUnits = array('hour' => 'hour') + CRM_Core_OptionGroup::values('recur_frequency_units');
     foreach ($form->_freqUnits as $val => $label) {
index 76c60bf1618df8dcd313cc0e7ff9137827057cee..4961b9e99b8b6c3fc071408c48fb34789f9d613d 100644 (file)
@@ -190,8 +190,8 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form {
     
     //Is a repeating event
     if ($this->_isRepeatingEvent) {
-      $isRepeat = 'repeat';
-      $this->assign('isRepeat', $isRepeat);
+      $isRepeatingEntity = TRUE;
+      $this->assign('isRepeatingEntity', $isRepeatingEntity);
     }
 
     // also set up tabs
index 81977b966e0b292d8f2958316c1a71e6589b4c1b..e02f78b58c3d79c3e015703ce427a465c8540341 100644 (file)
@@ -89,8 +89,7 @@
     </div>
 </div>
 <div id="preview-dialog" class="hide-block">
-    <div id="generated_dates" class="show-block"></div>
-    
+    <div id="generated_dates" class="show-block"></div>    
 </div>
 {literal}
 <script type="text/javascript">
index 67ff59d8db234e0d3403a70d132eb7905b5edc3c..d4bce549cf19bddbdc794628f354cc720e934239 100644 (file)
@@ -47,6 +47,7 @@
         </div>
     </div>
 </div>
+{if $hasParent || $isRepeatingEntity}
 {literal}
   <script type="text/javascript">
     CRM.$(function($) {  
       }  
     });
   </script>
-  {/literal}
\ No newline at end of file
+{/literal}
+{/if}
\ No newline at end of file