+--------------------------------------------------------------------+
| CiviCRM version 5 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2018 |
+ | Copyright CiviCRM LLC (c) 2004-2019 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2018
+ * @copyright CiviCRM LLC (c) 2004-2019
*/
/**
// Give the context.
if (!isset($this->_context)) {
- $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this);
+ $this->_context = CRM_Utils_Request::retrieve('context', 'Alphanumeric', $this);
if (CRM_Contact_Form_Search::isSearchContext($this->_context)) {
$this->_context = 'search';
}
CRM_Activity_BAO_Activity::checkPermission($this->_activityId, CRM_Core_Action::UPDATE)
) {
$this->assign('permission', 'edit');
+ $this->assign('allow_edit_inbound_emails', CRM_Activity_BAO_Activity::checkEditInboundEmailsPermissions());
}
if (!$this->_activityTypeId && $this->_activityId) {
// Set title.
if (isset($activityTName)) {
$activityName = CRM_Utils_Array::value($this->_activityTypeId, $activityTName);
- $this->assign('pageTitle', ts('%1 Activity', array(1 => $activityName)));
if ($this->_currentlyViewedContactId) {
$displayName = CRM_Contact_BAO_Contact::displayName($this->_currentlyViewedContactId);
$params = array('id' => $this->_activityId);
CRM_Activity_BAO_Activity::retrieve($params, $this->_values);
}
+
$this->set('values', $this->_values);
}
if ($this->_action & CRM_Core_Action::UPDATE) {
+ // We filter out alternatives, in case this is a stored e-mail, before sending to front-end
+ if (isset($this->_values['details'])) {
+ $this->_values['details'] = CRM_Utils_String::stripAlternatives($this->_values['details']) ?: '';
+ }
+
+ if ($this->_activityTypeName === 'Inbound Email' &&
+ !CRM_Core_Permission::check('edit inbound email basic information and content')
+ ) {
+ $this->_fields['details']['type'] = 'static';
+ }
+
CRM_Core_Form_RecurringEntity::preProcess('civicrm_activity');
}