Fix for CRM-16777
[civicrm-core.git] / CRM / Event / Form / ManageEvent / TabHeader.php
index c4d3578d0e85dcbe423bfd99a9f79a52d8eb0b91..a5e7ac4cc5aee4ea803486495df27fb8e2a435a3 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014                                |
+ | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
  * $Id$
  *
  */
@@ -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
@@ -85,7 +85,7 @@ class CRM_Event_Form_ManageEvent_TabHeader {
     $tabs['location'] = array('title' => ts('Event Location')) + $default;
     $tabs['fee'] = array('title' => ts('Fees')) + $default;
     $tabs['registration'] = array('title' => ts('Online Registration')) + $default;
-    if (CRM_Core_Permission::check('administer CiviCRM')) {
+    if (CRM_Core_Permission::check('administer CiviCRM') || CRM_Event_BAO_Event::checkPermission(NULL, CRM_Core_Permission::EDIT)) {
       $tabs['reminder'] = array('title' => ts('Schedule Reminders'), 'class' => 'livePage') + $default;
     }
     $tabs['conference'] = array('title' => ts('Conference Slots')) + $default;
@@ -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);