From: Coleman Watts Date: Sun, 8 Mar 2015 14:10:55 +0000 (-0400) Subject: CRM-15932 - Repeat tab must refresh page when switching repeat mode so js & vars... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c65ce93956b50472aa9b466794a3a70d955fd708;p=civicrm-core.git CRM-15932 - Repeat tab must refresh page when switching repeat mode so js & vars will get set-up --- diff --git a/CRM/Core/Form/RecurringEntity.php b/CRM/Core/Form/RecurringEntity.php index 7f73df3ec9..32bcaf4107 100644 --- a/CRM/Core/Form/RecurringEntity.php +++ b/CRM/Core/Form/RecurringEntity.php @@ -333,7 +333,7 @@ class CRM_Core_Form_RecurringEntity { } //Process this function only when you get this variable if ($params['allowRepeatConfigToSubmit'] == 1) { - if (CRM_Utils_Array::value('entity_table', $params) && CRM_Utils_Array::value('entity_id', $params) && $type) { + if (!empty($params['entity_table']) && !empty($params['entity_id']) && $type) { $params['used_for'] = $type; if (empty($params['parent_entity_id'])) { $params['parent_entity_id'] = self::$_parentEntityId; diff --git a/CRM/Event/Form/ManageEvent.php b/CRM/Event/Form/ManageEvent.php index 035b0b488d..ae92d3a363 100644 --- a/CRM/Event/Form/ManageEvent.php +++ b/CRM/Event/Form/ManageEvent.php @@ -85,7 +85,7 @@ class CRM_Event_Form_ManageEvent extends CRM_Core_Form { /** * Check if repeating event. */ - protected $_isRepeatingEvent; + public $_isRepeatingEvent; /** * Set variables up before form is built. diff --git a/CRM/Event/Form/ManageEvent/Repeat.php b/CRM/Event/Form/ManageEvent/Repeat.php index 2d9919092b..02c79fbcdf 100644 --- a/CRM/Event/Form/ManageEvent/Repeat.php +++ b/CRM/Event/Form/ManageEvent/Repeat.php @@ -101,6 +101,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { $params['dateColumns'] = array('start_date'); $params['excludeDateRangeColumns'] = array('start_date', 'end_date'); $params['entity_table'] = 'civicrm_event'; + $params['entity_id'] = $this->_id; //Unset event id unset($params['id']); @@ -164,6 +165,7 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { * @return array */ static public function getParticipantCountforEvent($listOfRelatedEntities = array()) { + $participantDetails = array(); if (!empty($listOfRelatedEntities)) { $implodeRelatedEntities = implode(',', array_map(function ($entity) { return $entity['id']; @@ -176,7 +178,6 @@ class CRM_Event_Form_ManageEvent_Repeat extends CRM_Event_Form_ManageEvent { WHERE p.event_id = e.id AND p.event_id IN ({$implodeRelatedEntities}) GROUP BY p.event_id"; $dao = CRM_Core_DAO::executeQuery($query); - $participantDetails = array(); while ($dao->fetch()) { $participantDetails['countByID'][$dao->event_id] = $dao->participant_count; $participantDetails['countByName'][$dao->event_id][$dao->event_data] = $dao->participant_count; diff --git a/CRM/Event/Form/ManageEvent/TabHeader.php b/CRM/Event/Form/ManageEvent/TabHeader.php index c4d3578d0e..ebacc9bf46 100644 --- a/CRM/Event/Form/ManageEvent/TabHeader.php +++ b/CRM/Event/Form/ManageEvent/TabHeader.php @@ -39,7 +39,7 @@ class CRM_Event_Form_ManageEvent_TabHeader { /** - * @param CRM_Core_Form $form + * @param CRM_Event_Form_ManageEvent $form * * @return array */ @@ -62,7 +62,7 @@ class CRM_Event_Form_ManageEvent_TabHeader { } /** - * @param CRM_Core_Form $form + * @param CRM_Event_Form_ManageEvent $form * * @return array * @throws Exception @@ -93,6 +93,11 @@ class CRM_Event_Form_ManageEvent_TabHeader { $tabs['pcp'] = array('title' => ts('Personal Campaigns')) + $default; $tabs['repeat'] = array('title' => ts('Repeat')) + $default; + // Repeat tab must refresh page when switching repeat mode so js & vars will get set-up + if (!$form->_isRepeatingEvent) { + unset($tabs['repeat']['class']); + } + // check if we're in shopping cart mode for events $enableCart = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::EVENT_PREFERENCES_NAME, 'enable_cart' @@ -204,7 +209,7 @@ WHERE e.id = %1 } /** - * @param $form + * @param CRM_Event_Form_ManageEvent $form */ public static function reset(&$form) { $tabs = self::process($form);