CRM-15456 - Add safety checks to avoid errors when updating tabs
[civicrm-core.git] / CRM / Event / Page / Tab.php
index 8a8ab7bb7aa49dfc5aa115a3445608db02d90d8f..72d857e725f523bf6e53cf9ce39815ce521448e1 100644 (file)
@@ -62,9 +62,11 @@ class CRM_Event_Page_Tab extends CRM_Core_Page {
       $this->ajaxResponse['tabCount'] = CRM_Contact_BAO_Contact::getCountComponent('participant', $this->_contactId);
       // Refresh other tabs with related data
       $this->ajaxResponse['updateTabs'] = array(
-        '#tab_contribute' => CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId),
         '#tab_activity' => CRM_Contact_BAO_Contact::getCountComponent('activity', $this->_contactId),
       );
+      if (CRM_Core_Permission::access('CiviContribute')) {
+        $this->ajaxResponse['updateTabs']['#tab_contribute'] = CRM_Contact_BAO_Contact::getCountComponent('contribution', $this->_contactId);
+      }
     }
   }