'class',
);
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($activities, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
$iFilteredTotal = $iTotal = $relGlobalTotalCount;
$selectorElements = array('sort_name', 'phone', 'email');
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($relGlobal, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
$iFilteredTotal = $iTotal = $params['total'] = count($allClientRelationships);
$selectorElements = array('relation', 'name', 'phone', 'email');
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($clientRelationships, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
$iFilteredTotal = $iTotal = $params['total'] = count($allCaseRelationships);
$selectorElements = array('relation', 'name', 'phone', 'email', 'actions');
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($caseRelationships, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
'class',
);
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($activities, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
'links',
);
}
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($batches, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
$iFilteredTotal = $iTotal;
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
$iFilteredTotal = $iTotal;
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
$iFilteredTotal = $iTotal;
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
$iFilteredTotal = $iTotal;
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
const AUTOCOMPLETE_TTL = 21600; // 6hr; 6*60*60
/**
- * @deprecated
- */
- public static function getContactList() {
- // if context is 'customfield'
- if (CRM_Utils_Array::value('context', $_GET) == 'customfield') {
- return self::contactReference();
- }
-
- $params = array('version' => 3, 'check_permissions' => TRUE);
-
- // String params
- // FIXME: param keys don't match input keys, using this array to translate
- $whitelist = array(
- 's' => 'name',
- 'fieldName' => 'field_name',
- 'tableName' => 'table_name',
- 'context' => 'context',
- 'rel' => 'rel',
- 'contact_sub_type' => 'contact_sub_type',
- 'contact_type' => 'contact_type',
- );
- foreach ($whitelist as $key => $param) {
- if (!empty($_GET[$key])) {
- $params[$param] = $_GET[$key];
- }
- }
-
- //CRM-10687: Allow quicksearch by multiple fields
- if (!empty($params['field_name'])) {
- if ($params['field_name'] == 'phone_numeric') {
- $params['name'] = preg_replace('/[^\d]/', '', $params['name']);
- }
- if (!$params['name']) {
- CRM_Utils_System::civiExit();
- }
- }
-
- // Numeric params
- $whitelist = array(
- 'limit',
- 'org',
- 'employee_id',
- 'cid',
- 'id',
- 'cmsuser',
- );
- foreach ($whitelist as $key) {
- if (!empty($_GET[$key]) && is_numeric($_GET[$key])) {
- $params[$key] = $_GET[$key];
- }
- }
-
- $result = civicrm_api('Contact', 'getquick', $params);
- CRM_Core_Page_AJAX::autocompleteResults(CRM_Utils_Array::value('values', $result), 'data');
- }
-
- /**
- * Ajax callback for custom fields of type ContactReference.
+ * Ajax callback for custom fields of type ContactReference
*
* Todo: Migrate contact reference fields to use EntityRef
*/
$contactList[] = array('id' => $value['id'], 'text' => implode(' :: ', $view));
}
- CRM_Utils_System::civiExit(json_encode($contactList));
+ CRM_Utils_JSON::output($contactList);
}
/**
}
public static function groupTree() {
+ header('Content-Type: application/json');
$gids = CRM_Utils_Type::escape($_GET['gids'], 'String');
echo CRM_Contact_BAO_GroupNestingCache::json($gids);
CRM_Utils_System::civiExit();
}
- /**
- * @deprecated
- * Old quicksearch function. No longer used in core.
- * @todo: Remove this function and associated menu entry in CiviCRM 5
- */
- public static function search() {
- $json = TRUE;
- $name = CRM_Utils_Array::value('name', $_GET, '');
- if (!array_key_exists('name', $_GET)) {
- $name = CRM_Utils_Array::value('s', $_GET) . '%';
- $json = FALSE;
- }
- $name = CRM_Utils_Type::escape($name, 'String');
- $whereIdClause = '';
- if (!empty($_GET['id'])) {
- $json = TRUE;
- if (is_numeric($_GET['id'])) {
- $id = CRM_Utils_Type::escape($_GET['id'], 'Integer');
- $whereIdClause = " AND civicrm_contact.id = {$id}";
- }
- else {
- $name = $_GET['id'];
- }
- }
-
- $elements = array();
- if ($name || isset($id)) {
- $name = $name . '%';
-
- //contact's based of relationhip type
- $relType = NULL;
- if (isset($_GET['rel'])) {
- $relation = explode('_', $_GET['rel']);
- $relType = CRM_Utils_Type::escape($relation[0], 'Integer');
- $rel = CRM_Utils_Type::escape($relation[2], 'String');
- }
-
- //shared household info
- $shared = NULL;
- if (isset($_GET['sh'])) {
- $shared = CRM_Utils_Type::escape($_GET['sh'], 'Integer');
- if ($shared == 1) {
- $contactType = 'Household';
- $cName = 'household_name';
- }
- else {
- $contactType = 'Organization';
- $cName = 'organization_name';
- }
- }
-
- // contacts of type household
- $hh = $addStreet = $addCity = NULL;
- if (isset($_GET['hh'])) {
- $hh = CRM_Utils_Type::escape($_GET['hh'], 'Integer');
- }
-
- //organization info
- $organization = $street = $city = NULL;
- if (isset($_GET['org'])) {
- $organization = CRM_Utils_Type::escape($_GET['org'], 'Integer');
- }
-
- if (isset($_GET['org']) || isset($_GET['hh'])) {
- $json = FALSE;
- $splitName = explode(' :: ', $name);
- if ($splitName) {
- $contactName = trim(CRM_Utils_Array::value('0', $splitName));
- $street = trim(CRM_Utils_Array::value('1', $splitName));
- $city = trim(CRM_Utils_Array::value('2', $splitName));
- }
- else {
- $contactName = $name;
- }
-
- if ($street) {
- $addStreet = "AND civicrm_address.street_address LIKE '$street%'";
- }
- if ($city) {
- $addCity = "AND civicrm_address.city LIKE '$city%'";
- }
- }
-
- if ($organization) {
-
- $query = "
-SELECT CONCAT_WS(' :: ',sort_name,LEFT(street_address,25),city) 'sort_name',
-civicrm_contact.id 'id'
-FROM civicrm_contact
-LEFT JOIN civicrm_address ON ( civicrm_contact.id = civicrm_address.contact_id
- AND civicrm_address.is_primary=1
- )
-WHERE civicrm_contact.contact_type='Organization' AND organization_name LIKE '%$contactName%'
-{$addStreet} {$addCity} {$whereIdClause}
-ORDER BY organization_name ";
- }
- elseif ($shared) {
- $query = "
-SELECT CONCAT_WS(':::' , sort_name, supplemental_address_1, sp.abbreviation, postal_code, cc.name )'sort_name' , civicrm_contact.id 'id' , civicrm_contact.display_name 'disp' FROM civicrm_contact LEFT JOIN civicrm_address ON (civicrm_contact.id =civicrm_address.contact_id AND civicrm_address.is_primary =1 )LEFT JOIN civicrm_state_province sp ON (civicrm_address.state_province_id =sp.id )LEFT JOIN civicrm_country cc ON (civicrm_address.country_id =cc.id )WHERE civicrm_contact.contact_type ='{$contactType}' AND {$cName} LIKE '%$name%' {$whereIdClause} ORDER BY {$cName} ";
- }
- elseif ($hh) {
- $query = "
-SELECT CONCAT_WS(' :: ' , sort_name, LEFT(street_address,25),city) 'sort_name' , location_type_id 'location_type_id', is_primary 'is_primary', is_billing 'is_billing', civicrm_contact.id 'id'
-FROM civicrm_contact
-LEFT JOIN civicrm_address ON (civicrm_contact.id =civicrm_address.contact_id AND civicrm_address.is_primary =1 )
-WHERE civicrm_contact.contact_type ='Household'
-AND household_name LIKE '%$contactName%' {$addStreet} {$addCity} {$whereIdClause} ORDER BY household_name ";
- }
- elseif ($relType) {
- if (!empty($_GET['case'])) {
- $query = "
-SELECT distinct(c.id), c.sort_name
-FROM civicrm_contact c
-LEFT JOIN civicrm_relationship ON civicrm_relationship.contact_id_{$rel} = c.id
-WHERE c.sort_name LIKE '%$name%'
-AND civicrm_relationship.relationship_type_id = $relType
-GROUP BY sort_name
-";
- }
- }
- else {
-
- $query = "
-SELECT sort_name, id
-FROM civicrm_contact
-WHERE sort_name LIKE '%$name'
-{$whereIdClause}
-ORDER BY sort_name ";
- }
-
- $limit = 10;
- if (isset($_GET['limit'])) {
- $limit = CRM_Utils_Type::escape($_GET['limit'], 'Positive');
- }
-
- $query .= " LIMIT 0,{$limit}";
-
- $dao = CRM_Core_DAO::executeQuery($query);
-
- if ($shared) {
- while ($dao->fetch()) {
- echo $dao->sort_name;
- CRM_Utils_System::civiExit();
- }
- }
- else {
- while ($dao->fetch()) {
- if ($json) {
- $elements[] = array(
- 'name' => addslashes($dao->sort_name),
- 'id' => $dao->id,
- );
- }
- else {
- echo $elements = "$dao->sort_name|$dao->id|$dao->location_type_id|$dao->is_primary|$dao->is_billing\n";
- }
- }
- //for adding new household address / organization
- if (empty($elements) && !$json && ($hh || $organization)) {
- echo CRM_Utils_Array::value('s', $_GET);
- }
- }
- }
-
- if (isset($_GET['sh'])) {
- echo "";
- CRM_Utils_System::civiExit();
- }
-
- if (empty($elements)) {
- $name = str_replace('%', '', $name);
- $elements[] = array(
- 'name' => $name,
- 'id' => $name,
- );
- }
-
- if ($json) {
- echo json_encode($elements);
- }
- CRM_Utils_System::civiExit();
- }
-
/**
* Delete custom value.
*/
public static function deleteCustomValue() {
+ header('Content-Type: text/plain');
$customValueID = CRM_Utils_Type::escape($_REQUEST['valueID'], 'Positive');
$customGroupID = CRM_Utils_Type::escape($_REQUEST['groupID'], 'Positive');
|| !$signer->validate($_REQUEST['sig'], $_REQUEST)
) {
$user = array('name' => 'error');
- echo json_encode($user);
- CRM_Utils_System::civiExit();
+ CRM_Utils_JSON::output($user);
}
$config = CRM_Core_Config::singleton();
if (isset($errors['cms_name']) || isset($errors['name'])) {
//user name is not availble
$user = array('name' => 'no');
- echo json_encode($user);
+ CRM_Utils_JSON::output($user);
}
else {
//user name is available
$user = array('name' => 'yes');
- echo json_encode($user);
+ CRM_Utils_JSON::output($user);
}
+
+ // Not reachable: JSON::output() above exits.
CRM_Utils_System::civiExit();
}
list($displayName,
$userEmail
) = CRM_Contact_BAO_Contact_Location::getEmailDetails($contactID);
+
+ header('Content-Type: text/plain');
if ($userEmail) {
echo $userEmail;
}
}
}
if ($result) {
- echo json_encode($result);
+ CRM_Utils_JSON::output($result);
}
}
}
}
if ($result) {
- echo json_encode($result);
+ CRM_Utils_JSON::output($result);
}
CRM_Utils_System::civiExit();
}
}
}
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($searchRows, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
'is_active',
);
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($relationships, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
*/
private function preProcessChainSelectFields() {
foreach ($this->_chainSelectFields as $control => $target) {
- $targetField = $this->getElement($target);
- $targetType = $targetField->getAttribute('data-callback') == 'civicrm/ajax/jqCounty' ? 'county' : 'stateProvince';
- $options = array();
- // If the control field is on the form, setup chain-select and dynamically populate options
- if ($this->elementExists($control)) {
- $controlField = $this->getElement($control);
- $controlType = $targetType == 'county' ? 'stateProvince' : 'country';
-
- $targetField->setAttribute('class', $targetField->getAttribute('class') . ' crm-chain-select-target');
-
- $css = (string) $controlField->getAttribute('class');
- $controlField->updateAttributes(array(
- 'class' => ($css ? "$css " : 'crm-select2 ') . 'crm-chain-select-control',
- 'data-target' => $target,
- ));
- $controlValue = $controlField->getValue();
- if ($controlValue) {
- $options = CRM_Core_BAO_Location::getChainSelectValues($controlValue, $controlType, TRUE);
- if (!$options) {
- $targetField->setAttribute('placeholder', $targetField->getAttribute('data-none-prompt'));
+ // The 'target' might get missing if extensions do removeElement() in a form hook.
+ if ($this->elementExists($target)) {
+ $targetField = $this->getElement($target);
+ $targetType = $targetField->getAttribute('data-callback') == 'civicrm/ajax/jqCounty' ? 'county' : 'stateProvince';
+ $options = array();
+ // If the control field is on the form, setup chain-select and dynamically populate options
+ if ($this->elementExists($control)) {
+ $controlField = $this->getElement($control);
+ $controlType = $targetType == 'county' ? 'stateProvince' : 'country';
+
+ $targetField->setAttribute('class', $targetField->getAttribute('class') . ' crm-chain-select-target');
+
+ $css = (string) $controlField->getAttribute('class');
+ $controlField->updateAttributes(array(
+ 'class' => ($css ? "$css " : 'crm-select2 ') . 'crm-chain-select-control',
+ 'data-target' => $target,
+ ));
+ $controlValue = $controlField->getValue();
+ if ($controlValue) {
+ $options = CRM_Core_BAO_Location::getChainSelectValues($controlValue, $controlType, TRUE);
+ if (!$options) {
+ $targetField->setAttribute('placeholder', $targetField->getAttribute('data-none-prompt'));
+ }
+ }
+ else {
+ $targetField->setAttribute('placeholder', $targetField->getAttribute('data-empty-prompt'));
+ $targetField->setAttribute('disabled', 'disabled');
}
}
+ // Control field not present - fall back to loading default options
else {
- $targetField->setAttribute('placeholder', $targetField->getAttribute('data-empty-prompt'));
- $targetField->setAttribute('disabled', 'disabled');
+ $options = CRM_Core_PseudoConstant::$targetType();
}
+ if (!$targetField->getAttribute('multiple')) {
+ $options = array('' => $targetField->getAttribute('placeholder')) + $options;
+ $targetField->removeAttribute('placeholder');
+ }
+ $targetField->_options = array();
+ $targetField->loadArray($options);
}
- // Control field not present - fall back to loading default options
- else {
- $options = CRM_Core_PseudoConstant::$targetType();
- }
- if (!$targetField->getAttribute('multiple')) {
- $options = array('' => $targetField->getAttribute('placeholder')) + $options;
- $targetField->removeAttribute('placeholder');
- }
- $targetField->_options = array();
- $targetField->loadArray($options);
}
}
*/
private function validateChainSelectFields() {
foreach ($this->_chainSelectFields as $control => $target) {
- if ($this->elementExists($control)) {
+ if ($this->elementExists($control) && $this->elementExists($target)) {
$controlValue = (array) $this->getElementValue($control);
$targetField = $this->getElement($target);
$controlType = $targetField->getAttribute('data-callback') == 'civicrm/ajax/jqCounty' ? 'stateProvince' : 'country';
header("Cache-Control: max-age=$ttl, public");
}
- /**
- * Send autocomplete results to the client. Input can be a simple or nested array.
- * @param array $results
- * If nested array, also provide:.
- * @param string $val
- * Array key to use as the value.
- * @param string $key
- * Array key to use as the key.
- * @deprecated
- */
- public static function autocompleteResults($results, $val = 'label', $key = 'id') {
- $output = array();
- if (is_array($results)) {
- foreach ($results as $k => $v) {
- if (is_array($v)) {
- echo $v[$val] . '|' . $v[$key] . "\n";
- }
- else {
- echo "$v|$k\n";
- }
- }
- }
- CRM_Utils_System::civiExit();
- }
-
}
<title>CiviCRM Blog</title>
<page_callback>CRM_Dashlet_Page_Blog</page_callback>
</item>
- <item>
- <path>civicrm/ajax/search</path>
- <page_callback>CRM_Contact_Page_AJAX::search</page_callback>
- <access_arguments>access CiviCRM</access_arguments>
-</item>
<item>
<path>civicrm/ajax/relation</path>
<page_callback>CRM_Contact_Page_AJAX::relationship</page_callback>
'action',
);
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($financialitems, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
if (!empty($params['is_unit_test'])) {
return array($groups, $iFilteredTotal);
}
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($groups, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
public static function add(&$params, $ids = array()) {
$id = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('id', $ids));
$component = new CRM_Mailing_DAO_Component();
- $component->id = $id;
+ if ($id) {
+ $component->id = $id;
+ $component->find(TRUE);
+ }
+
$component->copyValues($params);
if (empty($id) && empty($params['body_text'])) {
$component->body_text = CRM_Utils_String::htmlToText(CRM_Utils_Array::value('body_html', $params));
}
- if ($component->is_default && !empty($id)) {
- CRM_Core_DAO::executeQuery("UPDATE civicrm_mailing_component SET is_default = 0 WHERE component_type ='{$component->component_type}' AND id <> $id");
+ if ($component->is_default) {
+ if (!empty($id)) {
+ $sql = 'UPDATE civicrm_mailing_component SET is_default = 0 WHERE component_type = %1 AND id <> %2';
+ $sqlParams = array(
+ 1 => array($component->component_type, 'String'),
+ 2 => array($id, 'Positive'),
+ );
+ }
+ else {
+ $sql = 'UPDATE civicrm_mailing_component SET is_default = 0 WHERE component_type = %1';
+ $sqlParams = array(
+ 1 => array($component->component_type, 'String'),
+ );
+ }
+ CRM_Core_DAO::executeQuery($sql, $sqlParams);
}
$component->save();
);
$mailParams['toEmail'] = $email;
+ // Add job ID to mailParams for external email delivery service to utilise
+ $mailParams['job_id'] = $job_id;
+
CRM_Utils_Hook::alterMailParams($mailParams, 'civimail');
// CRM-10699 support custom email headers
CRM_Core_DAO::getAttribute('CRM_Mailing_DAO_Component', 'body_html')
);
- $this->add('checkbox', 'is_default', ts('Default?'));
- $this->add('checkbox', 'is_active', ts('Enabled?'));
+ $this->addYesNo('is_default', ts('Default?'));
+ $this->addYesNo('is_active', ts('Enabled?'));
$this->addFormRule(array('CRM_Mailing_Form_Component', 'dataRule'));
$baoName = $this->_BAOName;
$baoName::retrieve($params, $defaults);
}
- $defaults['is_active'] = 1;
+ else {
+ $defaults['is_active'] = 1;
+ }
return $defaults;
}
'links',
);
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encodeDataTableSelector($mailings, $sEcho, $iTotal, $iFilteredTotal, $selectorElements);
CRM_Utils_System::civiExit();
}
);
}
+ header('Content-Type: application/json');
echo CRM_Utils_JSON::encode($elements, 'value');
CRM_Utils_System::civiExit();
}
--- /dev/null
+{* file to handle db changes in 4.5.8 during upgrade *}
--- /dev/null
+{* file to handle db changes in 4.5.9 during upgrade *}
return _civicrm_api3_basic_create(_civicrm_api3_get_BAO(__FUNCTION__), $params);
}
+
+/**
+ * Adjust Metadata for Create action.
+ *
+ * The metadata is used for setting defaults, documentation & validation.
+ *
+ * @param array $spec
+ * Array of parameters determined by getfields.
+ */
+function _civicrm_api3_mailing_component_create_spec(&$spec) {
+ $spec['is_active']['api.default'] = 1;
+}
+
/**
* Get a MailingComponent.
*
* @param array $params
*/
function civicrm_api3_message_template_send($params) {
- CRM_Core_BAO_MessageTemplates::sendTemplate($params);
+ // Change external param names to internal ones
+ $fieldSpec = array();
+ _civicrm_api3_message_template_send_spec($fieldSpec);
+
+ foreach ($fieldSpec as $field => $spec) {
+ if (isset($spec['api.aliases']) && array_key_exists($field, $params)) {
+ $params[CRM_Utils_Array::first($spec['api.aliases'])] = $params[$field];
+ unset($params[$field]);
+ }
+ }
+ if (empty($params['messageTemplateID'])) {
+ if (empty($params['groupName']) || empty($params['valueName'])) {
+ // Can't use civicrm_api3_verify_mandatory for this because it would give the wrong field names
+ throw new API_Exception(
+ "Mandatory key(s) missing from params array: requires id or option_group_name + option_value_name",
+ "mandatory_missing",
+ array("fields" => array('id', 'option_group_name', 'option_value_name'))
+ );
+ }
+ }
+ CRM_Core_BAO_MessageTemplate::sendTemplate($params);
}
/**
* Array of parameters determined by getfields.
*/
function _civicrm_api3_message_template_send_spec(&$params) {
- $params['messageTemplateID']['api.required'] = 1;
- $params['messageTemplateID']['title'] = 'Message Template ID';
- $params['contactId']['api.required'] = 1;
- $params['contactId']['title'] = 'Contact ID';
- $params['toEmail']['api.required'] = 1;
- $params['toEmail']['title'] = 'To Email';
- $params['toName']['api.required'] = 1;
- $params['toName']['title'] = 'To Name';
+ $params['id']['description'] = 'ID of the template';
+ $params['id']['title'] = 'Message Template ID';
+ $params['id']['api.aliases'] = array('messageTemplateID', 'message_template_id');
+
+ $params['option_group_name']['description'] = 'option group name of the template (required if no id supplied)';
+ $params['option_group_name']['title'] = 'Option Group Name';
+ $params['option_group_name']['api.aliases'] = array('groupName');
+
+ $params['option_value_name']['description'] = 'option value name of the template (required if no id supplied)';
+ $params['option_value_name']['title'] = 'Option Value Name';
+ $params['option_value_name']['api.aliases'] = array('valueName');
+
+ $params['contact_id']['description'] = 'contact id if contact tokens are to be replaced';
+ $params['contact_id']['title'] = 'Contact ID';
+ $params['contact_id']['api.aliases'] = array('contactId');
+
+ $params['template_params']['description'] = 'additional template params (other than the ones already set in the template singleton)';
+ $params['template_params']['title'] = 'Template Params';
+ $params['template_params']['api.aliases'] = array('tplParams');
+
+ $params['from']['description'] = 'the From: header';
+ $params['from']['title'] = 'From';
+
+ $params['to_name']['description'] = 'the recipient’s name';
+ $params['to_name']['title'] = 'Recipient Name';
+ $params['to_name']['api.aliases'] = array('toName');
+
+ $params['to_email']['description'] = 'the recipient’s email - mail is sent only if set';
+ $params['to_email']['title'] = 'Recipient Email';
+ $params['to_email']['api.aliases'] = array('toEmail');
+
+ $params['cc']['description'] = 'the Cc: header';
+ $params['cc']['title'] = 'CC';
+
+ $params['bcc']['description'] = 'the Bcc: header';
+ $params['bcc']['title'] = 'BCC';
+
+ $params['reply_to']['description'] = 'the Reply-To: header';
+ $params['reply_to']['title'] = 'Reply To';
+ $params['reply_to']['api.aliases'] = array('replyTo');
+
+ $params['attachments']['description'] = 'email attachments';
+ $params['attachments']['title'] = 'Attachments';
+
+ $params['is_test']['description'] = 'whether this is a test email (and hence should include the test banner)';
+ $params['is_test']['title'] = 'Is Test';
+ $params['is_test']['api.aliases'] = array('isTest');
+
+ $params['pdf_filename']['description'] = 'filename of optional PDF version to add as attachment (do not include path)';
+ $params['pdf_filename']['title'] = 'PDF Filename';
+ $params['pdf_filename']['api.aliases'] = array('PDFFilename');
}
// http://civicrm.org/licensing
(function($, _) {
+ // FIXME: Much of this code is redundant with CRM.loadForm
var ajaxFormParams = {
dataType:'json',
beforeSubmit: function(arr, $form, options) {
$form.block();
},
+ beforeSerialize: function(form, options) {
+ // Copied from crm.ajax.js
+ if (window.CKEDITOR && window.CKEDITOR.instances) {
+ $.each(CKEDITOR.instances, function() {
+ this.updateElement && this.updateElement();
+ });
+ }
+ if (window.tinyMCE && tinyMCE.editors) {
+ $.each(tinyMCE.editors, function() {
+ this.save();
+ });
+ }
+ },
success: requestHandler,
error: errorHandler
};