diff --git a/CRM/Admin/Form/RelationshipType.php b/CRM/Admin/Form/RelationshipType.php
index 9f939d2bbb53..08161516243d 100644
--- a/CRM/Admin/Form/RelationshipType.php
+++ b/CRM/Admin/Form/RelationshipType.php
@@ -137,14 +137,12 @@ public function postProcess() {
CRM_Core_Session::setStatus(ts('Selected Relationship type has been deleted.'), ts('Record Deleted'), 'success');
}
else {
- $ids = array();
-
// store the submitted values in an array
$params = $this->exportValues();
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, FALSE);
if ($this->_action & CRM_Core_Action::UPDATE) {
- $ids['relationshipType'] = $this->_id;
+ $params['id'] = $this->_id;
}
$cTypeA = CRM_Utils_System::explode('__',
@@ -162,7 +160,15 @@ public function postProcess() {
$params['contact_sub_type_a'] = $cTypeA[1] ? $cTypeA[1] : 'NULL';
$params['contact_sub_type_b'] = $cTypeB[1] ? $cTypeB[1] : 'NULL';
- $result = CRM_Contact_BAO_RelationshipType::add($params, $ids);
+ // if label B to A is blank, insert the value label A to B for it
+ if (!strlen(trim(CRM_Utils_Array::value('name_b_a', $params)))) {
+ $params['name_b_a'] = CRM_Utils_Array::value('name_a_b', $params);
+ }
+ if (!strlen(trim(CRM_Utils_Array::value('label_b_a', $params)))) {
+ $params['label_b_a'] = CRM_Utils_Array::value('label_a_b', $params);
+ }
+
+ $result = CRM_Contact_BAO_RelationshipType::add($params);
$this->ajaxResponse['relationshipType'] = $result->toArray();
diff --git a/CRM/Admin/Form/ScheduleReminders.php b/CRM/Admin/Form/ScheduleReminders.php
index beec68bb85be..efc9d6512bbe 100644
--- a/CRM/Admin/Form/ScheduleReminders.php
+++ b/CRM/Admin/Form/ScheduleReminders.php
@@ -334,7 +334,9 @@ public static function formRule($fields, $files, $self) {
$errors['absolute_date'] = ts('Absolute date cannot be earlier than the current time.');
}
}
-
+ if (!CRM_Utils_Rule::email($fields['from_email'])) {
+ $errors['from_email'] = ts('Please enter a valid email address.');
+ }
$recipientKind = array(
'participant_role' => array(
'name' => 'participant role',
@@ -349,6 +351,13 @@ public static function formRule($fields, $files, $self) {
$errors[$recipientKind[$fields['recipient']]['target_id']] = ts('If "Also include" or "Limit to" are selected, you must specify at least one %1', array(1 => $recipientKind[$fields['recipient']]['name']));
}
+ //CRM-21523
+ if (!empty($fields['is_repeat']) &&
+ (empty($fields['repetition_frequency_interval']) || ($fields['end_frequency_interval'] == NULL))
+ ) {
+ $errors['is_repeat'] = ts('If you are enabling repetition you must indicate the frequency and ending term.');
+ }
+
$actionSchedule = $self->parseActionSchedule($fields);
if ($actionSchedule->mapping_id) {
$mapping = CRM_Core_BAO_ActionSchedule::getMapping($actionSchedule->mapping_id);
diff --git a/CRM/Case/Form/Task/PDF.php b/CRM/Case/Form/Task/PDF.php
index 881dcac7654e..336204180d57 100644
--- a/CRM/Case/Form/Task/PDF.php
+++ b/CRM/Case/Form/Task/PDF.php
@@ -50,10 +50,10 @@ class CRM_Case_Form_Task_PDF extends CRM_Case_Form_Task {
* Build all the data structures needed to build the form.
*/
public function preProcess() {
+ CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this);
$this->skipOnHold = $this->skipDeceased = FALSE;
parent::preProcess();
$this->setContactIDs();
- CRM_Contact_Form_Task_PDFLetterCommon::preProcess($this);
}
/**
diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php
index 51e8f498b2d1..b3ff125a3f8d 100644
--- a/CRM/Contact/BAO/Contact.php
+++ b/CRM/Contact/BAO/Contact.php
@@ -652,6 +652,27 @@ protected static function resolveStateProvinceID($values, $countryID) {
return NULL;
}
+ /**
+ * Get the relevant location entity for the array key.
+ *
+ * Based on the field name we determine which location entity
+ * we are dealing with. Apart from a few specific ones they
+ * are mostly 'address' (the default).
+ *
+ * @param string $fieldName
+ *
+ * @return string
+ */
+ protected static function getLocationEntityForKey($fieldName) {
+ if (in_array($fieldName, ['email', 'phone', 'im', 'openid'])) {
+ return $fieldName;
+ }
+ if ($fieldName === 'phone_ext') {
+ return 'phone';
+ }
+ return 'address';
+ }
+
/**
* Create last viewed link to recently updated contact.
*
@@ -2181,7 +2202,7 @@ public static function formatProfileContactParams(
$loc = CRM_Utils_Array::key($index, $locationType);
- $blockName = in_array($fieldName, $blocks) ? $fieldName : 'address';
+ $blockName = self::getLocationEntityForKey($fieldName);
$data[$blockName][$loc]['location_type_id'] = $locTypeId;
@@ -2219,9 +2240,6 @@ public static function formatProfileContactParams(
unset($data['phone'][$loc]['is_primary']);
}
}
- elseif ($fieldName == 'phone_ext') {
- $data['phone'][$loc]['phone_ext'] = $value;
- }
elseif ($fieldName == 'email') {
$data['email'][$loc]['email'] = $value;
if (empty($contactID)) {
@@ -2278,7 +2296,7 @@ public static function formatProfileContactParams(
$data['address'][$loc][substr($fieldName, 8)] = $value;
}
else {
- $data['address'][$loc][$fieldName] = $value;
+ $data[$blockName][$loc][$fieldName] = $value;
}
}
}
diff --git a/CRM/Contact/BAO/RelationshipType.php b/CRM/Contact/BAO/RelationshipType.php
index 656e27f62efe..07cd6e928233 100644
--- a/CRM/Contact/BAO/RelationshipType.php
+++ b/CRM/Contact/BAO/RelationshipType.php
@@ -79,26 +79,20 @@ public static function setIsActive($id, $is_active) {
* Add the relationship type in the db.
*
* @param array $params
- * (reference ) an assoc array of name/value pairs.
- * @param array $ids
- * The array that holds all the db ids.
*
* @return CRM_Contact_DAO_RelationshipType
*/
- public static function add(&$params, $ids = []) {
- $params['id'] = CRM_Utils_Array::value('id', $params, CRM_Utils_Array::value('relationshipType', $ids));
- //to change name, CRM-3336
- if (empty($params['label_a_b']) && !empty($params['name_a_b'])) {
- $params['label_a_b'] = $params['name_a_b'];
- }
-
- if (empty($params['label_b_a']) && !empty($params['name_b_a'])) {
- $params['label_b_a'] = $params['name_b_a'];
- }
+ public static function add($params) {
+ if (empty($params['id'])) {
+ // Set name to label if not set
+ if (empty($params['label_a_b']) && !empty($params['name_a_b'])) {
+ $params['label_a_b'] = $params['name_a_b'];
+ }
+ if (empty($params['label_b_a']) && !empty($params['name_b_a'])) {
+ $params['label_b_a'] = $params['name_b_a'];
+ }
- // set label to name if it's not set - but *only* for
- // ADD action. CRM-3336 as part from (CRM-3522)
- if (!$params['id']) {
+ // set label to name if it's not set
if (empty($params['name_a_b']) && !empty($params['label_a_b'])) {
$params['name_a_b'] = $params['label_a_b'];
}
@@ -110,22 +104,18 @@ public static function add(&$params, $ids = []) {
// action is taken depending upon the mode
$relationshipType = new CRM_Contact_DAO_RelationshipType();
- $relationshipType->copyValues($params);
+ $hook = empty($params['id']) ? 'create' : 'edit';
+ CRM_Utils_Hook::pre($hook, 'RelationshipType', CRM_Utils_Array::value('id', $params), $params);
- // if label B to A is blank, insert the value label A to B for it
- if (!strlen(trim($strName = CRM_Utils_Array::value('name_b_a', $params)))) {
- $relationshipType->name_b_a = CRM_Utils_Array::value('name_a_b', $params);
- }
- if (!strlen(trim($strName = CRM_Utils_Array::value('label_b_a', $params)))) {
- $relationshipType->label_b_a = CRM_Utils_Array::value('label_a_b', $params);
- }
+ $relationshipType->copyValues($params);
+ $relationshipType->save();
- $result = $relationshipType->save();
+ CRM_Utils_Hook::post($hook, 'RelationshipType', $relationshipType->id, $relationshipType);
CRM_Core_PseudoConstant::relationshipType('label', TRUE);
CRM_Core_PseudoConstant::relationshipType('name', TRUE);
CRM_Case_XMLProcessor::flushStaticCaches();
- return $result;
+ return $relationshipType;
}
/**
diff --git a/CRM/Contact/Form/Edit/Address.php b/CRM/Contact/Form/Edit/Address.php
index 366d02ba44ac..a2dceba22aa5 100644
--- a/CRM/Contact/Form/Edit/Address.php
+++ b/CRM/Contact/Form/Edit/Address.php
@@ -158,56 +158,7 @@ public static function buildQuickForm(&$form, $addressBlockCount = NULL, $sharin
}
$form->assign('geoCode', $geoCode);
- // Process any address custom data -
- $groupTree = CRM_Core_BAO_CustomGroup::getTree('Address', NULL, $entityId);
-
- if (isset($groupTree) && is_array($groupTree)) {
- // use simplified formatted groupTree
- $groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, 1, $form);
-
- // make sure custom fields are added /w element-name in the format - 'address[$blockId][custom-X]'
- foreach ($groupTree as $id => $group) {
- foreach ($group['fields'] as $fldId => $field) {
- $groupTree[$id]['fields'][$fldId]['element_custom_name'] = $field['element_name'];
- $groupTree[$id]['fields'][$fldId]['element_name'] = "address[$blockId][{$field['element_name']}]";
- }
- }
-
- $defaults = array();
- CRM_Core_BAO_CustomGroup::setDefaults($groupTree, $defaults);
-
- // since we change element name for address custom data, we need to format the setdefault values
- $addressDefaults = array();
- foreach ($defaults as $key => $val) {
- if (empty($val)) {
- continue;
- }
-
- // inorder to set correct defaults for checkbox custom data, we need to converted flat key to array
- // this works for all types custom data
- $keyValues = explode('[', str_replace(']', '', $key));
- $addressDefaults[$keyValues[0]][$keyValues[1]][$keyValues[2]] = $val;
- }
-
- $form->setDefaults($addressDefaults);
-
- // we setting the prefix to 'dnc_' below, so that we don't overwrite smarty's grouptree var.
- // And we can't set it to 'address_' because we want to set it in a slightly different format.
- CRM_Core_BAO_CustomGroup::buildQuickForm($form, $groupTree, FALSE, 'dnc_');
-
- // during contact editing : if no address is filled
- // required custom data must not produce 'required' form rule error
- // more handling done in formRule func
- CRM_Contact_Form_Edit_Address::storeRequiredCustomDataInfo($form, $groupTree);
-
- $tplGroupTree = CRM_Core_Smarty::singleton()->get_template_vars('address_groupTree');
- $tplGroupTree = empty($tplGroupTree) ? array() : $tplGroupTree;
-
- $form->assign('address_groupTree', $tplGroupTree + array($blockId => $groupTree));
- // unset the temp smarty var that got created
- $form->assign('dnc_groupTree', NULL);
- }
- // address custom data processing ends ..
+ self::addCustomDataToForm($form, $entityId, $blockId);
if ($sharing) {
// shared address
@@ -434,4 +385,64 @@ public static function storeRequiredCustomDataInfo(&$form, $groupTree) {
}
}
+ /**
+ * Add custom data to the form.
+ *
+ * @param CRM_Core_Form $form
+ * @param int $entityId
+ * @param int $blockId
+ */
+ protected static function addCustomDataToForm(&$form, $entityId, $blockId) {
+ $groupTree = CRM_Core_BAO_CustomGroup::getTree('Address', NULL, $entityId);
+
+ if (isset($groupTree) && is_array($groupTree)) {
+ // use simplified formatted groupTree
+ $groupTree = CRM_Core_BAO_CustomGroup::formatGroupTree($groupTree, 1, $form);
+
+ // make sure custom fields are added /w element-name in the format - 'address[$blockId][custom-X]'
+ foreach ($groupTree as $id => $group) {
+ foreach ($group['fields'] as $fldId => $field) {
+ $groupTree[$id]['fields'][$fldId]['element_custom_name'] = $field['element_name'];
+ $groupTree[$id]['fields'][$fldId]['element_name'] = "address[$blockId][{$field['element_name']}]";
+ }
+ }
+
+ $defaults = array();
+ CRM_Core_BAO_CustomGroup::setDefaults($groupTree, $defaults);
+
+ // since we change element name for address custom data, we need to format the setdefault values
+ $addressDefaults = array();
+ foreach ($defaults as $key => $val) {
+ if (empty($val)) {
+ continue;
+ }
+
+ // inorder to set correct defaults for checkbox custom data, we need to converted flat key to array
+ // this works for all types custom data
+ $keyValues = explode('[', str_replace(']', '', $key));
+ $addressDefaults[$keyValues[0]][$keyValues[1]][$keyValues[2]] = $val;
+ }
+
+ $form->setDefaults($addressDefaults);
+
+ // we setting the prefix to 'dnc_' below, so that we don't overwrite smarty's grouptree var.
+ // And we can't set it to 'address_' because we want to set it in a slightly different format.
+ CRM_Core_BAO_CustomGroup::buildQuickForm($form, $groupTree, FALSE, 'dnc_');
+
+ // during contact editing : if no address is filled
+ // required custom data must not produce 'required' form rule error
+ // more handling done in formRule func
+ CRM_Contact_Form_Edit_Address::storeRequiredCustomDataInfo($form, $groupTree);
+
+ $tplGroupTree = CRM_Core_Smarty::singleton()
+ ->get_template_vars('address_groupTree');
+ $tplGroupTree = empty($tplGroupTree) ? array() : $tplGroupTree;
+
+ $form->assign('address_groupTree', $tplGroupTree + array($blockId => $groupTree));
+ // unset the temp smarty var that got created
+ $form->assign('dnc_groupTree', NULL);
+ }
+ // address custom data processing ends ..
+ }
+
}
diff --git a/CRM/Contact/Form/Merge.php b/CRM/Contact/Form/Merge.php
index 53045ac9712f..ba9cfce43226 100644
--- a/CRM/Contact/Form/Merge.php
+++ b/CRM/Contact/Form/Merge.php
@@ -44,6 +44,11 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form {
var $_contactType = NULL;
+ /**
+ * @var array
+ */
+ public $criteria = array();
+
/**
* Query limit to be retained in the urls.
*
@@ -74,8 +79,9 @@ public function preProcess() {
$this->_gid = $gid = CRM_Utils_Request::retrieve('gid', 'Positive', $this, FALSE);
$this->_mergeId = CRM_Utils_Request::retrieve('mergeId', 'Positive', $this, FALSE);
$this->limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this, FALSE);
+ $this->criteria = CRM_Utils_Request::retrieve('criteria', 'Json', $this, FALSE, '{}');
- $urlParams = ['reset' => 1, 'rgid' => $this->_rgid, 'gid' => $this->_gid, 'limit' => $this->limit];
+ $urlParams = ['reset' => 1, 'rgid' => $this->_rgid, 'gid' => $this->_gid, 'limit' => $this->limit, 'criteria' => $this->criteria];
$this->bounceIfInvalid($this->_cid, $this->_oid);
@@ -100,7 +106,7 @@ public function preProcess() {
CRM_Core_Session::singleton()->pushUserContext($browseUrl);
}
- $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $gid);
+ $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $gid, json_decode($this->criteria, TRUE));
$join = CRM_Dedupe_Merger::getJoinOnDedupeTable();
$where = "de.id IS NULL";
@@ -300,7 +306,7 @@ public function postProcess() {
$message = '
' . ts('%1 has been updated.', array(1 => $name)) . ' ' . ts('Contact ID %1 has been deleted.', array(1 => $this->_oid)) . ' ';
CRM_Core_Session::setStatus($message, ts('Contacts Merged'), 'success');
- $urlParams = ['reset' => 1, 'cid' => $this->_cid, 'rgid' => $this->_rgid, 'gid' => $this->_gid, 'limit' => $this->limit];
+ $urlParams = ['reset' => 1, 'cid' => $this->_cid, 'rgid' => $this->_rgid, 'gid' => $this->_gid, 'limit' => $this->limit, 'criteria' => $this->criteria];
$contactViewUrl = CRM_Utils_System::url('civicrm/contact/view', ['reset' => 1, 'cid' => $this->_cid]);
if (!empty($formValues['_qf_Merge_submit'])) {
@@ -314,7 +320,7 @@ public function postProcess() {
}
if ($this->next && $this->_mergeId) {
- $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $this->_gid);
+ $cacheKey = CRM_Dedupe_Merger::getMergeCacheKeyString($this->_rgid, $this->_gid, json_decode($this->criteria, TRUE));
$join = CRM_Dedupe_Merger::getJoinOnDedupeTable();
$where = "de.id IS NULL";
diff --git a/CRM/Contact/Form/Task/EmailCommon.php b/CRM/Contact/Form/Task/EmailCommon.php
index 0083bc9cf90f..75bc2c7ec0d6 100644
--- a/CRM/Contact/Form/Task/EmailCommon.php
+++ b/CRM/Contact/Form/Task/EmailCommon.php
@@ -69,8 +69,12 @@ public static function preProcessFromAddress(&$form, $bounce = TRUE) {
$form->_emails = array();
- $contactID = CRM_Core_Session::singleton()->getLoggedInContactID();
- $form->_contactIds = array($contactID);
+ // @TODO remove these line and to it somewhere more appropriate. Currently some classes (e.g Case
+ // are having to re-write contactIds afterwards due to this inappropriate variable setting
+ // If we don't have any contact IDs, use the logged in contact ID
+ if (empty($form->_contactIds)) {
+ $form->_contactIds = $form->_contactIds ?: [CRM_Core_Session::getLoggedInContactID()];
+ }
$fromEmailValues = CRM_Core_BAO_Email::getFromEmail();
diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php
index acd0d3d7a720..5f486da1cde1 100644
--- a/CRM/Contact/Page/AJAX.php
+++ b/CRM/Contact/Page/AJAX.php
@@ -261,9 +261,12 @@ public static function relationship() {
}
// Save activity only for the primary (first) client
if ($i == 0 && empty($result['is_error'])) {
- CRM_Case_BAO_Case::createCaseRoleActivity($caseID, $result['id'], $relContactID);
+ CRM_Case_BAO_Case::createCaseRoleActivity($caseID, $result['id'], $relContactID, $sourceContactID);
}
}
+ if (!empty($_REQUEST['is_unit_test'])) {
+ return $ret;
+ }
CRM_Utils_JSON::output($ret);
}
@@ -646,13 +649,16 @@ public static function getDedupes() {
$gid = CRM_Utils_Request::retrieve('gid', 'Positive');
$rgid = CRM_Utils_Request::retrieve('rgid', 'Positive');
+ $null = NULL;
+ $criteria = CRM_Utils_Request::retrieve('criteria', 'Json', $null, FALSE, '{}');
$selected = isset($_REQUEST['selected']) ? CRM_Utils_Type::escape($_REQUEST['selected'], 'Integer') : 0;
if ($rowCount < 0) {
$rowCount = 0;
}
$whereClause = $orderByClause = '';
- $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid);
+ $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, json_decode($criteria, TRUE));
+
$searchRows = array();
$searchParams = self::getSearchOptionsFromRequest();
@@ -814,6 +820,7 @@ public static function getDedupes() {
'oid' => $pairInfo['entity_id2'],
'action' => 'update',
'rgid' => $rgid,
+ 'criteria' => $criteria,
'limit' => CRM_Utils_Request::retrieve('limit', 'Integer'),
];
if ($gid) {
@@ -1014,8 +1021,9 @@ public static function toggleDedupeSelect() {
$gid = CRM_Utils_Type::escape($_REQUEST['gid'], 'Integer');
$pnid = $_REQUEST['pnid'];
$isSelected = CRM_Utils_Type::escape($_REQUEST['is_selected'], 'Boolean');
+ $criteria = CRM_Utils_Request::retrieve('criteria', 'Json', $null, FALSE, '{}');
- $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid);
+ $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, json_decode($criteria, TRUE));
$params = array(
1 => array($isSelected, 'Boolean'),
diff --git a/CRM/Contact/Page/DedupeFind.php b/CRM/Contact/Page/DedupeFind.php
index 90beae0b9562..fd8e8efb62c7 100644
--- a/CRM/Contact/Page/DedupeFind.php
+++ b/CRM/Contact/Page/DedupeFind.php
@@ -63,7 +63,8 @@ public function run() {
$limit = CRM_Utils_Request::retrieve('limit', 'Integer', $this);
$rgid = CRM_Utils_Request::retrieve('rgid', 'Positive', $this);
$cid = CRM_Utils_Request::retrieve('cid', 'Positive', $this, FALSE, 0);
- $criteria = CRM_Utils_Request::retrieve('criteria', 'Json', $this, FALSE);
+
+ $criteria = CRM_Utils_Request::retrieve('criteria', 'Json', $this, FALSE, '{}');
$this->assign('criteria', $criteria);
$isConflictMode = ($context == 'conflicts');
diff --git a/CRM/Contact/Page/DedupeMerge.php b/CRM/Contact/Page/DedupeMerge.php
index d006a725bee3..83f01aa76008 100644
--- a/CRM/Contact/Page/DedupeMerge.php
+++ b/CRM/Contact/Page/DedupeMerge.php
@@ -52,13 +52,13 @@ public function run() {
* Build a queue of tasks by dividing dupe pairs in batches.
*/
public static function getRunner() {
+
$rgid = CRM_Utils_Request::retrieveValue('rgid', 'Positive');
$gid = CRM_Utils_Request::retrieveValue('gid', 'Positive');
$limit = CRM_Utils_Request::retrieveValue('limit', 'Positive');
$action = CRM_Utils_Request::retrieveValue('action', 'String');
$mode = CRM_Utils_Request::retrieveValue('mode', 'String', 'safe');
-
- $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid);
+ $criteria = CRM_Utils_Request::retrieve('criteria', 'Json', $null, FALSE, '{}');
$urlQry = array(
'reset' => 1,
@@ -66,8 +66,12 @@ public static function getRunner() {
'rgid' => $rgid,
'gid' => $gid,
'limit' => $limit,
+ 'criteria' => $criteria,
);
+ $criteria = json_decode($criteria, TRUE);
+ $cacheKeyString = CRM_Dedupe_Merger::getMergeCacheKeyString($rgid, $gid, $criteria);
+
if ($mode == 'aggressive' && !CRM_Core_Permission::check('force merge duplicate contacts')) {
CRM_Core_Session::setStatus(ts('You do not have permission to force merge duplicate contact records'), ts('Permission Denied'), 'error');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/contact/dedupefind', $urlQry));
@@ -101,7 +105,7 @@ public static function getRunner() {
for ($i = 1; $i <= ceil($total / self::BATCHLIMIT); $i++) {
$task = new CRM_Queue_Task(
array('CRM_Contact_Page_DedupeMerge', 'callBatchMerge'),
- array($rgid, $gid, $mode, self::BATCHLIMIT, $isSelected),
+ array($rgid, $gid, $mode, self::BATCHLIMIT, $isSelected, $criteria),
"Processed " . $i * self::BATCHLIMIT . " pair of duplicates out of " . $total
);
@@ -131,11 +135,12 @@ public static function getRunner() {
* 'safe' mode or 'force' mode.
* @param int $batchLimit
* @param int $isSelected
+ * @param array $criteria
*
* @return int
*/
- public static function callBatchMerge(CRM_Queue_TaskContext $ctx, $rgid, $gid, $mode = 'safe', $batchLimit, $isSelected) {
- CRM_Dedupe_Merger::batchMerge($rgid, $gid, $mode, $batchLimit, $isSelected);
+ public static function callBatchMerge(CRM_Queue_TaskContext $ctx, $rgid, $gid, $mode = 'safe', $batchLimit, $isSelected, $criteria) {
+ CRM_Dedupe_Merger::batchMerge($rgid, $gid, $mode, $batchLimit, $isSelected, $criteria);
return CRM_Queue_Task::TASK_SUCCESS;
}
diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php
index 000242ccdb3e..653f369996e9 100644
--- a/CRM/Contribute/BAO/Contribution.php
+++ b/CRM/Contribute/BAO/Contribution.php
@@ -926,13 +926,18 @@ public static function getTotalAmountAndCount($status = NULL, $startDate = NULL,
if ($endDate) {
$where[] = "receive_date <= '" . CRM_Utils_Type::escape($endDate, 'Timestamp') . "'";
}
- CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes);
- if ($financialTypes) {
- $where[] = "c.financial_type_id IN (" . implode(',', array_keys($financialTypes)) . ")";
- $where[] = "i.financial_type_id IN (" . implode(',', array_keys($financialTypes)) . ")";
- }
- else {
- $where[] = "c.financial_type_id IN (0)";
+ $financialTypeACLJoin = '';
+ if (CRM_Financial_BAO_FinancialType::isACLFinancialTypeStatus()) {
+ $financialTypeACLJoin = " LEFT JOIN civicrm_line_item i ON (i.contribution_id = c.id AND i.entity_table = 'civicrm_contribution') ";
+ $financialTypes = CRM_Contribute_PseudoConstant::financialType();
+ CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes);
+ if ($financialTypes) {
+ $where[] = "c.financial_type_id IN (" . implode(',', array_keys($financialTypes)) . ")";
+ $where[] = "i.financial_type_id IN (" . implode(',', array_keys($financialTypes)) . ")";
+ }
+ else {
+ $where[] = "c.financial_type_id IN (0)";
+ }
}
$whereCond = implode(' AND ', $where);
@@ -943,7 +948,7 @@ public static function getTotalAmountAndCount($status = NULL, $startDate = NULL,
currency
FROM civicrm_contribution c
INNER JOIN civicrm_contact contact ON ( contact.id = c.contact_id )
-LEFT JOIN civicrm_line_item i ON ( i.contribution_id = c.id AND i.entity_table = 'civicrm_contribution' )
+ $financialTypeACLJoin
WHERE $whereCond
AND ( is_test = 0 OR is_test IS NULL )
AND contact.is_deleted = 0
diff --git a/CRM/Core/CodeGen/Reflection.php b/CRM/Core/CodeGen/Reflection.php
index 6f056f585c1c..720cd87b4c3b 100644
--- a/CRM/Core/CodeGen/Reflection.php
+++ b/CRM/Core/CodeGen/Reflection.php
@@ -5,61 +5,31 @@
*/
class CRM_Core_CodeGen_Reflection extends CRM_Core_CodeGen_BaseTask {
- protected $checksum;
-
- /**
- * @var string
- */
- private $raw;
-
/**
* @return bool
* TRUE if an update is needed.
*/
public function needsUpdate() {
- if (!file_exists($this->getAbsFileName())) {
- return TRUE;
- }
-
// Generating this file is fairly cheap, and we don't have robust heuristic
// for the checksum.
- // if ($this->getSchemaChecksum() !== self::extractRegex($this->getAbsFileName(), ';\(GenCodeChecksum:([a-zA-Z0-9]+)\);')) {
- // return TRUE;
- // }
- return !$this->isApproxPhpMatch(
- file_get_contents($this->getAbsFileName()),
- $this->getRaw());
- }
+ // skip this task on test environment as the schema generation should only be triggered during installation/upgrade
+ if (CIVICRM_UF == 'UnitTests') {
+ return FALSE;
+ }
+ return TRUE;
+ }
/**
* Run generator.
*/
public function run() {
echo "Generating table list\n";
- $template = new CRM_Core_CodeGen_Util_Template('php');
+ $template = new CRM_Core_CodeGen_Util_Template('php', FALSE);
$template->assign('tables', $this->tables);
$template->assign('genCodeChecksum', 'IGNORE');
$template->run('listAll.tpl', $this->getAbsFileName());
- }
-
- /**
- * Generate the raw PHP code for the data file.
- *
- * @return string
- */
- public function getRaw() {
- if (!$this->raw) {
- $template = new CRM_Core_CodeGen_Util_Template('php');
- $template->assign('tables', $this->tables);
- $template->assign('genCodeChecksum', 'NEW');
- $this->raw = $template->fetch('listAll.tpl');
- }
- return $this->raw;
- }
-
- /**
* Get absolute file name.
*
* @return string
@@ -68,18 +38,4 @@ protected function getAbsFileName() {
return $this->config->CoreDAOCodePath . "AllCoreTables.data.php";
}
- // /**
- // * Get the checksum for the schema.
- // *
- // * @return string
- // */
- // protected function getSchemaChecksum() {
- // if (!$this->checksum) {
- // CRM_Utils_Array::flatten($this->tables, $flat);
- // ksort($flat);
- // $this->checksum = md5(json_encode($flat));
- // }
- // return $this->checksum;
- // }
-
}
diff --git a/CRM/Core/CodeGen/Util/Template.php b/CRM/Core/CodeGen/Util/Template.php
index e5a7ea36923f..66efbc386787 100644
--- a/CRM/Core/CodeGen/Util/Template.php
+++ b/CRM/Core/CodeGen/Util/Template.php
@@ -9,17 +9,23 @@ class CRM_Core_CodeGen_Util_Template {
protected $smarty;
protected $beautifier;
+ /**
+ * @var bool
+ */
+ protected $beautify;
+
/**
* @param string $filetype
+ * @param bool $beautify
*/
- public function __construct($filetype) {
+ public function __construct($filetype, $beautify = TRUE) {
$this->filetype = $filetype;
$this->smarty = CRM_Core_CodeGen_Util_Smarty::singleton()->createSmarty();
$this->assign('generated', "DO NOT EDIT. Generated by CRM_Core_CodeGen");
- if ($this->filetype === 'php') {
+ if ($this->filetype === 'php' && $beautify) {
require_once 'PHP/Beautifier.php';
// create an instance
$this->beautifier = new PHP_Beautifier();
@@ -29,6 +35,8 @@ public function __construct($filetype) {
$this->beautifier->setIndentNumber(2);
$this->beautifier->setNewLine("\n");
}
+
+ $this->beautify = $beautify;
}
/**
@@ -58,10 +66,11 @@ public function runConcat($inputs, $outpath) {
public function run($infile, $outpath) {
$contents = $this->smarty->fetch($infile);
- if ($this->filetype === 'php') {
+ if ($this->filetype === 'php' && $this->beautify) {
$this->beautifier->setInputString($contents);
$this->beautifier->process();
$contents = $this->beautifier->get();
+
// The beautifier isn't as beautiful as one would hope. Here's some extra string fudging.
$replacements = [
') ,' => '),',
@@ -71,13 +80,15 @@ public function run($infile, $outpath) {
];
$contents = str_replace(array_keys($replacements), array_values($replacements), $contents);
$contents = preg_replace('#(\s*)\\/\\*\\*#', "\n\$1/**", $contents);
+
// Convert old array syntax to new square brackets
$contents = CRM_Core_CodeGen_Util_ArraySyntaxConverter::convert($contents);
- file_put_contents($outpath, $contents);
}
- else {
- file_put_contents($outpath, $contents);
+ // Ensure file ends with a newline
+ if (substr($contents, -1) !== "\n") {
+ $contents .= "\n";
}
+ file_put_contents($outpath, $contents);
}
/**
diff --git a/CRM/Core/DAO/AllCoreTables.data.php b/CRM/Core/DAO/AllCoreTables.data.php
index 2b49bc6691a9..730aadb7b03f 100644
--- a/CRM/Core/DAO/AllCoreTables.data.php
+++ b/CRM/Core/DAO/AllCoreTables.data.php
@@ -1,789 +1,765 @@
array(
+
+return [
+ 'CRM_Core_DAO_AddressFormat' => [
'name' => 'AddressFormat',
'class' => 'CRM_Core_DAO_AddressFormat',
'table' => 'civicrm_address_format',
- ) ,
- 'CRM_Core_DAO_Extension' => array(
+ ],
+ 'CRM_Core_DAO_Extension' => [
'name' => 'Extension',
'class' => 'CRM_Core_DAO_Extension',
'table' => 'civicrm_extension',
- ) ,
- 'CRM_Core_DAO_File' => array(
+ ],
+ 'CRM_Core_DAO_File' => [
'name' => 'File',
'class' => 'CRM_Core_DAO_File',
'table' => 'civicrm_file',
- ) ,
- 'CRM_Core_DAO_LocationType' => array(
+ ],
+ 'CRM_Core_DAO_LocationType' => [
'name' => 'LocationType',
'class' => 'CRM_Core_DAO_LocationType',
'table' => 'civicrm_location_type',
- ) ,
- 'CRM_Core_DAO_Managed' => array(
+ ],
+ 'CRM_Core_DAO_Managed' => [
'name' => 'Managed',
'class' => 'CRM_Core_DAO_Managed',
'table' => 'civicrm_managed',
- ) ,
- 'CRM_Core_DAO_Mapping' => array(
+ ],
+ 'CRM_Core_DAO_Mapping' => [
'name' => 'Mapping',
'class' => 'CRM_Core_DAO_Mapping',
'table' => 'civicrm_mapping',
- ) ,
- 'CRM_Core_DAO_MessageTemplate' => array(
+ ],
+ 'CRM_Core_DAO_MessageTemplate' => [
'name' => 'MessageTemplate',
'class' => 'CRM_Core_DAO_MessageTemplate',
'table' => 'civicrm_msg_template',
- ) ,
- 'CRM_Core_DAO_OptionGroup' => array(
+ ],
+ 'CRM_Core_DAO_OptionGroup' => [
'name' => 'OptionGroup',
'class' => 'CRM_Core_DAO_OptionGroup',
'table' => 'civicrm_option_group',
- ) ,
- 'CRM_Core_DAO_PreferencesDate' => array(
+ ],
+ 'CRM_Core_DAO_PreferencesDate' => [
'name' => 'PreferencesDate',
'class' => 'CRM_Core_DAO_PreferencesDate',
'table' => 'civicrm_preferences_date',
- ) ,
- 'CRM_Core_DAO_SystemLog' => array(
+ ],
+ 'CRM_Core_DAO_SystemLog' => [
'name' => 'SystemLog',
'class' => 'CRM_Core_DAO_SystemLog',
'table' => 'civicrm_system_log',
- ) ,
- 'CRM_Core_DAO_Worldregion' => array(
+ ],
+ 'CRM_Core_DAO_Worldregion' => [
'name' => 'Worldregion',
'class' => 'CRM_Core_DAO_Worldregion',
'table' => 'civicrm_worldregion',
- ) ,
- 'CRM_Core_DAO_Component' => array(
+ ],
+ 'CRM_Core_DAO_Component' => [
'name' => 'Component',
'class' => 'CRM_Core_DAO_Component',
'table' => 'civicrm_component',
- ) ,
- 'CRM_Core_DAO_Persistent' => array(
+ ],
+ 'CRM_Core_DAO_Persistent' => [
'name' => 'Persistent',
'class' => 'CRM_Core_DAO_Persistent',
'table' => 'civicrm_persistent',
- ) ,
- 'CRM_Core_DAO_PrevNextCache' => array(
+ ],
+ 'CRM_Core_DAO_PrevNextCache' => [
'name' => 'PrevNextCache',
'class' => 'CRM_Core_DAO_PrevNextCache',
'table' => 'civicrm_prevnext_cache',
- ) ,
- 'CRM_Core_DAO_ActionMapping' => array(
+ ],
+ 'CRM_Core_DAO_ActionMapping' => [
'name' => 'ActionMapping',
'class' => 'CRM_Core_DAO_ActionMapping',
'table' => 'civicrm_action_mapping',
- ) ,
- 'CRM_Core_DAO_RecurringEntity' => array(
+ ],
+ 'CRM_Core_DAO_RecurringEntity' => [
'name' => 'RecurringEntity',
'class' => 'CRM_Core_DAO_RecurringEntity',
'table' => 'civicrm_recurring_entity',
- ) ,
- 'CRM_ACL_DAO_ACL' => array(
+ ],
+ 'CRM_ACL_DAO_ACL' => [
'name' => 'ACL',
'class' => 'CRM_ACL_DAO_ACL',
'table' => 'civicrm_acl',
- ) ,
- 'CRM_ACL_DAO_EntityRole' => array(
+ ],
+ 'CRM_ACL_DAO_EntityRole' => [
'name' => 'EntityRole',
'class' => 'CRM_ACL_DAO_EntityRole',
'table' => 'civicrm_acl_entity_role',
- ) ,
- 'CRM_Contact_DAO_Contact' => array(
+ ],
+ 'CRM_Contact_DAO_Contact' => [
'name' => 'Contact',
'class' => 'CRM_Contact_DAO_Contact',
'table' => 'civicrm_contact',
- ) ,
- 'CRM_Contact_DAO_ACLContactCache' => array(
+ ],
+ 'CRM_Contact_DAO_ACLContactCache' => [
'name' => 'ACLContactCache',
'class' => 'CRM_Contact_DAO_ACLContactCache',
'table' => 'civicrm_acl_contact_cache',
- ) ,
- 'CRM_Contact_DAO_RelationshipType' => array(
+ ],
+ 'CRM_Contact_DAO_RelationshipType' => [
'name' => 'RelationshipType',
'class' => 'CRM_Contact_DAO_RelationshipType',
'table' => 'civicrm_relationship_type',
- ) ,
- 'CRM_Contact_DAO_SavedSearch' => array(
+ ],
+ 'CRM_Contact_DAO_SavedSearch' => [
'name' => 'SavedSearch',
'class' => 'CRM_Contact_DAO_SavedSearch',
'table' => 'civicrm_saved_search',
- ) ,
- 'CRM_Contact_DAO_ContactType' => array(
+ ],
+ 'CRM_Contact_DAO_ContactType' => [
'name' => 'ContactType',
'class' => 'CRM_Contact_DAO_ContactType',
'table' => 'civicrm_contact_type',
- ) ,
- 'CRM_Batch_DAO_Batch' => array(
+ ],
+ 'CRM_Batch_DAO_Batch' => [
'name' => 'Batch',
'class' => 'CRM_Batch_DAO_Batch',
'table' => 'civicrm_batch',
- ) ,
- 'CRM_Batch_DAO_EntityBatch' => array(
+ ],
+ 'CRM_Batch_DAO_EntityBatch' => [
'name' => 'EntityBatch',
'class' => 'CRM_Batch_DAO_EntityBatch',
'table' => 'civicrm_entity_batch',
- ) ,
- 'CRM_Mailing_DAO_Component' => array(
+ ],
+ 'CRM_Mailing_DAO_Component' => [
'name' => 'Component',
'class' => 'CRM_Mailing_DAO_Component',
'table' => 'civicrm_mailing_component',
- ) ,
- 'CRM_Mailing_DAO_MailingAB' => array(
+ ],
+ 'CRM_Mailing_DAO_MailingAB' => [
'name' => 'MailingAB',
'class' => 'CRM_Mailing_DAO_MailingAB',
'table' => 'civicrm_mailing_abtest',
- ) ,
- 'CRM_Mailing_DAO_BounceType' => array(
+ ],
+ 'CRM_Mailing_DAO_BounceType' => [
'name' => 'BounceType',
'class' => 'CRM_Mailing_DAO_BounceType',
'table' => 'civicrm_mailing_bounce_type',
- ) ,
- 'CRM_Mailing_DAO_BouncePattern' => array(
+ ],
+ 'CRM_Mailing_DAO_BouncePattern' => [
'name' => 'BouncePattern',
'class' => 'CRM_Mailing_DAO_BouncePattern',
'table' => 'civicrm_mailing_bounce_pattern',
- ) ,
- 'CRM_Contribute_DAO_Premium' => array(
+ ],
+ 'CRM_Contribute_DAO_Premium' => [
'name' => 'Premium',
'class' => 'CRM_Contribute_DAO_Premium',
'table' => 'civicrm_premiums',
- ) ,
- 'CRM_Financial_DAO_Currency' => array(
+ ],
+ 'CRM_Financial_DAO_Currency' => [
'name' => 'Currency',
'class' => 'CRM_Financial_DAO_Currency',
'table' => 'civicrm_currency',
- ) ,
- 'CRM_Financial_DAO_FinancialAccount' => array(
+ ],
+ 'CRM_Financial_DAO_FinancialAccount' => [
'name' => 'FinancialAccount',
'class' => 'CRM_Financial_DAO_FinancialAccount',
'table' => 'civicrm_financial_account',
- ) ,
- 'CRM_Financial_DAO_PaymentProcessorType' => array(
+ ],
+ 'CRM_Financial_DAO_PaymentProcessorType' => [
'name' => 'PaymentProcessorType',
'class' => 'CRM_Financial_DAO_PaymentProcessorType',
'table' => 'civicrm_payment_processor_type',
- ) ,
- 'CRM_Financial_DAO_FinancialType' => array(
+ ],
+ 'CRM_Financial_DAO_FinancialType' => [
'name' => 'FinancialType',
'class' => 'CRM_Financial_DAO_FinancialType',
'table' => 'civicrm_financial_type',
- ) ,
- 'CRM_Financial_DAO_EntityFinancialAccount' => array(
+ ],
+ 'CRM_Financial_DAO_EntityFinancialAccount' => [
'name' => 'EntityFinancialAccount',
'class' => 'CRM_Financial_DAO_EntityFinancialAccount',
'table' => 'civicrm_entity_financial_account',
- ) ,
- 'CRM_Financial_DAO_FinancialItem' => array(
+ ],
+ 'CRM_Financial_DAO_FinancialItem' => [
'name' => 'FinancialItem',
'class' => 'CRM_Financial_DAO_FinancialItem',
'table' => 'civicrm_financial_item',
- ) ,
- 'CRM_Member_DAO_MembershipStatus' => array(
+ ],
+ 'CRM_Member_DAO_MembershipStatus' => [
'name' => 'MembershipStatus',
'class' => 'CRM_Member_DAO_MembershipStatus',
'table' => 'civicrm_membership_status',
- ) ,
- 'CRM_Campaign_DAO_Campaign' => array(
+ ],
+ 'CRM_Campaign_DAO_Campaign' => [
'name' => 'Campaign',
'class' => 'CRM_Campaign_DAO_Campaign',
'table' => 'civicrm_campaign',
- ) ,
- 'CRM_Campaign_DAO_CampaignGroup' => array(
+ ],
+ 'CRM_Campaign_DAO_CampaignGroup' => [
'name' => 'CampaignGroup',
'class' => 'CRM_Campaign_DAO_CampaignGroup',
'table' => 'civicrm_campaign_group',
- ) ,
- 'CRM_Campaign_DAO_Survey' => array(
+ ],
+ 'CRM_Campaign_DAO_Survey' => [
'name' => 'Survey',
'class' => 'CRM_Campaign_DAO_Survey',
'table' => 'civicrm_survey',
- ) ,
- 'CRM_Event_DAO_ParticipantStatusType' => array(
+ ],
+ 'CRM_Event_DAO_ParticipantStatusType' => [
'name' => 'ParticipantStatusType',
'class' => 'CRM_Event_DAO_ParticipantStatusType',
'table' => 'civicrm_participant_status_type',
- ) ,
- 'CRM_Event_Cart_DAO_Cart' => array(
+ ],
+ 'CRM_Event_Cart_DAO_Cart' => [
'name' => 'Cart',
'class' => 'CRM_Event_Cart_DAO_Cart',
'table' => 'civicrm_event_carts',
- ) ,
- 'CRM_Dedupe_DAO_RuleGroup' => array(
+ ],
+ 'CRM_Dedupe_DAO_RuleGroup' => [
'name' => 'RuleGroup',
'class' => 'CRM_Dedupe_DAO_RuleGroup',
'table' => 'civicrm_dedupe_rule_group',
- ) ,
- 'CRM_Dedupe_DAO_Rule' => array(
+ ],
+ 'CRM_Dedupe_DAO_Rule' => [
'name' => 'Rule',
'class' => 'CRM_Dedupe_DAO_Rule',
'table' => 'civicrm_dedupe_rule',
- ) ,
- 'CRM_Dedupe_DAO_Exception' => array(
+ ],
+ 'CRM_Dedupe_DAO_Exception' => [
'name' => 'Exception',
'class' => 'CRM_Dedupe_DAO_Exception',
'table' => 'civicrm_dedupe_exception',
- ) ,
- 'CRM_Case_DAO_CaseType' => array(
+ ],
+ 'CRM_Case_DAO_CaseType' => [
'name' => 'CaseType',
'class' => 'CRM_Case_DAO_CaseType',
'table' => 'civicrm_case_type',
- ) ,
- 'CRM_Grant_DAO_Grant' => array(
+ ],
+ 'CRM_Grant_DAO_Grant' => [
'name' => 'Grant',
'class' => 'CRM_Grant_DAO_Grant',
'table' => 'civicrm_grant',
- ) ,
- 'CRM_Friend_DAO_Friend' => array(
+ ],
+ 'CRM_Friend_DAO_Friend' => [
'name' => 'Friend',
'class' => 'CRM_Friend_DAO_Friend',
'table' => 'civicrm_tell_friend',
- ) ,
- 'CRM_Pledge_DAO_PledgeBlock' => array(
+ ],
+ 'CRM_Pledge_DAO_PledgeBlock' => [
'name' => 'PledgeBlock',
'class' => 'CRM_Pledge_DAO_PledgeBlock',
'table' => 'civicrm_pledge_block',
- ) ,
- 'CRM_Queue_DAO_QueueItem' => array(
+ ],
+ 'CRM_Queue_DAO_QueueItem' => [
'name' => 'QueueItem',
'class' => 'CRM_Queue_DAO_QueueItem',
'table' => 'civicrm_queue_item',
- ) ,
- 'CRM_PCP_DAO_PCP' => array(
+ ],
+ 'CRM_PCP_DAO_PCP' => [
'name' => 'PCP',
'class' => 'CRM_PCP_DAO_PCP',
'table' => 'civicrm_pcp',
- ) ,
- 'CRM_Cxn_DAO_Cxn' => array(
+ ],
+ 'CRM_Cxn_DAO_Cxn' => [
'name' => 'Cxn',
'class' => 'CRM_Cxn_DAO_Cxn',
'table' => 'civicrm_cxn',
- ) ,
- 'CRM_Core_DAO_Cache' => array(
+ ],
+ 'CRM_Core_DAO_Cache' => [
'name' => 'Cache',
'class' => 'CRM_Core_DAO_Cache',
'table' => 'civicrm_cache',
- ) ,
- 'CRM_Core_DAO_Country' => array(
+ ],
+ 'CRM_Core_DAO_Country' => [
'name' => 'Country',
'class' => 'CRM_Core_DAO_Country',
'table' => 'civicrm_country',
- ) ,
- 'CRM_Core_DAO_CustomGroup' => array(
+ ],
+ 'CRM_Core_DAO_CustomGroup' => [
'name' => 'CustomGroup',
'class' => 'CRM_Core_DAO_CustomGroup',
'table' => 'civicrm_custom_group',
- ) ,
- 'CRM_Core_DAO_CustomField' => array(
+ ],
+ 'CRM_Core_DAO_CustomField' => [
'name' => 'CustomField',
'class' => 'CRM_Core_DAO_CustomField',
'table' => 'civicrm_custom_field',
- ) ,
- 'CRM_Core_DAO_Domain' => array(
+ ],
+ 'CRM_Core_DAO_Domain' => [
'name' => 'Domain',
'class' => 'CRM_Core_DAO_Domain',
'table' => 'civicrm_domain',
- ) ,
- 'CRM_Core_DAO_Email' => array(
+ ],
+ 'CRM_Core_DAO_Email' => [
'name' => 'Email',
'class' => 'CRM_Core_DAO_Email',
'table' => 'civicrm_email',
- ) ,
- 'CRM_Core_DAO_EntityFile' => array(
+ ],
+ 'CRM_Core_DAO_EntityFile' => [
'name' => 'EntityFile',
'class' => 'CRM_Core_DAO_EntityFile',
'table' => 'civicrm_entity_file',
- ) ,
- 'CRM_Core_DAO_IM' => array(
+ ],
+ 'CRM_Core_DAO_IM' => [
'name' => 'IM',
'class' => 'CRM_Core_DAO_IM',
'table' => 'civicrm_im',
- ) ,
- 'CRM_Core_DAO_Job' => array(
+ ],
+ 'CRM_Core_DAO_Job' => [
'name' => 'Job',
'class' => 'CRM_Core_DAO_Job',
'table' => 'civicrm_job',
- ) ,
- 'CRM_Core_DAO_JobLog' => array(
+ ],
+ 'CRM_Core_DAO_JobLog' => [
'name' => 'JobLog',
'class' => 'CRM_Core_DAO_JobLog',
'table' => 'civicrm_job_log',
- ) ,
- 'CRM_Core_DAO_Log' => array(
+ ],
+ 'CRM_Core_DAO_Log' => [
'name' => 'Log',
'class' => 'CRM_Core_DAO_Log',
'table' => 'civicrm_log',
- ) ,
- 'CRM_Core_DAO_MailSettings' => array(
+ ],
+ 'CRM_Core_DAO_MailSettings' => [
'name' => 'MailSettings',
'class' => 'CRM_Core_DAO_MailSettings',
'table' => 'civicrm_mail_settings',
- ) ,
- 'CRM_Core_DAO_MappingField' => array(
+ ],
+ 'CRM_Core_DAO_MappingField' => [
'name' => 'MappingField',
'class' => 'CRM_Core_DAO_MappingField',
'table' => 'civicrm_mapping_field',
- ) ,
- 'CRM_Core_DAO_Menu' => array(
+ ],
+ 'CRM_Core_DAO_Menu' => [
'name' => 'Menu',
'class' => 'CRM_Core_DAO_Menu',
'table' => 'civicrm_menu',
- ) ,
- 'CRM_Core_DAO_Navigation' => array(
+ ],
+ 'CRM_Core_DAO_Navigation' => [
'name' => 'Navigation',
'class' => 'CRM_Core_DAO_Navigation',
'table' => 'civicrm_navigation',
- ) ,
- 'CRM_Core_DAO_Note' => array(
+ ],
+ 'CRM_Core_DAO_Note' => [
'name' => 'Note',
'class' => 'CRM_Core_DAO_Note',
'table' => 'civicrm_note',
- ) ,
- 'CRM_Core_DAO_OptionValue' => array(
+ ],
+ 'CRM_Core_DAO_OptionValue' => [
'name' => 'OptionValue',
'class' => 'CRM_Core_DAO_OptionValue',
'table' => 'civicrm_option_value',
- ) ,
- 'CRM_Core_DAO_Phone' => array(
+ ],
+ 'CRM_Core_DAO_Phone' => [
'name' => 'Phone',
'class' => 'CRM_Core_DAO_Phone',
'table' => 'civicrm_phone',
- ) ,
- 'CRM_Core_DAO_StateProvince' => array(
+ ],
+ 'CRM_Core_DAO_StateProvince' => [
'name' => 'StateProvince',
'class' => 'CRM_Core_DAO_StateProvince',
'table' => 'civicrm_state_province',
- ) ,
- 'CRM_Core_DAO_Tag' => array(
+ ],
+ 'CRM_Core_DAO_Tag' => [
'name' => 'Tag',
'class' => 'CRM_Core_DAO_Tag',
'table' => 'civicrm_tag',
- ) ,
- 'CRM_Core_DAO_UFMatch' => array(
+ ],
+ 'CRM_Core_DAO_UFMatch' => [
'name' => 'UFMatch',
'class' => 'CRM_Core_DAO_UFMatch',
'table' => 'civicrm_uf_match',
- ) ,
- 'CRM_Core_DAO_Timezone' => array(
+ ],
+ 'CRM_Core_DAO_Timezone' => [
'name' => 'Timezone',
'class' => 'CRM_Core_DAO_Timezone',
'table' => 'civicrm_timezone',
- ) ,
- 'CRM_Core_DAO_OpenID' => array(
+ ],
+ 'CRM_Core_DAO_OpenID' => [
'name' => 'OpenID',
'class' => 'CRM_Core_DAO_OpenID',
'table' => 'civicrm_openid',
- ) ,
- 'CRM_Core_DAO_Website' => array(
+ ],
+ 'CRM_Core_DAO_Website' => [
'name' => 'Website',
'class' => 'CRM_Core_DAO_Website',
'table' => 'civicrm_website',
- ) ,
- 'CRM_Core_DAO_Setting' => array(
+ ],
+ 'CRM_Core_DAO_Setting' => [
'name' => 'Setting',
'class' => 'CRM_Core_DAO_Setting',
'table' => 'civicrm_setting',
- ) ,
- 'CRM_Core_DAO_PrintLabel' => array(
+ ],
+ 'CRM_Core_DAO_PrintLabel' => [
'name' => 'PrintLabel',
'class' => 'CRM_Core_DAO_PrintLabel',
'table' => 'civicrm_print_label',
- ) ,
- 'CRM_Core_DAO_WordReplacement' => array(
+ ],
+ 'CRM_Core_DAO_WordReplacement' => [
'name' => 'WordReplacement',
'class' => 'CRM_Core_DAO_WordReplacement',
'table' => 'civicrm_word_replacement',
- ) ,
- 'CRM_Core_DAO_StatusPreference' => array(
+ ],
+ 'CRM_Core_DAO_StatusPreference' => [
'name' => 'StatusPreference',
'class' => 'CRM_Core_DAO_StatusPreference',
'table' => 'civicrm_status_pref',
- ) ,
- 'CRM_ACL_DAO_Cache' => array(
+ ],
+ 'CRM_ACL_DAO_Cache' => [
'name' => 'Cache',
'class' => 'CRM_ACL_DAO_Cache',
'table' => 'civicrm_acl_cache',
- ) ,
- 'CRM_Contact_DAO_Group' => array(
+ ],
+ 'CRM_Contact_DAO_Group' => [
'name' => 'Group',
'class' => 'CRM_Contact_DAO_Group',
'table' => 'civicrm_group',
- ) ,
- 'CRM_Contact_DAO_SubscriptionHistory' => array(
+ ],
+ 'CRM_Contact_DAO_SubscriptionHistory' => [
'name' => 'SubscriptionHistory',
'class' => 'CRM_Contact_DAO_SubscriptionHistory',
'table' => 'civicrm_subscription_history',
- ) ,
- 'CRM_Contact_DAO_GroupContactCache' => array(
+ ],
+ 'CRM_Contact_DAO_GroupContactCache' => [
'name' => 'GroupContactCache',
'class' => 'CRM_Contact_DAO_GroupContactCache',
'table' => 'civicrm_group_contact_cache',
- ) ,
- 'CRM_Contact_DAO_GroupNesting' => array(
+ ],
+ 'CRM_Contact_DAO_GroupNesting' => [
'name' => 'GroupNesting',
'class' => 'CRM_Contact_DAO_GroupNesting',
'table' => 'civicrm_group_nesting',
- ) ,
- 'CRM_Contact_DAO_GroupOrganization' => array(
+ ],
+ 'CRM_Contact_DAO_GroupOrganization' => [
'name' => 'GroupOrganization',
'class' => 'CRM_Contact_DAO_GroupOrganization',
'table' => 'civicrm_group_organization',
- ) ,
- 'CRM_Mailing_Event_DAO_Subscribe' => array(
+ ],
+ 'CRM_Mailing_Event_DAO_Subscribe' => [
'name' => 'Subscribe',
'class' => 'CRM_Mailing_Event_DAO_Subscribe',
'table' => 'civicrm_mailing_event_subscribe',
- ) ,
- 'CRM_Mailing_Event_DAO_Confirm' => array(
+ ],
+ 'CRM_Mailing_Event_DAO_Confirm' => [
'name' => 'Confirm',
'class' => 'CRM_Mailing_Event_DAO_Confirm',
'table' => 'civicrm_mailing_event_confirm',
- ) ,
- 'CRM_Contribute_DAO_ContributionPage' => array(
+ ],
+ 'CRM_Contribute_DAO_ContributionPage' => [
'name' => 'ContributionPage',
'class' => 'CRM_Contribute_DAO_ContributionPage',
'table' => 'civicrm_contribution_page',
- ) ,
- 'CRM_Contribute_DAO_Product' => array(
+ ],
+ 'CRM_Contribute_DAO_Product' => [
'name' => 'Product',
'class' => 'CRM_Contribute_DAO_Product',
'table' => 'civicrm_product',
- ) ,
- 'CRM_Contribute_DAO_PremiumsProduct' => array(
+ ],
+ 'CRM_Contribute_DAO_PremiumsProduct' => [
'name' => 'PremiumsProduct',
'class' => 'CRM_Contribute_DAO_PremiumsProduct',
'table' => 'civicrm_premiums_product',
- ) ,
- 'CRM_Contribute_DAO_Widget' => array(
+ ],
+ 'CRM_Contribute_DAO_Widget' => [
'name' => 'Widget',
'class' => 'CRM_Contribute_DAO_Widget',
'table' => 'civicrm_contribution_widget',
- ) ,
- 'CRM_Financial_DAO_PaymentProcessor' => array(
+ ],
+ 'CRM_Financial_DAO_PaymentProcessor' => [
'name' => 'PaymentProcessor',
'class' => 'CRM_Financial_DAO_PaymentProcessor',
'table' => 'civicrm_payment_processor',
- ) ,
- 'CRM_Financial_DAO_PaymentToken' => array(
+ ],
+ 'CRM_Financial_DAO_PaymentToken' => [
'name' => 'PaymentToken',
'class' => 'CRM_Financial_DAO_PaymentToken',
'table' => 'civicrm_payment_token',
- ) ,
- 'CRM_SMS_DAO_Provider' => array(
+ ],
+ 'CRM_SMS_DAO_Provider' => [
'name' => 'Provider',
'class' => 'CRM_SMS_DAO_Provider',
'table' => 'civicrm_sms_provider',
- ) ,
- 'CRM_Member_DAO_MembershipType' => array(
+ ],
+ 'CRM_Member_DAO_MembershipType' => [
'name' => 'MembershipType',
'class' => 'CRM_Member_DAO_MembershipType',
'table' => 'civicrm_membership_type',
- ) ,
- 'CRM_Member_DAO_MembershipBlock' => array(
+ ],
+ 'CRM_Member_DAO_MembershipBlock' => [
'name' => 'MembershipBlock',
'class' => 'CRM_Member_DAO_MembershipBlock',
'table' => 'civicrm_membership_block',
- ) ,
- 'CRM_Case_DAO_Case' => array(
+ ],
+ 'CRM_Case_DAO_Case' => [
'name' => 'Case',
'class' => 'CRM_Case_DAO_Case',
'table' => 'civicrm_case',
- ) ,
- 'CRM_Case_DAO_CaseContact' => array(
+ ],
+ 'CRM_Case_DAO_CaseContact' => [
'name' => 'CaseContact',
'class' => 'CRM_Case_DAO_CaseContact',
'table' => 'civicrm_case_contact',
- ) ,
- 'CRM_Pledge_DAO_Pledge' => array(
+ ],
+ 'CRM_Pledge_DAO_Pledge' => [
'name' => 'Pledge',
'class' => 'CRM_Pledge_DAO_Pledge',
'table' => 'civicrm_pledge',
- ) ,
- 'CRM_Report_DAO_ReportInstance' => array(
+ ],
+ 'CRM_Report_DAO_ReportInstance' => [
'name' => 'ReportInstance',
'class' => 'CRM_Report_DAO_ReportInstance',
'table' => 'civicrm_report_instance',
- ) ,
- 'CRM_Price_DAO_PriceSet' => array(
+ ],
+ 'CRM_Price_DAO_PriceSet' => [
'name' => 'PriceSet',
'class' => 'CRM_Price_DAO_PriceSet',
'table' => 'civicrm_price_set',
- ) ,
- 'CRM_Price_DAO_PriceSetEntity' => array(
+ ],
+ 'CRM_Price_DAO_PriceSetEntity' => [
'name' => 'PriceSetEntity',
'class' => 'CRM_Price_DAO_PriceSetEntity',
'table' => 'civicrm_price_set_entity',
- ) ,
- 'CRM_Core_DAO_County' => array(
+ ],
+ 'CRM_Core_DAO_County' => [
'name' => 'County',
'class' => 'CRM_Core_DAO_County',
'table' => 'civicrm_county',
- ) ,
- 'CRM_Core_DAO_Dashboard' => array(
+ ],
+ 'CRM_Core_DAO_Dashboard' => [
'name' => 'Dashboard',
'class' => 'CRM_Core_DAO_Dashboard',
'table' => 'civicrm_dashboard',
- ) ,
- 'CRM_Core_DAO_Discount' => array(
+ ],
+ 'CRM_Core_DAO_Discount' => [
'name' => 'Discount',
'class' => 'CRM_Core_DAO_Discount',
'table' => 'civicrm_discount',
- ) ,
- 'CRM_Core_DAO_EntityTag' => array(
+ ],
+ 'CRM_Core_DAO_EntityTag' => [
'name' => 'EntityTag',
'class' => 'CRM_Core_DAO_EntityTag',
'table' => 'civicrm_entity_tag',
- ) ,
- 'CRM_Core_DAO_UFGroup' => array(
+ ],
+ 'CRM_Core_DAO_UFGroup' => [
'name' => 'UFGroup',
'class' => 'CRM_Core_DAO_UFGroup',
'table' => 'civicrm_uf_group',
- ) ,
- 'CRM_Core_DAO_UFField' => array(
+ ],
+ 'CRM_Core_DAO_UFField' => [
'name' => 'UFField',
'class' => 'CRM_Core_DAO_UFField',
'table' => 'civicrm_uf_field',
- ) ,
- 'CRM_Core_DAO_UFJoin' => array(
+ ],
+ 'CRM_Core_DAO_UFJoin' => [
'name' => 'UFJoin',
'class' => 'CRM_Core_DAO_UFJoin',
'table' => 'civicrm_uf_join',
- ) ,
- 'CRM_Core_DAO_ActionSchedule' => array(
+ ],
+ 'CRM_Core_DAO_ActionSchedule' => [
'name' => 'ActionSchedule',
'class' => 'CRM_Core_DAO_ActionSchedule',
'table' => 'civicrm_action_schedule',
- ) ,
- 'CRM_Core_DAO_ActionLog' => array(
+ ],
+ 'CRM_Core_DAO_ActionLog' => [
'name' => 'ActionLog',
'class' => 'CRM_Core_DAO_ActionLog',
'table' => 'civicrm_action_log',
- ) ,
- 'CRM_Contact_DAO_DashboardContact' => array(
+ ],
+ 'CRM_Contact_DAO_DashboardContact' => [
'name' => 'DashboardContact',
'class' => 'CRM_Contact_DAO_DashboardContact',
'table' => 'civicrm_dashboard_contact',
- ) ,
- 'CRM_Contact_DAO_Relationship' => array(
+ ],
+ 'CRM_Contact_DAO_Relationship' => [
'name' => 'Relationship',
'class' => 'CRM_Contact_DAO_Relationship',
'table' => 'civicrm_relationship',
- ) ,
- 'CRM_Mailing_DAO_Mailing' => array(
+ ],
+ 'CRM_Mailing_DAO_Mailing' => [
'name' => 'Mailing',
'class' => 'CRM_Mailing_DAO_Mailing',
'table' => 'civicrm_mailing',
- ) ,
- 'CRM_Mailing_DAO_MailingGroup' => array(
+ ],
+ 'CRM_Mailing_DAO_MailingGroup' => [
'name' => 'MailingGroup',
'class' => 'CRM_Mailing_DAO_MailingGroup',
'table' => 'civicrm_mailing_group',
- ) ,
- 'CRM_Mailing_DAO_TrackableURL' => array(
+ ],
+ 'CRM_Mailing_DAO_TrackableURL' => [
'name' => 'TrackableURL',
'class' => 'CRM_Mailing_DAO_TrackableURL',
'table' => 'civicrm_mailing_trackable_url',
- ) ,
- 'CRM_Mailing_DAO_MailingJob' => array(
+ ],
+ 'CRM_Mailing_DAO_MailingJob' => [
'name' => 'MailingJob',
'class' => 'CRM_Mailing_DAO_MailingJob',
'table' => 'civicrm_mailing_job',
- ) ,
- 'CRM_Mailing_DAO_Recipients' => array(
+ ],
+ 'CRM_Mailing_DAO_Recipients' => [
'name' => 'Recipients',
'class' => 'CRM_Mailing_DAO_Recipients',
'table' => 'civicrm_mailing_recipients',
- ) ,
- 'CRM_Mailing_DAO_Spool' => array(
+ ],
+ 'CRM_Mailing_DAO_Spool' => [
'name' => 'Spool',
'class' => 'CRM_Mailing_DAO_Spool',
'table' => 'civicrm_mailing_spool',
- ) ,
- 'CRM_Mailing_Event_DAO_Queue' => array(
+ ],
+ 'CRM_Mailing_Event_DAO_Queue' => [
'name' => 'Queue',
'class' => 'CRM_Mailing_Event_DAO_Queue',
'table' => 'civicrm_mailing_event_queue',
- ) ,
- 'CRM_Mailing_Event_DAO_Bounce' => array(
+ ],
+ 'CRM_Mailing_Event_DAO_Bounce' => [
'name' => 'Bounce',
'class' => 'CRM_Mailing_Event_DAO_Bounce',
'table' => 'civicrm_mailing_event_bounce',
- ) ,
- 'CRM_Mailing_Event_DAO_Delivered' => array(
+ ],
+ 'CRM_Mailing_Event_DAO_Delivered' => [
'name' => 'Delivered',
'class' => 'CRM_Mailing_Event_DAO_Delivered',
'table' => 'civicrm_mailing_event_delivered',
- ) ,
- 'CRM_Mailing_Event_DAO_Forward' => array(
+ ],
+ 'CRM_Mailing_Event_DAO_Forward' => [
'name' => 'Forward',
'class' => 'CRM_Mailing_Event_DAO_Forward',
'table' => 'civicrm_mailing_event_forward',
- ) ,
- 'CRM_Mailing_Event_DAO_Opened' => array(
+ ],
+ 'CRM_Mailing_Event_DAO_Opened' => [
'name' => 'Opened',
'class' => 'CRM_Mailing_Event_DAO_Opened',
'table' => 'civicrm_mailing_event_opened',
- ) ,
- 'CRM_Mailing_Event_DAO_Reply' => array(
+ ],
+ 'CRM_Mailing_Event_DAO_Reply' => [
'name' => 'Reply',
'class' => 'CRM_Mailing_Event_DAO_Reply',
'table' => 'civicrm_mailing_event_reply',
- ) ,
- 'CRM_Mailing_Event_DAO_TrackableURLOpen' => array(
+ ],
+ 'CRM_Mailing_Event_DAO_TrackableURLOpen' => [
'name' => 'TrackableURLOpen',
'class' => 'CRM_Mailing_Event_DAO_TrackableURLOpen',
'table' => 'civicrm_mailing_event_trackable_url_open',
- ) ,
- 'CRM_Mailing_Event_DAO_Unsubscribe' => array(
+ ],
+ 'CRM_Mailing_Event_DAO_Unsubscribe' => [
'name' => 'Unsubscribe',
'class' => 'CRM_Mailing_Event_DAO_Unsubscribe',
'table' => 'civicrm_mailing_event_unsubscribe',
- ) ,
- 'CRM_Contribute_DAO_ContributionRecur' => array(
+ ],
+ 'CRM_Contribute_DAO_ContributionRecur' => [
'name' => 'ContributionRecur',
'class' => 'CRM_Contribute_DAO_ContributionRecur',
'table' => 'civicrm_contribution_recur',
- ) ,
- 'CRM_Financial_DAO_FinancialTrxn' => array(
+ ],
+ 'CRM_Financial_DAO_FinancialTrxn' => [
'name' => 'FinancialTrxn',
'class' => 'CRM_Financial_DAO_FinancialTrxn',
'table' => 'civicrm_financial_trxn',
- ) ,
- 'CRM_Member_DAO_Membership' => array(
+ ],
+ 'CRM_Member_DAO_Membership' => [
'name' => 'Membership',
'class' => 'CRM_Member_DAO_Membership',
'table' => 'civicrm_membership',
- ) ,
- 'CRM_Member_DAO_MembershipLog' => array(
+ ],
+ 'CRM_Member_DAO_MembershipLog' => [
'name' => 'MembershipLog',
'class' => 'CRM_Member_DAO_MembershipLog',
'table' => 'civicrm_membership_log',
- ) ,
- 'CRM_Activity_DAO_Activity' => array(
+ ],
+ 'CRM_Activity_DAO_Activity' => [
'name' => 'Activity',
'class' => 'CRM_Activity_DAO_Activity',
'table' => 'civicrm_activity',
- ) ,
- 'CRM_Activity_DAO_ActivityContact' => array(
+ ],
+ 'CRM_Activity_DAO_ActivityContact' => [
'name' => 'ActivityContact',
'class' => 'CRM_Activity_DAO_ActivityContact',
'table' => 'civicrm_activity_contact',
- ) ,
- 'CRM_Case_DAO_CaseActivity' => array(
+ ],
+ 'CRM_Case_DAO_CaseActivity' => [
'name' => 'CaseActivity',
'class' => 'CRM_Case_DAO_CaseActivity',
'table' => 'civicrm_case_activity',
- ) ,
- 'CRM_Price_DAO_PriceField' => array(
+ ],
+ 'CRM_Price_DAO_PriceField' => [
'name' => 'PriceField',
'class' => 'CRM_Price_DAO_PriceField',
'table' => 'civicrm_price_field',
- ) ,
- 'CRM_Price_DAO_PriceFieldValue' => array(
+ ],
+ 'CRM_Price_DAO_PriceFieldValue' => [
'name' => 'PriceFieldValue',
'class' => 'CRM_Price_DAO_PriceFieldValue',
'table' => 'civicrm_price_field_value',
- ) ,
- 'CRM_PCP_DAO_PCPBlock' => array(
+ ],
+ 'CRM_PCP_DAO_PCPBlock' => [
'name' => 'PCPBlock',
'class' => 'CRM_PCP_DAO_PCPBlock',
'table' => 'civicrm_pcp_block',
- ) ,
- 'CRM_Core_DAO_Address' => array(
+ ],
+ 'CRM_Core_DAO_Address' => [
'name' => 'Address',
'class' => 'CRM_Core_DAO_Address',
'table' => 'civicrm_address',
- ) ,
- 'CRM_Core_DAO_LocBlock' => array(
+ ],
+ 'CRM_Core_DAO_LocBlock' => [
'name' => 'LocBlock',
'class' => 'CRM_Core_DAO_LocBlock',
'table' => 'civicrm_loc_block',
- ) ,
- 'CRM_Contact_DAO_GroupContact' => array(
+ ],
+ 'CRM_Contact_DAO_GroupContact' => [
'name' => 'GroupContact',
'class' => 'CRM_Contact_DAO_GroupContact',
'table' => 'civicrm_group_contact',
- ) ,
- 'CRM_Contribute_DAO_Contribution' => array(
+ ],
+ 'CRM_Contribute_DAO_Contribution' => [
'name' => 'Contribution',
'class' => 'CRM_Contribute_DAO_Contribution',
'table' => 'civicrm_contribution',
- ) ,
- 'CRM_Contribute_DAO_ContributionProduct' => array(
+ ],
+ 'CRM_Contribute_DAO_ContributionProduct' => [
'name' => 'ContributionProduct',
'class' => 'CRM_Contribute_DAO_ContributionProduct',
'table' => 'civicrm_contribution_product',
- ) ,
- 'CRM_Contribute_DAO_ContributionSoft' => array(
+ ],
+ 'CRM_Contribute_DAO_ContributionSoft' => [
'name' => 'ContributionSoft',
'class' => 'CRM_Contribute_DAO_ContributionSoft',
'table' => 'civicrm_contribution_soft',
- ) ,
- 'CRM_Financial_DAO_EntityFinancialTrxn' => array(
+ ],
+ 'CRM_Financial_DAO_EntityFinancialTrxn' => [
'name' => 'EntityFinancialTrxn',
'class' => 'CRM_Financial_DAO_EntityFinancialTrxn',
'table' => 'civicrm_entity_financial_trxn',
- ) ,
- 'CRM_Member_DAO_MembershipPayment' => array(
+ ],
+ 'CRM_Member_DAO_MembershipPayment' => [
'name' => 'MembershipPayment',
'class' => 'CRM_Member_DAO_MembershipPayment',
'table' => 'civicrm_membership_payment',
- ) ,
- 'CRM_Event_DAO_Event' => array(
+ ],
+ 'CRM_Event_DAO_Event' => [
'name' => 'Event',
'class' => 'CRM_Event_DAO_Event',
'table' => 'civicrm_event',
- ) ,
- 'CRM_Event_DAO_Participant' => array(
+ ],
+ 'CRM_Event_DAO_Participant' => [
'name' => 'Participant',
'class' => 'CRM_Event_DAO_Participant',
'table' => 'civicrm_participant',
- ) ,
- 'CRM_Event_DAO_ParticipantPayment' => array(
+ ],
+ 'CRM_Event_DAO_ParticipantPayment' => [
'name' => 'ParticipantPayment',
'class' => 'CRM_Event_DAO_ParticipantPayment',
'table' => 'civicrm_participant_payment',
- ) ,
- 'CRM_Event_Cart_DAO_EventInCart' => array(
+ ],
+ 'CRM_Event_Cart_DAO_EventInCart' => [
'name' => 'EventInCart',
'class' => 'CRM_Event_Cart_DAO_EventInCart',
'table' => 'civicrm_events_in_carts',
- ) ,
- 'CRM_Pledge_DAO_PledgePayment' => array(
+ ],
+ 'CRM_Pledge_DAO_PledgePayment' => [
'name' => 'PledgePayment',
'class' => 'CRM_Pledge_DAO_PledgePayment',
'table' => 'civicrm_pledge_payment',
- ) ,
- 'CRM_Price_DAO_LineItem' => array(
+ ],
+ 'CRM_Price_DAO_LineItem' => [
'name' => 'LineItem',
'class' => 'CRM_Price_DAO_LineItem',
'table' => 'civicrm_line_item',
- ) ,
-);
+ ],
+];
diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php
index 80b01dba5788..f70a2cace12c 100644
--- a/CRM/Core/Payment/PayPalImpl.php
+++ b/CRM/Core/Payment/PayPalImpl.php
@@ -994,6 +994,14 @@ public function invokeAPI($args, $url = NULL) {
$url = $this->_paymentProcessor['url_api'] . 'nvp';
}
+ $p = array();
+ foreach ($args as $n => $v) {
+ $p[] = "$n=" . urlencode($v);
+ }
+
+ //NVPRequest for submitting to server
+ $nvpreq = implode('&', $p);
+
if (!function_exists('curl_init')) {
CRM_Core_Error::fatal("curl functions NOT available.");
}
@@ -1010,14 +1018,6 @@ public function invokeAPI($args, $url = NULL) {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
- $p = array();
- foreach ($args as $n => $v) {
- $p[] = "$n=" . urlencode($v);
- }
-
- //NVPRequest for submitting to server
- $nvpreq = implode('&', $p);
-
//setting the nvpreq as POST FIELD to curl
curl_setopt($ch, CURLOPT_POSTFIELDS, $nvpreq);
@@ -1039,9 +1039,9 @@ public function invokeAPI($args, $url = NULL) {
curl_close($ch);
}
- if (strtolower($result['ack']) != 'success' &&
- strtolower($result['ack']) != 'successwithwarning'
- ) {
+ $outcome = strtolower(CRM_Utils_Array::value('ack', $result));
+
+ if ($outcome != 'success' && $outcome != 'successwithwarning') {
throw new PaymentProcessorException("{$result['l_shortmessage0']} {$result['l_longmessage0']}");
$e = CRM_Core_Error::singleton();
$e->push($result['l_errorcode0'],
diff --git a/CRM/Core/Permission.php b/CRM/Core/Permission.php
index b9f344975fc4..28034d95f750 100644
--- a/CRM/Core/Permission.php
+++ b/CRM/Core/Permission.php
@@ -724,7 +724,7 @@ public static function getCorePermissions() {
),
'skip IDS check' => array(
$prefix . ts('skip IDS check'),
- ts('IDS system is bypassed for users with this permission. Prevents false errors for admin users.'),
+ ts('Warning: Give to trusted roles only; this permission has security implications. IDS system is bypassed for users with this permission. Prevents false errors for admin users.'),
),
'access uploaded files' => array(
$prefix . ts('access uploaded files'),
@@ -732,21 +732,23 @@ public static function getCorePermissions() {
),
'profile listings and forms' => array(
$prefix . ts('profile listings and forms'),
- ts('Access the profile Search form and listings'),
+ ts('Warning: Give to trusted roles only; this permission has privacy implications. Add/edit data in online forms and access public searchable directories.'),
),
'profile listings' => array(
$prefix . ts('profile listings'),
+ ts('Warning: Give to trusted roles only; this permission has privacy implications. Access public searchable directories.'),
),
'profile create' => array(
$prefix . ts('profile create'),
- ts('Use profiles in Create mode'),
+ ts('Add data in a profile form.'),
),
'profile edit' => array(
$prefix . ts('profile edit'),
- ts('Use profiles in Edit mode'),
+ ts('Edit data in a profile form.'),
),
'profile view' => array(
$prefix . ts('profile view'),
+ ts('View data in a profile.'),
),
'access all custom data' => array(
$prefix . ts('access all custom data'),
@@ -760,8 +762,8 @@ public static function getCorePermissions() {
$prefix . ts('Delete activities'),
),
'access CiviCRM' => array(
- $prefix . ts('access CiviCRM'),
- ts('Master control for access to the main CiviCRM backend and API'),
+ $prefix . ts('access CiviCRM backend and API'),
+ ts('Master control for access to the main CiviCRM backend and API. Give to trusted roles only.'),
),
'access Contact Dashboard' => array(
$prefix . ts('access Contact Dashboard'),
diff --git a/CRM/Export/BAO/Export.php b/CRM/Export/BAO/Export.php
index 70a1a14e7358..e813fd9be36f 100644
--- a/CRM/Export/BAO/Export.php
+++ b/CRM/Export/BAO/Export.php
@@ -1906,13 +1906,8 @@ public static function setHeaderRows($field, $headerRows, $sqlColumns, $query, $
elseif ($field == 'provider_id') {
$headerRows[] = ts('IM Service Provider');
}
- elseif (substr($field, 0, 5) == 'case_') {
- if ($query->_fields['case'][$field]['title']) {
- $headerRows[] = $query->_fields['case'][$field]['title'];
- }
- elseif ($query->_fields['activity'][$field]['title']) {
- $headerRows[] = $query->_fields['activity'][$field]['title'];
- }
+ elseif (substr($field, 0, 5) == 'case_' && $query->_fields['case'][$field]['title']) {
+ $headerRows[] = $query->_fields['case'][$field]['title'];
}
elseif (array_key_exists($field, $contactRelationshipTypes)) {
foreach ($value as $relationField => $relationValue) {
diff --git a/CRM/Logging/ReportSummary.php b/CRM/Logging/ReportSummary.php
index 874f9922c7ef..e30ec35faf8c 100644
--- a/CRM/Logging/ReportSummary.php
+++ b/CRM/Logging/ReportSummary.php
@@ -243,6 +243,7 @@ public function postProcess() {
// temp table to hold all altered contact-ids
$sql = "CREATE TEMPORARY TABLE civicrm_temp_civireport_logsummary ( {$tempColumns} ) ENGINE=HEAP";
CRM_Core_DAO::executeQuery($sql);
+ $this->addToDeveloperTab($sql);
$logTypes = CRM_Utils_Array::value('log_type_value', $this->_params);
unset($this->_params['log_type_value']);
@@ -271,6 +272,7 @@ public function postProcess() {
$sql = str_replace("entity_log_civireport.log_type as", "'{$entity}' as", $sql);
$sql = "INSERT IGNORE INTO civicrm_temp_civireport_logsummary {$sql}";
CRM_Core_DAO::executeQuery($sql);
+ $this->addToDeveloperTab($sql);
}
}
@@ -280,6 +282,7 @@ public function postProcess() {
// alterDisplay() counts sync with pager counts
$sql = "SELECT DISTINCT log_type FROM civicrm_temp_civireport_logsummary";
$dao = CRM_Core_DAO::executeQuery($sql);
+ $this->addToDeveloperTab($sql);
$replaceWith = array();
while ($dao->fetch()) {
$type = $this->getLogType($dao->log_type);
@@ -296,9 +299,11 @@ public function postProcess() {
$sql = "ALTER TABLE civicrm_temp_civireport_logsummary ADD COLUMN log_civicrm_entity_log_type_label varchar(64)";
CRM_Core_DAO::executeQuery($sql);
+ $this->addToDeveloperTab($sql);
foreach ($replaceWith as $type => $in) {
$sql = "UPDATE civicrm_temp_civireport_logsummary SET log_civicrm_entity_log_type_label='{$type}', log_date=log_date WHERE log_type IN('$in')";
CRM_Core_DAO::executeQuery($sql);
+ $this->addToDeveloperTab($sql);
}
// note the group by columns are same as that used in alterDisplay as $newRows - $key
@@ -317,6 +322,7 @@ public function postProcess() {
'altered_by_contact_civireport.',
), 'entity_log_civireport.', $sql);
$this->buildRows($sql, $rows);
+ $this->addToDeveloperTab($sql);
// format result set.
$this->formatDisplay($rows);
diff --git a/CRM/Mailing/BAO/Mailing.php b/CRM/Mailing/BAO/Mailing.php
index 3a0f08048c52..8862cb7bdb99 100644
--- a/CRM/Mailing/BAO/Mailing.php
+++ b/CRM/Mailing/BAO/Mailing.php
@@ -1997,12 +1997,16 @@ public static function &report($id, $skipDetails = FALSE, $isSMS = FALSE) {
$row['bounce_rate'] = (100.0 * $mailing->bounce) / $mailing->queue;
$row['unsubscribe_rate'] = (100.0 * $row['unsubscribe']) / $mailing->queue;
$row['optout_rate'] = (100.0 * $row['optout']) / $mailing->queue;
+ $row['opened_rate'] = $mailing->delivered ? (($row['opened'] / $mailing->delivered) * 100.0) : 0;
+ $row['clickthrough_rate'] = $mailing->delivered ? (($mailing->url / $mailing->delivered) * 100.0) : 0;
}
else {
$row['delivered_rate'] = 0;
$row['bounce_rate'] = 0;
$row['unsubscribe_rate'] = 0;
$row['optout_rate'] = 0;
+ $row['opened_rate'] = 0;
+ $row['clickthrough_rate'] = 0;
}
$row['links'] = array(
@@ -2066,12 +2070,16 @@ public static function &report($id, $skipDetails = FALSE, $isSMS = FALSE) {
$report['event_totals']['bounce_rate'] = (100.0 * $report['event_totals']['bounce']) / $report['event_totals']['queue'];
$report['event_totals']['unsubscribe_rate'] = (100.0 * $report['event_totals']['unsubscribe']) / $report['event_totals']['queue'];
$report['event_totals']['optout_rate'] = (100.0 * $report['event_totals']['optout']) / $report['event_totals']['queue'];
+ $report['event_totals']['opened_rate'] = !empty($report['event_totals']['delivered']) ? (($report['event_totals']['opened'] / $report['event_totals']['delivered']) * 100.0) : 0;
+ $report['event_totals']['clickthrough_rate'] = !empty($report['event_totals']['delivered']) ? (($report['event_totals']['url'] / $report['event_totals']['delivered']) * 100.0) : 0;
}
else {
$report['event_totals']['delivered_rate'] = 0;
$report['event_totals']['bounce_rate'] = 0;
$report['event_totals']['unsubscribe_rate'] = 0;
$report['event_totals']['optout_rate'] = 0;
+ $report['event_totals']['opened_rate'] = 0;
+ $report['event_totals']['clickthrough_rate'] = 0;
}
/* Get the click-through totals, grouped by URL */
diff --git a/CRM/Mailing/Event/BAO/TrackableURLOpen.php b/CRM/Mailing/Event/BAO/TrackableURLOpen.php
index 992a57852203..dc326f0656e4 100644
--- a/CRM/Mailing/Event/BAO/TrackableURLOpen.php
+++ b/CRM/Mailing/Event/BAO/TrackableURLOpen.php
@@ -144,8 +144,12 @@ public static function getTotalCount(
$mailing = CRM_Mailing_BAO_Mailing::getTableName();
$job = CRM_Mailing_BAO_MailingJob::getTableName();
+ $distinct = NULL;
+ if ($is_distinct) {
+ $distinct = 'DISTINCT ';
+ }
$query = "
- SELECT COUNT($click.id) as opened
+ SELECT COUNT($distinct $click.event_queue_id) as opened
FROM $click
INNER JOIN $queue
ON $click.event_queue_id = $queue.id
@@ -168,10 +172,6 @@ public static function getTotalCount(
$query .= " AND $click.trackable_url_id = " . CRM_Utils_Type::escape($url_id, 'Integer');
}
- if ($is_distinct) {
- $query .= " GROUP BY $queue.id ";
- }
-
// query was missing
$dao->query($query);
@@ -305,9 +305,16 @@ public static function &getRows(
$query = "
SELECT $contact.display_name as display_name,
$contact.id as contact_id,
- $email.email as email,
- $click.time_stamp as date,
- $url.url as url
+ $email.email as email,";
+
+ if ($is_distinct) {
+ $query .= "MIN($click.time_stamp) as date,";
+ }
+ else {
+ $query .= "$click.time_stamp as date,";
+ }
+
+ $query .= "$url.url as url
FROM $contact
INNER JOIN $queue
ON $queue.contact_id = $contact.id
@@ -337,7 +344,7 @@ public static function &getRows(
}
if ($is_distinct) {
- $query .= " GROUP BY $queue.id, $click.time_stamp, $url.url ";
+ $query .= " GROUP BY $queue.id, $url.url ";
}
$orderBy = "sort_name ASC, {$click}.time_stamp DESC";
diff --git a/CRM/Mailing/Info.php b/CRM/Mailing/Info.php
index c15d89630635..343e6e4510d3 100644
--- a/CRM/Mailing/Info.php
+++ b/CRM/Mailing/Info.php
@@ -138,7 +138,7 @@ public function getAngularModules() {
'civiMails' => array(),
'campaignEnabled' => in_array('CiviCampaign', $config->enableComponents),
'groupNames' => array(),
- // @todo see if we can remove this by dynamically generating the test group list
+ // @todo this is not used in core. Remove once Mosaico no longer depends on it.
'testGroupNames' => $groupNames['values'],
'headerfooterList' => $headerfooterList['values'],
'mesTemplate' => $mesTemplate['values'],
diff --git a/CRM/Report/Form.php b/CRM/Report/Form.php
index c8795f440780..f127417751e6 100644
--- a/CRM/Report/Form.php
+++ b/CRM/Report/Form.php
@@ -203,6 +203,10 @@ class CRM_Report_Form extends CRM_Core_Form {
*/
protected $addPaging = TRUE;
+ protected $isForceGroupBy = FALSE;
+
+ protected $groupConcatTested = FALSE;
+
/**
* An attribute for checkbox/radio form field layout
*
@@ -462,6 +466,18 @@ class CRM_Report_Form extends CRM_Core_Form {
protected $sql;
+ /**
+ * An instruction not to add a Group By.
+ *
+ * This is relevant where the group by might be otherwise added after the code that determines the group by array.
+ *
+ * e.g. where stat fields are being added but other settings cause it to not be desirable to add a group by
+ * such as in pivot charts when no row header is set
+ *
+ * @var bool
+ */
+ protected $noGroupBy = FALSE;
+
/**
* SQL being run in this report as an array.
*
@@ -762,6 +778,10 @@ public function preProcess() {
$this->_columns[$tableName][$fieldGrp][$fieldName]['name'] = $name;
}
+ if (!isset($this->_columns[$tableName][$fieldGrp][$fieldName]['table_name'])) {
+ $this->_columns[$tableName][$fieldGrp][$fieldName]['table_name'] = $tableName;
+ }
+
// set dbAlias = alias.name, unless already set
if (!isset($this->_columns[$tableName][$fieldGrp][$fieldName]['dbAlias'])) {
$this->_columns[$tableName][$fieldGrp][$fieldName]['dbAlias']
@@ -2036,6 +2056,8 @@ public function dateClause(
/**
* Get values for from and to for date ranges.
*
+ * @deprecated
+ *
* @param bool $relative
* @param string $from
* @param string $to
@@ -2044,21 +2066,16 @@ public function dateClause(
*
* @return array
*/
- public function getFromTo($relative, $from, $to, $fromTime = NULL, $toTime = NULL) {
+ public function getFromTo($relative, $from, $to, $fromTime = NULL, $toTime = '235959') {
if (empty($toTime)) {
+ // odd legacy behaviour to treat NULL as 'end of the day'
+ // recommend updating reports to call CRM_Utils_Date::getFromTo
+ //directly (default on the function is the actual default there).
$toTime = '235959';
}
- //FIX ME not working for relative
- if ($relative) {
- list($term, $unit) = CRM_Utils_System::explode('.', $relative, 2);
$dateRange = CRM_Utils_Date::relativeToAbsolute($term, $unit);
$from = substr($dateRange['from'], 0, 8);
- //Take only Date Part, Sometime Time part is also present in 'to'
- $to = substr($dateRange['to'], 0, 8);
- }
$from = CRM_Utils_Date::processDate($from, $fromTime);
- $to = CRM_Utils_Date::processDate($to, $toTime);
- return array($from, $to);
}
/**
@@ -2319,7 +2336,14 @@ public function select() {
$select = $this->addStatisticsToSelect($field, $tableName, $fieldName, $select);
}
else {
- $select = $this->addBasicFieldToSelect($tableName, $fieldName, $field, $select);
+
+ $selectClause = $this->getSelectClauseWithGroupConcatIfNotGroupedBy($tableName, $fieldName, $field);
+ if ($selectClause) {
+ $select[] = $selectClause;
+ }
+ else {
+ $select = $this->addBasicFieldToSelect($tableName, $fieldName, $field, $select);
+ }
}
}
}
@@ -2420,6 +2444,14 @@ public function select() {
* @return bool
*/
public function selectClause(&$tableName, $tableKey, &$fieldName, &$field) {
+ if (!empty($field['pseudofield'])) {
+ $alias = "{$tableName}_{$fieldName}";
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = CRM_Utils_Array::value('title', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['type'] = CRM_Utils_Array::value('type', $field);
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['dbAlias'] = CRM_Utils_Array::value('dbAlias', $field);
+ $this->_selectAliases[] = $alias;
+ return ' 1 as ' . $alias;
+ }
return FALSE;
}
@@ -2629,10 +2661,12 @@ public function buildQuery($applyLimit = TRUE) {
$this->groupBy();
$this->orderBy();
- // order_by columns not selected for display need to be included in SELECT
- $unselectedSectionColumns = $this->unselectedSectionColumns();
- foreach ($unselectedSectionColumns as $alias => $section) {
- $this->_select .= ", {$section['dbAlias']} as {$alias}";
+ foreach ($this->unselectedOrderByColumns() as $alias => $field) {
+ $clause = $this->getSelectClauseWithGroupConcatIfNotGroupedBy($field['table_name'], $field['name'], $field);
+ if (!$clause) {
+ $clause = "{$field['dbAlias']} as {$alias}";
+ }
+ $this->_select .= ", $clause ";
}
if ($applyLimit && empty($this->_params['charts'])) {
@@ -2712,7 +2746,16 @@ public function storeOrderByArray() {
if (!empty($orderByField)) {
$this->_orderByFields[$orderByField['tplField']] = $orderByField;
- $orderBys[] = "{$orderByField['dbAlias']} {$orderBy['order']}";
+ if ($this->groupConcatTested) {
+ $orderBys[$orderByField['tplField']] = "{$orderByField['tplField']} {$orderBy['order']}";
+ }
+ else {
+ // Not sure when this is preferable to using tplField (which has
+ // definitely been tested to work in cases then this does not.
+ // in caution not switching unless report has been tested for
+ // group concat functionality.
+ $orderBys[$orderByField['tplField']] = "{$orderByField['dbAlias']} {$orderBy['order']}";
+ }
// Record any section headers for assignment to the template
if (!empty($orderBy['section'])) {
@@ -2728,6 +2771,15 @@ public function storeOrderByArray() {
$this->assign('sections', $this->_sections);
}
+ /**
+ * Determine unselected columns.
+ *
+ * @return array
+ */
+ public function unselectedOrderByColumns() {
+ return array_diff_key($this->_orderByFields, $this->getSelectColumns());
+ }
+
/**
* Determine unselected columns.
*
@@ -5349,4 +5401,31 @@ protected function getDefaultsFromOptions($options) {
return $defaults;
}
+ /**
+ * Get the select clause for a field, wrapping in GROUP_CONCAT if appropriate.
+ *
+ * Full group by mode dictates that a field must either be in the group by function or
+ * wrapped in a aggregate function. Here we wrap the field in GROUP_CONCAT if it is not in the
+ * group concat.
+ *
+ * @param string $tableName
+ * @param string $fieldName
+ * @param string $field
+ * @return string
+ */
+ protected function getSelectClauseWithGroupConcatIfNotGroupedBy($tableName, &$fieldName, &$field) {
+ if ($this->groupConcatTested && (!empty($this->_groupByArray) || $this->isForceGroupBy)) {
+ if ((empty($field['statistics']) || in_array('GROUP_CONCAT', $field['statistics']))) {
+ $label = CRM_Utils_Array::value('title', $field);
+ $alias = "{$tableName}_{$fieldName}";
+ $this->_columnHeaders["{$tableName}_{$fieldName}"]['title'] = $label;
+ $this->_selectAliases[] = $alias;
+ if (empty($this->_groupByArray[$tableName . '_' . $fieldName])) {
+ return "GROUP_CONCAT(DISTINCT {$field['dbAlias']}) as $alias";
+ }
+ return "({$field['dbAlias']}) as $alias";
+ }
+ }
+ }
+
}
diff --git a/CRM/Report/Form/Contact/LoggingSummary.php b/CRM/Report/Form/Contact/LoggingSummary.php
index 07e42abfa548..c8a2d48754ec 100644
--- a/CRM/Report/Form/Contact/LoggingSummary.php
+++ b/CRM/Report/Form/Contact/LoggingSummary.php
@@ -352,4 +352,11 @@ protected function addDetailReportLinksToRow($baseQueryCriteria, $row) {
return $row;
}
+ /**
+ * Calculate section totals.
+ *
+ * Override to do nothing as this does not work / make sense on this report.
+ */
+ public function sectionTotals() {}
+
}
diff --git a/CRM/Report/Form/Contribute/Detail.php b/CRM/Report/Form/Contribute/Detail.php
index b64e45f58a53..1ad1cf6ed04c 100644
--- a/CRM/Report/Form/Contribute/Detail.php
+++ b/CRM/Report/Form/Contribute/Detail.php
@@ -44,6 +44,8 @@ class CRM_Report_Form_Contribute_Detail extends CRM_Report_Form {
'Contribution',
);
+ protected $groupConcatTested = TRUE;
+
/**
* This report has been optimised for group filtering.
*
@@ -221,6 +223,13 @@ public function __construct() {
'payment_instrument_id' => array('title' => ts('Payment Method')),
'receive_date' => array('title' => ts('Date Received')),
),
+ 'group_bys' => array(
+ 'contribution_id' => array(
+ 'name' => 'id',
+ 'required' => TRUE,
+ 'title' => ts('Contribution'),
+ ),
+ ),
'grouping' => 'contri-fields',
),
'civicrm_contribution_soft' => array(
@@ -243,7 +252,6 @@ public function __construct() {
'fields' => array(
'card_type_id' => array(
'title' => ts('Credit Card Type'),
- 'dbAlias' => 'GROUP_CONCAT(financial_trxn_civireport.card_type_id SEPARATOR ",")',
),
),
'filters' => array(
@@ -332,30 +340,6 @@ public function __construct() {
parent::__construct();
}
- public function preProcess() {
- parent::preProcess();
- }
-
- public function select() {
- $this->_columnHeaders = array();
-
- parent::select();
- }
-
- public function orderBy() {
- parent::orderBy();
-
- // please note this will just add the order-by columns to select query, and not display in column-headers.
- // This is a solution to not throw fatal errors when there is a column in order-by, not present in select/display columns.
- foreach ($this->_orderByFields as $orderBy) {
- if (!array_key_exists($orderBy['name'], $this->_params['fields']) &&
- empty($orderBy['section']) && (strpos($this->_select, $orderBy['dbAlias']) === FALSE)
- ) {
- $this->_select .= ", {$orderBy['dbAlias']} as {$orderBy['tplField']}";
- }
- }
- }
-
/**
* Set the FROM clause for the report.
*/
@@ -381,11 +365,6 @@ public function from() {
$this->appendAdditionalFromJoins();
}
- public function groupBy() {
- $groupBy = array("{$this->_aliases['civicrm_contact']}.id", "{$this->_aliases['civicrm_contribution']}.id");
- $this->_groupBy = CRM_Contact_BAO_Query::getGroupByFromSelectColumns($this->_selectClauses, $groupBy);
- }
-
/**
* @param $rows
*
@@ -584,34 +563,9 @@ public function postProcess() {
$this->addToDeveloperTab($sql);
CRM_Core_DAO::executeQuery($sql);
- // 5. Re-construct order-by to make sense for final query on temp3 table
- $orderBy = '';
- if (!empty($this->_orderByArray)) {
- $aliases = array_flip($this->_aliases);
- $orderClause = array();
- foreach ($this->_orderByArray as $clause) {
- list($alias, $rest) = explode('.', $clause);
- // CRM-17280 -- In case, we are ordering by custom fields
- // modify $rest to match the alias used for them in temp3 table
- $grp = new CRM_Core_DAO_CustomGroup();
- $grp->table_name = $aliases[$alias];
- if ($grp->find()) {
- list($fld, $order) = explode(' ', $rest);
- foreach ($this->_columns[$aliases[$alias]]['fields'] as $fldName => $value) {
- if ($value['name'] == $fld) {
- $fld = $fldName;
- }
- }
- $rest = "{$fld} {$order}";
- }
- $orderClause[] = $aliases[$alias] . "_" . $rest;
- }
- $orderBy = (!empty($orderClause)) ? "ORDER BY " . implode(', ', $orderClause) : '';
- }
-
// 6. show result set from temp table 3
$rows = array();
- $sql = "SELECT * FROM civireport_contribution_detail_temp3 {$orderBy}";
+ $sql = "SELECT * FROM civireport_contribution_detail_temp3 $this->_orderBy";
$this->buildRows($sql, $rows);
// format result set.
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/civicrm_msg_template.tpl b/CRM/Upgrade/5.1.beta1.msg_template/civicrm_msg_template.tpl
new file mode 100644
index 000000000000..9fecadfc37bc
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/civicrm_msg_template.tpl
@@ -0,0 +1,16 @@
+{php}
+ $dir = SMARTY_DIR . '/../../CRM/Upgrade/5.1.beta1.msg_template/message_templates';
+ $templates = array();
+ foreach (preg_grep('/\.tpl$/', scandir($dir)) as $filename) {
+ $parts = explode('_', basename($filename, '.tpl'));
+ $templates[] = array('type' => array_pop($parts), 'name' => implode('_', $parts), 'filename' => "$dir/$filename");
+ }
+ $this->assign('templates', $templates);
+{/php}
+
+{foreach from=$templates item=tpl}
+ {fetch assign=content file=$tpl.filename}
+ SELECT @workflow_id := MAX(id) FROM civicrm_option_value WHERE name = '{$tpl.name}';
+ SELECT @content := msg_{$tpl.type} FROM civicrm_msg_template WHERE workflow_id = @workflow_id AND is_reserved = 1 LIMIT 1;
+ UPDATE civicrm_msg_template SET msg_{$tpl.type} = '{$content|escape:"quotes"}' WHERE workflow_id = @workflow_id AND (is_reserved = 1 OR (is_default = 1 AND msg_{$tpl.type} = @content));
+{/foreach}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_invoice_receipt_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_invoice_receipt_subject.tpl
new file mode 100644
index 000000000000..80d07865574d
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_invoice_receipt_subject.tpl
@@ -0,0 +1,12 @@
+{if $title}
+ {if $component}
+ {if $component == 'event'}
+ {ts 1=$title}Event Registration Invoice: %1{/ts}
+ {else}
+ {ts 1=$title}Contribution Invoice: %1{/ts}
+ {/if}
+ {/if}
+{else}
+ {ts}Invoice{/ts}
+{/if}
+- {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_offline_receipt_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_offline_receipt_html.tpl
new file mode 100644
index 000000000000..a4cbeee05ed5
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_offline_receipt_html.tpl
@@ -0,0 +1,319 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {if $formValues.receipt_text}
+ {$formValues.receipt_text|htmlize}
+ {else}
+ {ts}Thank you for your support.{/ts}
+ {/if}
+
+ {ts}Please print this receipt for your records.{/ts}
+
+
+
+
+
+
+
+
+ {ts}Contribution Information{/ts}
+
+
+
+
+ {ts}Financial Type{/ts}
+
+
+ {$formValues.contributionType_name}
+
+
+
+ {if $lineItem and !$is_quick_config}
+ {foreach from=$lineItem item=value key=priceset}
+
+
+ {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
+
+ {ts}Item{/ts}
+ {ts}Qty{/ts}
+ {ts}Each{/ts}
+ {if $getTaxDetails}
+ {ts}Subtotal{/ts}
+ {ts}Tax Rate{/ts}
+ {ts}Tax Amount{/ts}
+ {/if}
+ {ts}Total{/ts}
+
+ {foreach from=$value item=line}
+
+
+ {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}{$line.description|truncate:30:"..."}
{/if}
+
+
+ {$line.qty}
+
+
+ {$line.unit_price|crmMoney:$currency}
+
+ {if $getTaxDetails}
+
+ {$line.unit_price*$line.qty|crmMoney:$currency}
+
+ {if $line.tax_rate != "" || $line.tax_amount != ""}
+
+ {$line.tax_rate|string_format:"%.2f"}%
+
+
+ {$line.tax_amount|crmMoney:$currency}
+
+ {else}
+
+
+ {/if}
+ {/if}
+
+ {$line.line_total+$line.tax_amount|crmMoney:$currency}
+
+
+ {/foreach}
+
+
+
+ {/foreach}
+ {/if}
+ {if $getTaxDetails && $dataArray}
+
+
+ {ts} Amount before Tax : {/ts}
+
+
+ {$formValues.total_amount-$totalTaxAmount|crmMoney:$currency}
+
+
+
+ {foreach from=$dataArray item=value key=priceset}
+
+ {if $priceset || $priceset == 0 || $value != ''}
+ {$taxTerm} {$priceset|string_format:"%.2f"}%
+ {$value|crmMoney:$currency}
+ {else}
+ {ts}No{/ts} {$taxTerm}
+ {$value|crmMoney:$currency}
+ {/if}
+
+ {/foreach}
+ {/if}
+
+ {if isset($totalTaxAmount) && $totalTaxAmount !== 'null'}
+
+
+ {ts}Total Tax Amount{/ts}
+
+
+ {$totalTaxAmount|crmMoney:$currency}
+
+
+ {/if}
+
+
+
+ {ts}Total Amount{/ts}
+
+
+ {$formValues.total_amount|crmMoney:$currency}
+
+
+
+ {if $receive_date}
+
+
+ {ts}Date Received{/ts}
+
+
+ {$receive_date|truncate:10:''|crmDate}
+
+
+ {/if}
+
+ {if $receipt_date}
+
+
+ {ts}Receipt Date{/ts}
+
+
+ {$receipt_date|truncate:10:''|crmDate}
+
+
+ {/if}
+
+ {if $formValues.paidBy and !$formValues.hidden_CreditCard}
+
+
+ {ts}Paid By{/ts}
+
+
+ {$formValues.paidBy}
+
+
+ {if $formValues.check_number}
+
+
+ {ts}Check Number{/ts}
+
+
+ {$formValues.check_number}
+
+
+ {/if}
+ {/if}
+
+ {if $formValues.trxn_id}
+
+
+ {ts}Transaction ID{/ts}
+
+
+ {$formValues.trxn_id}
+
+
+ {/if}
+
+ {if $ccContribution}
+
+
+ {ts}Billing Name and Address{/ts}
+
+
+
+
+ {$billingName}
+ {$address|nl2br}
+
+
+
+
+ {ts}Credit Card Information{/ts}
+
+
+
+
+ {$credit_card_type}
+ {$credit_card_number}
+ {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+
+
+ {/if}
+
+ {if $softCreditTypes and $softCredits}
+ {foreach from=$softCreditTypes item=softCreditType key=n}
+
+
+ {$softCreditType}
+
+
+ {foreach from=$softCredits.$n item=value key=label}
+
+
+ {$label}
+
+
+ {$value}
+
+
+ {/foreach}
+ {/foreach}
+ {/if}
+
+ {if $customGroup}
+ {foreach from=$customGroup item=value key=customName}
+
+
+ {$customName}
+
+
+ {foreach from=$value item=v key=n}
+
+
+ {$n}
+
+
+ {$v}
+
+
+ {/foreach}
+ {/foreach}
+ {/if}
+
+ {if $formValues.product_name}
+
+
+ {ts}Premium Information{/ts}
+
+
+
+
+ {$formValues.product_name}
+
+
+ {if $formValues.product_option}
+
+
+ {ts}Option{/ts}
+
+
+ {$formValues.product_option}
+
+
+ {/if}
+ {if $formValues.product_sku}
+
+
+ {ts}SKU{/ts}
+
+
+ {$formValues.product_sku}
+
+
+ {/if}
+ {if $fulfilled_date}
+
+
+ {ts}Sent{/ts}
+
+
+ {$fulfilled_date|truncate:10:''|crmDate}
+
+
+ {/if}
+ {/if}
+
+
+
+
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_offline_receipt_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_offline_receipt_subject.tpl
new file mode 100644
index 000000000000..2a19c6e6c3b2
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_offline_receipt_subject.tpl
@@ -0,0 +1 @@
+{ts}Contribution Receipt{/ts} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_offline_receipt_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_offline_receipt_text.tpl
new file mode 100644
index 000000000000..5bfac13c7357
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_offline_receipt_text.tpl
@@ -0,0 +1,120 @@
+{contact.email_greeting},
+
+{if $formValues.receipt_text}
+{$formValues.receipt_text}
+{else}{ts}Thank you for your support.{/ts}{/if}
+
+{ts}Please print this receipt for your records.{/ts}
+
+
+===========================================================
+{ts}Contribution Information{/ts}
+
+===========================================================
+{ts}Financial Type{/ts}: {$formValues.contributionType_name}
+{if $lineItem}
+{foreach from=$lineItem item=value key=priceset}
+---------------------------------------------------------
+{capture assign=ts_item}{ts}Item{/ts}{/capture}
+{capture assign=ts_qty}{ts}Qty{/ts}{/capture}
+{capture assign=ts_each}{ts}Each{/ts}{/capture}
+{if $getTaxDetails}
+{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}
+{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}
+{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}
+{/if}
+{capture assign=ts_total}{ts}Total{/ts}{/capture}
+{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {if $getTaxDetails} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate} {$ts_taxAmount|string_format:"%10s"} {/if} {$ts_total|string_format:"%10s"}
+----------------------------------------------------------
+{foreach from=$value item=line}
+{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney:$currency|string_format:"%10s"} {if $getTaxDetails}{$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {if $line.tax_rate != "" || $line.tax_amount != ""} {$line.tax_rate|string_format:"%.2f"} % {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {else} {/if} {/if} {$line.line_total+$line.tax_amount|crmMoney:$currency|string_format:"%10s"}
+{/foreach}
+{/foreach}
+{/if}
+
+{if $getTaxDetails && $dataArray}
+{ts}Amount before Tax{/ts} : {$formValues.total_amount-$totalTaxAmount|crmMoney:$currency}
+
+{foreach from=$dataArray item=value key=priceset}
+{if $priceset || $priceset == 0 || $value != ''}
+{$taxTerm} {$priceset|string_format:"%.2f"}% : {$value|crmMoney:$currency}
+{else}
+{ts}No{/ts} {$taxTerm} : {$value|crmMoney:$currency}
+{/if}
+{/foreach}
+{/if}
+
+{if isset($totalTaxAmount) && $totalTaxAmount !== 'null'}
+{ts}Total Tax Amount{/ts} : {$totalTaxAmount|crmMoney:$currency}
+{/if}
+{ts}Total Amount{/ts} : {$formValues.total_amount|crmMoney:$currency}
+{if $receive_date}
+{ts}Date Received{/ts}: {$receive_date|truncate:10:''|crmDate}
+{/if}
+{if $receipt_date}
+{ts}Receipt Date{/ts}: {$receipt_date|truncate:10:''|crmDate}
+{/if}
+{if $formValues.paidBy and !$formValues.hidden_CreditCard}
+{ts}Paid By{/ts}: {$formValues.paidBy}
+{if $formValues.check_number}
+{ts}Check Number{/ts}: {$formValues.check_number}
+{/if}
+{/if}
+{if $formValues.trxn_id}
+{ts}Transaction ID{/ts}: {$formValues.trxn_id}
+{/if}
+
+{if $ccContribution}
+===========================================================
+{ts}Billing Name and Address{/ts}
+
+===========================================================
+{$billingName}
+{$address}
+
+===========================================================
+{ts}Credit Card Information{/ts}
+
+===========================================================
+{$credit_card_type}
+{$credit_card_number}
+{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+{/if}
+{if $customGroup}
+{foreach from=$customGroup item=value key=customName}
+===========================================================
+{$customName}
+===========================================================
+{foreach from=$value item=v key=n}
+{$n}: {$v}
+{/foreach}
+{/foreach}
+{/if}
+
+{if $softCreditTypes and $softCredits}
+{foreach from=$softCreditTypes item=softCreditType key=n}
+===========================================================
+{$softCreditType}
+===========================================================
+{foreach from=$softCredits.$n item=value key=label}
+{$label}: {$value}
+{/foreach}
+{/foreach}
+{/if}
+
+{if $formValues.product_name}
+===========================================================
+{ts}Premium Information{/ts}
+
+===========================================================
+{$formValues.product_name}
+{if $formValues.product_option}
+{ts}Option{/ts}: {$formValues.product_option}
+{/if}
+{if $formValues.product_sku}
+{ts}SKU{/ts}: {$formValues.product_sku}
+{/if}
+{if $fulfilled_date}
+{ts}Sent{/ts}: {$fulfilled_date|crmDate}
+{/if}
+{/if}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_online_receipt_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_online_receipt_html.tpl
new file mode 100644
index 000000000000..61dc72d657b4
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_online_receipt_html.tpl
@@ -0,0 +1,473 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {if $receipt_text}
+ {$receipt_text|htmlize}
+ {/if}
+
+ {if $is_pay_later}
+ {$pay_later_receipt}
{* FIXME: this might be text rather than HTML *}
+ {else}
+ {ts}Please print this confirmation for your records.{/ts}
+ {/if}
+
+
+
+
+
+
+ {if $amount}
+
+
+
+
+ {ts}Contribution Information{/ts}
+
+
+
+ {if $lineItem and $priceSetID and !$is_quick_config}
+
+ {foreach from=$lineItem item=value key=priceset}
+
+
+ {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
+
+ {ts}Item{/ts}
+ {ts}Qty{/ts}
+ {ts}Each{/ts}
+ {if $dataArray}
+ {ts}Subtotal{/ts}
+ {ts}Tax Rate{/ts}
+ {ts}Tax Amount{/ts}
+ {/if}
+ {ts}Total{/ts}
+
+ {foreach from=$value item=line}
+
+
+ {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}{$line.description|truncate:30:"..."}
{/if}
+
+
+ {$line.qty}
+
+
+ {$line.unit_price|crmMoney:$currency}
+
+ {if $getTaxDetails}
+
+ {$line.unit_price*$line.qty|crmMoney:$currency}
+
+ {if $line.tax_rate != "" || $line.tax_amount != ""}
+
+ {$line.tax_rate|string_format:"%.2f"}%
+
+
+ {$line.tax_amount|crmMoney:$currency}
+
+ {else}
+
+
+ {/if}
+ {/if}
+
+ {$line.line_total+$line.tax_amount|crmMoney:$currency}
+
+
+ {/foreach}
+
+
+
+ {/foreach}
+ {if $dataArray}
+
+
+ {ts} Amount before Tax : {/ts}
+
+
+ {$amount-$totalTaxAmount|crmMoney:$currency}
+
+
+
+ {foreach from=$dataArray item=value key=priceset}
+
+ {if $priceset || $priceset == 0}
+ {$taxTerm} {$priceset|string_format:"%.2f"}%
+ {$value|crmMoney:$currency}
+ {else}
+ {ts}No{/ts} {$taxTerm}
+ {$value|crmMoney:$currency}
+ {/if}
+
+ {/foreach}
+
+ {/if}
+ {if $totalTaxAmount}
+
+
+ {ts}Total Tax{/ts}
+
+
+ {$totalTaxAmount|crmMoney:$currency}
+
+
+ {/if}
+
+
+ {ts}Total Amount{/ts}
+
+
+ {$amount|crmMoney:$currency}
+
+
+
+ {else}
+
+ {if $totalTaxAmount}
+
+
+ {ts}Total Tax Amount{/ts}
+
+
+ {$totalTaxAmount|crmMoney:$currency}
+
+
+ {/if}
+
+
+ {ts}Amount{/ts}
+
+
+ {$amount|crmMoney:$currency} {if $amount_level} - {$amount_level}{/if}
+
+
+
+ {/if}
+
+ {/if}
+
+
+ {if $receive_date}
+
+
+ {ts}Date{/ts}
+
+
+ {$receive_date|crmDate}
+
+
+ {/if}
+
+ {if $is_monetary and $trxn_id}
+
+
+ {ts}Transaction #{/ts}
+
+
+ {$trxn_id}
+
+
+ {/if}
+
+ {if $is_recur}
+ {if $contributeMode eq 'notify' or $contributeMode eq 'directIPN'}
+
+
+ {ts 1=$cancelSubscriptionUrl}This is a recurring contribution. You can cancel future contributions by visiting this web page .{/ts}
+
+ {if $updateSubscriptionBillingUrl}
+
+
+
+ {ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by visiting this web page .{/ts}
+
+ {/if}
+
+
+
+ {ts 1=$updateSubscriptionUrl}You can update recurring contribution amount or change the number of installments for this recurring contribution by visiting this web page .{/ts}
+
+
+ {/if}
+ {/if}
+
+ {if $honor_block_is_active}
+
+
+ {$soft_credit_type}
+
+
+ {foreach from=$honoreeProfile item=value key=label}
+
+
+ {$label}
+
+
+ {$value}
+
+
+ {/foreach}
+ {elseif $softCreditTypes and $softCredits}
+ {foreach from=$softCreditTypes item=softCreditType key=n}
+
+
+ {$softCreditType}
+
+
+ {foreach from=$softCredits.$n item=value key=label}
+
+
+ {$label}
+
+
+ {$value}
+
+
+ {/foreach}
+ {/foreach}
+ {/if}
+
+ {if $pcpBlock}
+
+
+ {ts}Personal Campaign Page{/ts}
+
+
+
+
+ {ts}Display In Honor Roll{/ts}
+
+
+ {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}
+
+
+ {if $pcp_roll_nickname}
+
+
+ {ts}Nickname{/ts}
+
+
+ {$pcp_roll_nickname}
+
+
+ {/if}
+ {if $pcp_personal_note}
+
+
+ {ts}Personal Note{/ts}
+
+
+ {$pcp_personal_note}
+
+
+ {/if}
+ {/if}
+
+ {if $onBehalfProfile}
+
+
+ {$onBehalfProfile_grouptitle}
+
+
+ {foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}
+
+
+ {$onBehalfName}
+
+
+ {$onBehalfValue}
+
+
+ {/foreach}
+ {/if}
+
+ {if $isShare}
+
+
+ {capture assign=contributionUrl}{crmURL p='civicrm/contribute/transact' q="reset=1&id=`$contributionPageId`" a=true fe=1 h=1}{/capture}
+ {include file="CRM/common/SocialNetwork.tpl" emailMode=true url=$contributionUrl title=$title pageURL=$contributionUrl}
+
+
+ {/if}
+
+ {if ! ($contributeMode eq 'notify' OR $contributeMode eq 'directIPN') and $is_monetary}
+ {if $is_pay_later && !$isBillingAddressRequiredForPayLater}
+
+
+ {ts}Registered Email{/ts}
+
+
+
+
+ {$email}
+
+
+ {elseif $amount GT 0}
+
+
+ {ts}Billing Name and Address{/ts}
+
+
+
+
+ {$billingName}
+ {$address|nl2br}
+ {$email}
+
+
+ {/if}
+ {/if}
+
+ {if $contributeMode eq 'direct' AND !$is_pay_later AND $amount GT 0}
+
+
+ {ts}Credit Card Information{/ts}
+
+
+
+
+ {$credit_card_type}
+ {$credit_card_number}
+ {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+
+
+ {/if}
+
+ {if $selectPremium}
+
+
+ {ts}Premium Information{/ts}
+
+
+
+
+ {$product_name}
+
+
+ {if $option}
+
+
+ {ts}Option{/ts}
+
+
+ {$option}
+
+
+ {/if}
+ {if $sku}
+
+
+ {ts}SKU{/ts}
+
+
+ {$sku}
+
+
+ {/if}
+ {if $start_date}
+
+
+ {ts}Start Date{/ts}
+
+
+ {$start_date|crmDate}
+
+
+ {/if}
+ {if $end_date}
+
+
+ {ts}End Date{/ts}
+
+
+ {$end_date|crmDate}
+
+
+ {/if}
+ {if $contact_email OR $contact_phone}
+
+
+ {ts}For information about this premium, contact:{/ts}
+ {if $contact_email}
+ {$contact_email}
+ {/if}
+ {if $contact_phone}
+ {$contact_phone}
+ {/if}
+
+
+ {/if}
+ {if $is_deductible AND $price}
+
+
+ {ts 1=$price|crmMoney:$currency}The value of this premium is %1. This may affect the amount of the tax deduction you can claim. Consult your tax advisor for more information.{/ts}
+
+
+ {/if}
+ {/if}
+
+ {if $customPre}
+
+
+ {$customPre_grouptitle}
+
+
+ {foreach from=$customPre item=customValue key=customName}
+ {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
+
+
+ {$customName}
+
+
+ {$customValue}
+
+
+ {/if}
+ {/foreach}
+ {/if}
+
+ {if $customPost}
+
+
+ {$customPost_grouptitle}
+
+
+ {foreach from=$customPost item=customValue key=customName}
+ {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
+
+
+ {$customName}
+
+
+ {$customValue}
+
+
+ {/if}
+ {/foreach}
+ {/if}
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_online_receipt_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_online_receipt_subject.tpl
new file mode 100644
index 000000000000..052dce5bd748
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_online_receipt_subject.tpl
@@ -0,0 +1 @@
+{if $is_pay_later}{ts}Invoice{/ts}{else}{ts}Receipt{/ts}{/if} - {$title} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_online_receipt_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_online_receipt_text.tpl
new file mode 100644
index 000000000000..2820950ed170
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_online_receipt_text.tpl
@@ -0,0 +1,211 @@
+{contact.email_greeting},
+
+{if $receipt_text}
+{$receipt_text}
+{/if}
+{if $is_pay_later}
+
+===========================================================
+{$pay_later_receipt}
+===========================================================
+{else}
+
+{ts}Please print this receipt for your records.{/ts}
+{/if}
+
+{if $amount}
+===========================================================
+{ts}Contribution Information{/ts}
+
+===========================================================
+{if $lineItem and $priceSetID and !$is_quick_config}
+{foreach from=$lineItem item=value key=priceset}
+---------------------------------------------------------
+{capture assign=ts_item}{ts}Item{/ts}{/capture}
+{capture assign=ts_qty}{ts}Qty{/ts}{/capture}
+{capture assign=ts_each}{ts}Each{/ts}{/capture}
+{if $dataArray}
+{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}
+{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}
+{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}
+{/if}
+{capture assign=ts_total}{ts}Total{/ts}{/capture}
+{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {if $dataArray} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate} {$ts_taxAmount|string_format:"%10s"} {/if} {$ts_total|string_format:"%10s"}
+----------------------------------------------------------
+{foreach from=$value item=line}
+{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney:$currency|string_format:"%10s"} {if $dataArray}{$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {if $line.tax_rate != "" || $line.tax_amount != ""} {$line.tax_rate|string_format:"%.2f"} % {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {else} {/if} {/if} {$line.line_total+$line.tax_amount|crmMoney:$currency|string_format:"%10s"}
+{/foreach}
+{/foreach}
+
+{if $dataArray}
+{ts}Amount before Tax{/ts}: {$amount-$totalTaxAmount|crmMoney:$currency}
+
+{foreach from=$dataArray item=value key=priceset}
+{if $priceset || $priceset == 0}
+{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency}
+{else}
+{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}
+{/if}
+{/foreach}
+{/if}
+
+{if $totalTaxAmount}
+{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
+{/if}
+
+{ts}Total Amount{/ts}: {$amount|crmMoney:$currency}
+{else}
+{ts}Amount{/ts}: {$amount|crmMoney:$currency} {if $amount_level } - {$amount_level} {/if}
+{/if}
+{/if}
+{if $receive_date}
+
+{ts}Date{/ts}: {$receive_date|crmDate}
+{/if}
+{if $is_monetary and $trxn_id}
+{ts}Transaction #{/ts}: {$trxn_id}
+{/if}
+
+{if $is_recur and ($contributeMode eq 'notify' or $contributeMode eq 'directIPN')}
+{ts}This is a recurring contribution. You can cancel future contributions at:{/ts}
+
+{$cancelSubscriptionUrl}
+
+{if $updateSubscriptionBillingUrl}
+{ts}You can update billing details for this recurring contribution at:{/ts}
+
+{$updateSubscriptionBillingUrl}
+
+{/if}
+{ts}You can update recurring contribution amount or change the number of installments for this recurring contribution at:{/ts}
+
+{$updateSubscriptionUrl}
+
+{/if}
+
+{if $honor_block_is_active}
+===========================================================
+{$soft_credit_type}
+===========================================================
+{foreach from=$honoreeProfile item=value key=label}
+{$label}: {$value}
+{/foreach}
+{elseif $softCreditTypes and $softCredits}
+{foreach from=$softCreditTypes item=softCreditType key=n}
+===========================================================
+{$softCreditType}
+===========================================================
+{foreach from=$softCredits.$n item=value key=label}
+{$label}: {$value}
+{/foreach}
+{/foreach}
+{/if}
+{if $pcpBlock}
+===========================================================
+{ts}Personal Campaign Page{/ts}
+
+===========================================================
+{ts}Display In Honor Roll{/ts}: {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}
+
+{if $pcp_roll_nickname}{ts}Nickname{/ts}: {$pcp_roll_nickname}{/if}
+
+{if $pcp_personal_note}{ts}Personal Note{/ts}: {$pcp_personal_note}{/if}
+
+{/if}
+{if $onBehalfProfile}
+===========================================================
+{ts}On Behalf Of{/ts}
+
+===========================================================
+{foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}
+{$onBehalfName}: {$onBehalfValue}
+{/foreach}
+{/if}
+
+{if !( $contributeMode eq 'notify' OR $contributeMode eq 'directIPN' ) and $is_monetary}
+{if $is_pay_later && !$isBillingAddressRequiredForPayLater}
+===========================================================
+{ts}Registered Email{/ts}
+
+===========================================================
+{$email}
+{elseif $amount GT 0}
+===========================================================
+{ts}Billing Name and Address{/ts}
+
+===========================================================
+{$billingName}
+{$address}
+
+{$email}
+{/if} {* End ! is_pay_later condition. *}
+{/if}
+{if $contributeMode eq 'direct' AND !$is_pay_later AND $amount GT 0}
+
+===========================================================
+{ts}Credit Card Information{/ts}
+
+===========================================================
+{$credit_card_type}
+{$credit_card_number}
+{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+{/if}
+
+{if $selectPremium }
+===========================================================
+{ts}Premium Information{/ts}
+
+===========================================================
+{$product_name}
+{if $option}
+{ts}Option{/ts}: {$option}
+{/if}
+{if $sku}
+{ts}SKU{/ts}: {$sku}
+{/if}
+{if $start_date}
+{ts}Start Date{/ts}: {$start_date|crmDate}
+{/if}
+{if $end_date}
+{ts}End Date{/ts}: {$end_date|crmDate}
+{/if}
+{if $contact_email OR $contact_phone}
+
+{ts}For information about this premium, contact:{/ts}
+
+{if $contact_email}
+ {$contact_email}
+{/if}
+{if $contact_phone}
+ {$contact_phone}
+{/if}
+{/if}
+{if $is_deductible AND $price}
+
+{ts 1=$price|crmMoney:$currency}The value of this premium is %1. This may affect the amount of the tax deduction you can claim. Consult your tax advisor for more information.{/ts}{/if}
+{/if}
+
+{if $customPre}
+===========================================================
+{$customPre_grouptitle}
+
+===========================================================
+{foreach from=$customPre item=customValue key=customName}
+{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ {$customName}: {$customValue}
+{/if}
+{/foreach}
+{/if}
+
+
+{if $customPost}
+===========================================================
+{$customPost_grouptitle}
+
+===========================================================
+{foreach from=$customPost item=customValue key=customName}
+{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ {$customName}: {$customValue}
+{/if}
+{/foreach}
+{/if}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_billing_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_billing_html.tpl
new file mode 100644
index 000000000000..c7b962f4857e
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_billing_html.tpl
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {ts 1=$amount 2=$recur_frequency_interval 3=$recur_frequency_unit}Billing details for your recurring contribution of %1, every %2 %3 have been updated.{/ts}
+
+
+
+
+
+
+
+
+ {ts}Billing Name and Address{/ts}
+
+
+
+
+ {$billingName}
+ {$address|nl2br}
+ {$email}
+
+
+
+
+ {ts}Credit Card Information{/ts}
+
+
+
+
+ {$credit_card_type}
+ {$credit_card_number}
+ {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+
+
+
+
+ {ts 1=$receipt_from_email}If you have questions please contact us at %1{/ts}
+
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_billing_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_billing_subject.tpl
new file mode 100644
index 000000000000..0a2a03b06449
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_billing_subject.tpl
@@ -0,0 +1 @@
+{ts}Recurring Contribution Billing Updates{/ts} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_billing_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_billing_text.tpl
new file mode 100644
index 000000000000..d4732cc615b8
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_billing_text.tpl
@@ -0,0 +1,23 @@
+{contact.email_greeting},
+
+{ts 1=$amount 2=$recur_frequency_interval 3=$recur_frequency_unit}Billing details for your recurring contribution of %1, every %2 %3 have been updated.{/ts}
+
+===========================================================
+{ts}Billing Name and Address{/ts}
+
+===========================================================
+{$billingName}
+{$address}
+
+{$email}
+
+===========================================================
+{ts}Credit Card Information{/ts}
+
+===========================================================
+{$credit_card_type}
+{$credit_card_number}
+{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+
+
+{ts 1=$receipt_from_email}If you have questions please contact us at %1{/ts}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_cancelled_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_cancelled_html.tpl
new file mode 100644
index 000000000000..99bd2f84150e
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_cancelled_html.tpl
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {ts 1=$amount 2=$recur_frequency_interval 3=$recur_frequency_unit}Your recurring contribution of %1, every %2 %3 has been cancelled as requested.{/ts}
+
+
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_cancelled_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_cancelled_subject.tpl
new file mode 100644
index 000000000000..2b5a4d805fba
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_cancelled_subject.tpl
@@ -0,0 +1 @@
+{ts}Recurring Contribution Cancellation Notification{/ts} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_cancelled_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_cancelled_text.tpl
new file mode 100644
index 000000000000..40c2986c7023
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_cancelled_text.tpl
@@ -0,0 +1,3 @@
+{contact.email_greeting},
+
+{ts 1=$amount 2=$recur_frequency_interval 3=$recur_frequency_unit}Your recurring contribution of %1, every %2 %3 has been cancelled as requested.{/ts}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_edit_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_edit_html.tpl
new file mode 100644
index 000000000000..894157b0b5b5
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_edit_html.tpl
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {ts}Your recurring contribution has been updated as requested:{/ts}
+
{ts 1=$amount 2=$recur_frequency_interval 3=$recur_frequency_unit}Recurring contribution is for %1, every %2 %3(s){/ts}{if $installments}{ts 1=$installments} for %1 installments{/ts}{/if}.
+
+ {ts 1=$receipt_from_email}If you have questions please contact us at %1.{/ts}
+
+
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_edit_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_edit_subject.tpl
new file mode 100644
index 000000000000..304649521623
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_edit_subject.tpl
@@ -0,0 +1 @@
+{ts}Recurring Contribution Update Notification{/ts} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_edit_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_edit_text.tpl
new file mode 100644
index 000000000000..74b7f51bdce2
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_edit_text.tpl
@@ -0,0 +1,8 @@
+{contact.email_greeting},
+
+{ts}Your recurring contribution has been updated as requested:{/ts}
+
+{ts 1=$amount 2=$recur_frequency_interval 3=$recur_frequency_unit}Recurring contribution is for %1, every %2 %3(s){/ts}
+{if $installments}{ts 1=$installments} for %1 installments.{/ts}{/if}
+
+{ts 1=$receipt_from_email}If you have questions please contact us at %1.{/ts}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_notify_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_notify_html.tpl
new file mode 100644
index 000000000000..2582e7cbba33
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_notify_html.tpl
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+
+
+
+
+
+
+
+ {if $recur_txnType eq 'START'}
+ {if $auto_renew_membership}
+
+
+ {ts}Thanks for your auto renew membership sign-up.{/ts}
+ {ts 1=$recur_frequency_interval 2=$recur_frequency_unit}This membership will be automatically renewed every %1 %2(s). {/ts}
+
+
+
+
+ {ts 1=$cancelSubscriptionUrl}This membership will be renewed automatically. You can cancel the auto-renewal option by visiting this web page .{/ts}
+
+
+ {if $updateSubscriptionBillingUrl}
+
+
+ {ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by visiting this web page .{/ts}
+
+
+ {/if}
+ {else}
+
+
+ {ts}Thanks for your recurring contribution sign-up.{/ts}
+ {ts 1=$recur_frequency_interval 2=$recur_frequency_unit}This recurring contribution will be automatically processed every %1 %2(s){/ts}{if $recur_installments }{ts 1=$recur_installments} for a total of %1 installment(s){/ts}{/if}.
+ {ts}Start Date{/ts}: {$recur_start_date|crmDate}
+
+
+
+
+ {ts 1=$cancelSubscriptionUrl} You can cancel the recurring contribution option by visiting this web page .{/ts}
+
+
+ {if $updateSubscriptionBillingUrl}
+
+
+ {ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by visiting this web page .{/ts}
+
+
+ {/if}
+
+
+ {ts 1=$updateSubscriptionUrl}You can update recurring contribution amount or change the number of installments details for this recurring contribution by visiting this web page .{/ts}
+
+
+ {/if}
+
+ {elseif $recur_txnType eq 'END'}
+
+ {if $auto_renew_membership}
+
+
+ {ts}Your auto renew membership sign-up has ended and your membership will not be automatically renewed.{/ts}
+
+
+ {else}
+
+
+ {ts}Your recurring contribution term has ended.{/ts}
+ {ts 1=$recur_installments}You have successfully completed %1 recurring contributions. Thank you for your support.{/ts}
+
+
+
+
+
+
+
+ {ts 1=$recur_installments}Interval of Subscription for %1 installment(s){/ts}
+
+
+
+
+ {ts}Start Date{/ts}
+
+
+ {$recur_start_date|crmDate}
+
+
+
+
+ {ts}End Date{/ts}
+
+
+ {$recur_end_date|crmDate}
+
+
+
+
+
+
+ {/if}
+ {/if}
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_notify_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_notify_subject.tpl
new file mode 100644
index 000000000000..c9a9d927ad0e
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_notify_subject.tpl
@@ -0,0 +1 @@
+{ts}Recurring Contribution Notification{/ts} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_notify_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_notify_text.tpl
new file mode 100644
index 000000000000..cf54ba592dd9
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/contribution_recurring_notify_text.tpl
@@ -0,0 +1,54 @@
+{contact.email_greeting},
+
+{if $recur_txnType eq 'START'}
+{if $auto_renew_membership}
+{ts}Thanks for your auto renew membership sign-up.{/ts}
+
+
+{ts 1=$recur_frequency_interval 2=$recur_frequency_unit}This membership will be automatically renewed every %1 %2(s).{/ts}
+
+{ts 1=$cancelSubscriptionUrl}This membership will be renewed automatically. You can cancel the auto-renewal option by visiting this web page .{/ts}
+
+{if $updateSubscriptionBillingUrl}
+{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by visiting this web page .{/ts}
+
+{/if}
+{else}
+{ts}Thanks for your recurring contribution sign-up.{/ts}
+
+
+{ts 1=$recur_frequency_interval 2=$recur_frequency_unit 3=$recur_installments}This recurring contribution will be automatically processed every %1 %2(s){/ts}{if $recur_installments } {ts 1=$recur_installments} for a total of %1 installment(s){/ts}{/if}.
+
+{ts}Start Date{/ts}: {$recur_start_date|crmDate}
+
+{ts 1=$cancelSubscriptionUrl}You can cancel the recurring contribution option by visiting this web page .{/ts}
+
+{if $updateSubscriptionBillingUrl}
+{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this recurring contribution by visiting this web page .{/ts}
+
+{/if}
+{ts 1=$updateSubscriptionUrl}You can update recurring contribution amount or change the number of installments for this recurring contribution by visiting this web page .{/ts}
+{/if}
+
+{elseif $recur_txnType eq 'END'}
+{if $auto_renew_membership}
+{ts}Your auto renew membership sign-up has ended and your membership will not be automatically renewed.{/ts}
+
+
+{else}
+{ts}Your recurring contribution term has ended.{/ts}
+
+
+{ts 1=$recur_installments}You have successfully completed %1 recurring contributions. Thank you for your support.{/ts}
+
+
+==================================================
+{ts 1=$recur_installments}Interval of Subscription for %1 installment(s){/ts}
+
+==================================================
+{ts}Start Date{/ts}: {$recur_start_date|crmDate}
+
+{ts}End Date{/ts}: {$recur_end_date|crmDate}
+
+{/if}
+{/if}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/event_registration_receipt_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/event_registration_receipt_html.tpl
new file mode 100644
index 000000000000..121d07efa2a8
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/event_registration_receipt_html.tpl
@@ -0,0 +1,175 @@
+
+
+
+
+
+
+
+ {capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+ {capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+ {capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+ {contact.email_greeting},
+ {if $is_pay_later}
+
+ This is being sent to you as an acknowledgement that you have registered one or more members for the following workshop, event or purchase. Please note, however, that the status of your payment is pending, and the registration for this event will not be completed until your payment is received.
+
+ {else}
+
+ This is being sent to you as a {if $is_refund}confirmation of refund{else}receipt of payment made{/if} for the following workshop, event registration or purchase.
+
+ {/if}
+
+ {if $is_pay_later}
+ {$pay_later_receipt}
+ {/if}
+
+ Your order number is #{$transaction_id}. Please print this confirmation for your records.{if $line_items && !$is_refund} Information about the workshops will be sent separately to each participant.{/if}
+ Here's a summary of your transaction placed on {$transaction_date|date_format:"%D %I:%M %p %Z"}:
+
+
+{if $billing_name}
+
+
+
+ {ts}Billing Name and Address{/ts}
+
+
+
+
+ {$billing_name}
+ {$billing_street_address}
+ {$billing_city}, {$billing_state} {$billing_postal_code}
+
+ {$email}
+
+
+
+{/if}
+{if $credit_card_type}
+
+
+
+
+ {ts}Credit Card Information{/ts}
+
+
+
+
+ {$credit_card_type}
+ {$credit_card_number}
+ {ts}Expires{/ts}: {$credit_card_exp_date.M}/{$credit_card_exp_date.Y}
+
+
+
+{/if}
+{if $source}
+
+ {$source}
+{/if}
+
+
+
+
+{if $line_items}
+
+ Event
+
+
+ Participants
+
+{/if}
+
+ Price
+
+
+ Total
+
+
+
+
+ {foreach from=$line_items item=line_item}
+
+
+ {$line_item.event->title} ({$line_item.event->start_date|date_format:"%D"})
+ {if $line_item.event->is_show_location}
+ {$line_item.location.address.1.display|nl2br}
+ {/if}{*End of isShowLocation condition*}
+ {$line_item.event->start_date|date_format:"%D %I:%M %p"} - {$line_item.event->end_date|date_format:"%I:%M %p"}
+
+
+ {$line_item.num_participants}
+ {if $line_item.num_participants > 0}
+
+ {foreach from=$line_item.participants item=participant}
+ {$participant.display_name}
+ {/foreach}
+
+ {/if}
+ {if $line_item.num_waiting_participants > 0}
+ Waitlisted:
+
+ {foreach from=$line_item.waiting_participants item=participant}
+ {$participant.display_name}
+ {/foreach}
+
+ {/if}
+
+
+ {$line_item.cost|crmMoney:$currency|string_format:"%10s"}
+
+
+ {$line_item.amount|crmMoney:$currency|string_format:"%10s"}
+
+
+ {/foreach}
+
+
+ {if $discounts}
+
+
+
+
+
+
+ Subtotal:
+
+
+ {$sub_total|crmMoney:$currency|string_format:"%10s"}
+
+
+ {foreach from=$discounts key=myId item=i}
+
+
+ {$i.title}
+
+
+
+
+
+
+ -{$i.amount}
+
+
+ {/foreach}
+ {/if}
+
+{if $line_items}
+
+
+
+
+{/if}
+
+ Total:
+
+
+ {$total|crmMoney:$currency|string_format:"%10s"}
+
+
+
+
+
+ If you have questions about the status of your registration or purchase please feel free to contact us.
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/event_registration_receipt_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/event_registration_receipt_text.tpl
new file mode 100644
index 000000000000..2a8d3f054581
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/event_registration_receipt_text.tpl
@@ -0,0 +1,80 @@
+{contact.email_greeting},
+{if $is_pay_later}
+ This is being sent to you as an acknowledgement that you have registered one or more members for the following workshop, event or purchase. Please note, however, that the status of your payment is pending, and the registration for this event will not be completed until your payment is received.
+{else}
+ This is being sent to you as a {if $is_refund}confirmation of refund{else}receipt of payment made{/if} for the following workshop, event registration or purchase.
+{/if}
+
+{if $is_pay_later}
+ {$pay_later_receipt}
+{/if}
+
+ Your order number is #{$transaction_id}. Please print this confirmation for your records.{if $line_items && !$is_refund} Information about the workshops will be sent separately to each participant.{/if}
+ Here's a summary of your transaction placed on {$transaction_date|date_format:"%D %I:%M %p %Z"}:
+
+{if $billing_name}
+===========================================================
+{ts}Billing Name and Address{/ts}
+
+===========================================================
+{$billing_name}
+
+{$billing_street_address}
+
+{$billing_city}, {$billing_state} {$billing_postal_code}
+
+{$email}
+{/if}
+
+{if $source}
+{$source}
+{/if}
+
+
+{foreach from=$line_items item=line_item}
+{$line_item.event->title} ({$line_item.event->start_date|date_format:"%D"})
+{if $line_item.event->is_show_location}
+ {$line_item.location.address.1.display|strip_tags:false}
+{/if}{*End of isShowLocation condition*}
+{$line_item.event->start_date|date_format:"%D %I:%M %p"} - {$line_item.event->end_date|date_format:"%I:%M %p"}
+
+ Quantity: {$line_item.num_participants}
+
+{if $line_item.num_participants > 0}
+ {foreach from=$line_item.participants item=participant}
+ {$participant.display_name}
+ {/foreach}
+{/if}
+{if $line_item.num_waiting_participants > 0}
+ Waitlisted:
+ {foreach from=$line_item.waiting_participants item=participant}
+ {$participant.display_name}
+ {/foreach}
+{/if}
+Cost: {$line_item.cost|crmMoney:$currency|string_format:"%10s"}
+Total For This Event: {$line_item.amount|crmMoney:$currency|string_format:"%10s"}
+
+{/foreach}
+
+{if $discounts}
+Subtotal: {$sub_total|crmMoney:$currency|string_format:"%10s"}
+--------------------------------------
+Discounts
+{foreach from=$discounts key=myId item=i}
+ {$i.title}: -{$i.amount|crmMoney:$currency|string_format:"%10s"}
+{/foreach}
+{/if}
+======================================
+Total: {$total|crmMoney:$currency|string_format:"%10s"}
+
+{if $credit_card_type}
+===========================================================
+{ts}Payment Information{/ts}
+
+===========================================================
+{$credit_card_type}
+{$credit_card_number}
+{ts}Expires{/ts}: {$credit_card_exp_date.M}/{$credit_card_exp_date.Y}
+{/if}
+
+ If you have questions about the status of your registration or purchase please feel free to contact us.
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_billing_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_billing_html.tpl
new file mode 100644
index 000000000000..2a126e61ea5b
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_billing_html.tpl
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {ts 1=$membershipType}Billing details for your automatically renewed %1 membership have been updated.{/ts}
+
+
+
+
+
+
+
+
+ {ts}Billing Name and Address{/ts}
+
+
+
+
+ {$billingName}
+ {$address|nl2br}
+ {$email}
+
+
+
+
+ {ts}Credit Card Information{/ts}
+
+
+
+
+ {$credit_card_type}
+ {$credit_card_number}
+ {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+
+
+
+
+ {ts 1=$receipt_from_email}If you have questions please contact us at %1{/ts}
+
+
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_billing_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_billing_subject.tpl
new file mode 100644
index 000000000000..3579f9033090
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_billing_subject.tpl
@@ -0,0 +1 @@
+{ts}Membership Autorenewal Billing Updates{/ts} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_billing_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_billing_text.tpl
new file mode 100644
index 000000000000..1100caf19107
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_billing_text.tpl
@@ -0,0 +1,23 @@
+{contact.email_greeting},
+
+{ts 1=$membershipType}Billing details for your automatically renewed %1 membership have been updated.{/ts}
+
+===========================================================
+{ts}Billing Name and Address{/ts}
+
+===========================================================
+{$billingName}
+{$address}
+
+{$email}
+
+===========================================================
+{ts}Credit Card Information{/ts}
+
+===========================================================
+{$credit_card_type}
+{$credit_card_number}
+{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+
+
+{ts 1=$receipt_from_email}If you have questions please contact us at %1{/ts}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_cancelled_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_cancelled_html.tpl
new file mode 100644
index 000000000000..b9709cfe60aa
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_cancelled_html.tpl
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {ts 1=$membershipType}The automatic renewal of your %1 membership has been cancelled as requested. This does not affect the status of your membership - you will receive a separate notification when your membership is up for renewal.{/ts}
+
+
+
+
+
+
+
+
+ {ts}Membership Information{/ts}
+
+
+
+
+ {ts}Membership Status{/ts}
+
+
+ {$membership_status}
+
+
+ {if $mem_start_date}
+
+
+ {ts}Membership Start Date{/ts}
+
+
+ {$mem_start_date|crmDate}
+
+
+ {/if}
+ {if $mem_end_date}
+
+
+ {ts}Membership End Date{/ts}
+
+
+ {$mem_end_date|crmDate}
+
+
+ {/if}
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_cancelled_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_cancelled_subject.tpl
new file mode 100644
index 000000000000..69c2ab8a3c1e
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_cancelled_subject.tpl
@@ -0,0 +1 @@
+{ts}Autorenew Membership Cancellation Notification{/ts} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_cancelled_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_cancelled_text.tpl
new file mode 100644
index 000000000000..635767841175
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_autorenew_cancelled_text.tpl
@@ -0,0 +1,14 @@
+{contact.email_greeting},
+
+{ts 1=$membershipType}The automatic renewal of your %1 membership has been cancelled as requested. This does not affect the status of your membership - you will receive a separate notification when your membership is up for renewal.{/ts}
+
+===========================================================
+{ts}Membership Information{/ts}
+
+===========================================================
+{ts}Membership Status{/ts}: {$membership_status}
+{if $mem_start_date}{ts}Membership Start Date{/ts}: {$mem_start_date|crmDate}
+{/if}
+{if $mem_end_date}{ts}Membership End Date{/ts}: {$mem_end_date|crmDate}
+{/if}
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_offline_receipt_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_offline_receipt_html.tpl
new file mode 100644
index 000000000000..4f7ed9eea917
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_offline_receipt_html.tpl
@@ -0,0 +1,297 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {if $formValues.receipt_text_signup}
+ {$formValues.receipt_text_signup|htmlize}
+ {elseif $formValues.receipt_text_renewal}
+ {$formValues.receipt_text_renewal|htmlize}
+ {else}
+ {ts}Thank you for your support.{/ts}
+ {/if}
+ {if ! $cancelled}
+ {ts}Please print this receipt for your records.{/ts}
+ {/if}
+
+
+
+
+
+ {if !$lineItem}
+
+
+ {ts}Membership Information{/ts}
+
+
+
+
+ {ts}Membership Type{/ts}
+
+
+ {$membership_name}
+
+
+ {/if}
+ {if ! $cancelled}
+ {if !$lineItem}
+
+
+ {ts}Membership Start Date{/ts}
+
+
+ {$mem_start_date}
+
+
+
+
+ {ts}Membership End Date{/ts}
+
+
+ {$mem_end_date}
+
+
+ {/if}
+ {if $formValues.total_amount OR $formValues.total_amount eq 0 }
+
+
+ {ts}Membership Fee{/ts}
+
+
+ {if $formValues.contributionType_name}
+
+
+ {ts}Financial Type{/ts}
+
+
+ {$formValues.contributionType_name}
+
+
+ {/if}
+
+ {if $lineItem}
+ {foreach from=$lineItem item=value key=priceset}
+
+
+ {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
+
+ {ts}Item{/ts}
+ {ts}Fee{/ts}
+ {if $dataArray}
+ {ts}SubTotal{/ts}
+ {ts}Tax Rate{/ts}
+ {ts}Tax Amount{/ts}
+ {ts}Total{/ts}
+ {/if}
+ {ts}Membership Start Date{/ts}
+ {ts}Membership End Date{/ts}
+
+ {foreach from=$value item=line}
+
+
+ {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}{$line.description|truncate:30:"..."}
{/if}
+
+
+ {$line.line_total|crmMoney}
+
+ {if $dataArray}
+
+ {$line.unit_price*$line.qty|crmMoney}
+
+ {if $line.tax_rate != "" || $line.tax_amount != ""}
+
+ {$line.tax_rate|string_format:"%.2f"}%
+
+
+ {$line.tax_amount|crmMoney}
+
+ {else}
+
+
+ {/if}
+
+ {$line.line_total+$line.tax_amount|crmMoney}
+
+ {/if}
+
+ {$line.start_date}
+
+
+ {$line.end_date}
+
+
+ {/foreach}
+
+
+
+ {/foreach}
+ {if $dataArray}
+
+
+ {ts}Amount Before Tax:{/ts}
+
+
+ {$formValues.total_amount-$totalTaxAmount|crmMoney}
+
+
+ {foreach from=$dataArray item=value key=priceset}
+
+ {if $priceset}
+ {$taxTerm} {$priceset|string_format:"%.2f"}%
+ {$value|crmMoney:$currency}
+ {elseif $priceset == 0}
+ {ts}No{/ts} {$taxTerm}
+ {$value|crmMoney:$currency}
+ {/if}
+
+ {/foreach}
+ {/if}
+ {/if}
+ {if isset($totalTaxAmount)}
+
+
+ {ts}Total Tax Amount{/ts}
+
+
+ {$totalTaxAmount|crmMoney:$currency}
+
+
+ {/if}
+
+
+ {ts}Amount{/ts}
+
+
+ {$formValues.total_amount|crmMoney}
+
+
+ {if $receive_date}
+
+
+ {ts}Date Received{/ts}
+
+
+ {$receive_date|truncate:10:''|crmDate}
+
+
+ {/if}
+ {if $formValues.paidBy}
+
+
+ {ts}Paid By{/ts}
+
+
+ {$formValues.paidBy}
+
+
+ {if $formValues.check_number}
+
+
+ {ts}Check Number{/ts}
+
+
+ {$formValues.check_number}
+
+
+ {/if}
+ {/if}
+ {/if}
+ {/if}
+
+
+
+
+ {if $isPrimary}
+
+
+
+
+ {if $contributeMode ne 'notify' and !$isAmountzero and !$is_pay_later }
+
+
+ {ts}Billing Name and Address{/ts}
+
+
+
+
+ {$billingName}
+ {$address}
+
+
+ {/if}
+
+ {if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later}
+
+
+ {ts}Credit Card Information{/ts}
+
+
+
+
+ {$credit_card_type}
+ {$credit_card_number}
+
+
+
+
+ {ts}Expires{/ts}
+
+
+ {$credit_card_exp_date|truncate:7:''|crmDate}
+
+
+ {/if}
+
+
+
+
+ {/if}
+
+ {if $customValues}
+
+
+
+
+
+ {ts}Membership Options{/ts}
+
+
+ {foreach from=$customValues item=value key=customName}
+
+
+ {$customName}
+
+
+ {$value}
+
+
+ {/foreach}
+
+
+
+ {/if}
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_offline_receipt_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_offline_receipt_subject.tpl
new file mode 100644
index 000000000000..22f1b0b6a0af
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_offline_receipt_subject.tpl
@@ -0,0 +1,6 @@
+{if $receiptType EQ 'membership signup'}
+{ts}Membership Confirmation and Receipt{/ts}
+{elseif $receiptType EQ 'membership renewal'}
+{ts}Membership Renewal Confirmation and Receipt{/ts}
+{/if}
+{contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_offline_receipt_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_offline_receipt_text.tpl
new file mode 100644
index 000000000000..057bb14b0440
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_offline_receipt_text.tpl
@@ -0,0 +1,115 @@
+{contact.email_greeting},
+
+{if $formValues.receipt_text_signup}
+{$formValues.receipt_text_signup}
+{elseif $formValues.receipt_text_renewal}
+{$formValues.receipt_text_renewal}
+{else}{ts}Thank you for your support.{/ts}{/if}
+
+{if ! $cancelled}{ts}Please print this receipt for your records.{/ts}
+
+
+{/if}
+{if !$lineItem}
+===========================================================
+{ts}Membership Information{/ts}
+
+===========================================================
+{ts}Membership Type{/ts}: {$membership_name}
+{/if}
+{if ! $cancelled}
+{if !$lineItem}
+{ts}Membership Start Date{/ts}: {$mem_start_date}
+{ts}Membership End Date{/ts}: {$mem_end_date}
+{/if}
+
+{if $formValues.total_amount OR $formValues.total_amount eq 0 }
+===========================================================
+{ts}Membership Fee{/ts}
+
+===========================================================
+{if $formValues.contributionType_name}
+{ts}Financial Type{/ts}: {$formValues.contributionType_name}
+{/if}
+{if $lineItem}
+{foreach from=$lineItem item=value key=priceset}
+{capture assign=ts_item}{ts}Item{/ts}{/capture}
+{capture assign=ts_total}{ts}Fee{/ts}{/capture}
+{if $dataArray}
+{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}
+{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}
+{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}
+{capture assign=ts_total}{ts}Total{/ts}{/capture}
+{/if}
+{capture assign=ts_start_date}{ts}Membership Start Date{/ts}{/capture}
+{capture assign=ts_end_date}{ts}Membership End Date{/ts}{/capture}
+{$ts_item|string_format:"%-30s"} {$ts_total|string_format:"%10s"} {if $dataArray} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {$ts_total|string_format:"%10s"} {/if} {$ts_start_date|string_format:"%20s"} {$ts_end_date|string_format:"%20s"}
+--------------------------------------------------------------------------------------------------
+
+{foreach from=$value item=line}
+{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.line_total|crmMoney|string_format:"%10s"} {if $dataArray} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {if $line.tax_rate != "" || $line.tax_amount != ""} {$line.tax_rate|string_format:"%.2f"} % {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {else} {/if} {$line.line_total+$line.tax_amount|crmMoney|string_format:"%10s"} {/if} {$line.start_date|string_format:"%20s"} {$line.end_date|string_format:"%20s"}
+{/foreach}
+{/foreach}
+
+{if $dataArray}
+{ts}Amount before Tax{/ts}: {$formValues.total_amount-$totalTaxAmount|crmMoney:$currency}
+
+{foreach from=$dataArray item=value key=priceset}
+{if $priceset}
+{$taxTerm} {$priceset|string_format:"%.2f"} %: {$value|crmMoney:$currency}
+{elseif $priceset == 0}
+{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}
+{/if}
+{/foreach}
+{/if}
+--------------------------------------------------------------------------------------------------
+{/if}
+
+{if isset($totalTaxAmount)}
+{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
+{/if}
+
+{ts}Amount{/ts}: {$formValues.total_amount|crmMoney}
+{if $receive_date}
+{ts}Date Received{/ts}: {$receive_date|truncate:10:''|crmDate}
+{/if}
+{if $formValues.paidBy}
+{ts}Paid By{/ts}: {$formValues.paidBy}
+{if $formValues.check_number}
+{ts}Check Number{/ts}: {$formValues.check_number}
+{/if}
+{/if}
+{/if}
+{/if}
+
+{if $isPrimary }
+{if $contributeMode ne 'notify' and !$isAmountzero and !$is_pay_later }
+
+===========================================================
+{ts}Billing Name and Address{/ts}
+
+===========================================================
+{$billingName}
+{$address}
+{/if}
+
+{if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later}
+===========================================================
+{ts}Credit Card Information{/ts}
+
+===========================================================
+{$credit_card_type}
+{$credit_card_number}
+{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+{/if}
+{/if}
+
+{if $customValues}
+===========================================================
+{ts}Membership Options{/ts}
+
+===========================================================
+{foreach from=$customValues item=value key=customName}
+ {$customName} : {$value}
+{/foreach}
+{/if}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_online_receipt_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_online_receipt_html.tpl
new file mode 100644
index 000000000000..a1e20138885d
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_online_receipt_html.tpl
@@ -0,0 +1,556 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {if $receipt_text}
+ {$receipt_text|htmlize}
+ {/if}
+
+ {if $is_pay_later}
+ {$pay_later_receipt}
{* FIXME: this might be text rather than HTML *}
+ {else}
+ {ts}Please print this confirmation for your records.{/ts}
+ {/if}
+
+
+
+
+
+
+ {if $membership_assign && !$useForMember}
+
+
+ {ts}Membership Information{/ts}
+
+
+
+
+ {ts}Membership Type{/ts}
+
+
+ {$membership_name}
+
+
+ {if $mem_start_date}
+
+
+ {ts}Membership Start Date{/ts}
+
+
+ {$mem_start_date|crmDate}
+
+
+ {/if}
+ {if $mem_end_date}
+
+
+ {ts}Membership End Date{/ts}
+
+
+ {$mem_end_date|crmDate}
+
+
+ {/if}
+ {/if}
+
+
+ {if $amount}
+
+
+ {ts}Membership Fee{/ts}
+
+
+
+ {if !$useForMember and $membership_amount and $is_quick_config}
+
+
+
+ {ts 1=$membership_name}%1 Membership{/ts}
+
+
+ {$membership_amount|crmMoney}
+
+
+ {if $amount && !$is_separate_payment }
+
+
+ {ts}Contribution Amount{/ts}
+
+
+ {$amount|crmMoney}
+
+
+
+
+ {ts}Total{/ts}
+
+
+ {$amount+$membership_amount|crmMoney}
+
+
+ {/if}
+
+ {elseif !$useForMember && $lineItem and $priceSetID and !$is_quick_config}
+
+ {foreach from=$lineItem item=value key=priceset}
+
+
+ {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
+
+ {ts}Item{/ts}
+ {ts}Qty{/ts}
+ {ts}Each{/ts}
+ {ts}Total{/ts}
+
+ {foreach from=$value item=line}
+
+
+ {$line.description|truncate:30:"..."}
+
+
+ {$line.qty}
+
+
+ {$line.unit_price|crmMoney}
+
+
+ {$line.line_total|crmMoney}
+
+
+ {/foreach}
+
+
+
+ {/foreach}
+
+
+ {ts}Total Amount{/ts}
+
+
+ {$amount|crmMoney}
+
+
+
+ {else}
+ {if $useForMember && $lineItem and !$is_quick_config}
+ {foreach from=$lineItem item=value key=priceset}
+
+
+ {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
+
+ {ts}Item{/ts}
+ {ts}Fee{/ts}
+ {if $dataArray}
+ {ts}SubTotal{/ts}
+ {ts}Tax Rate{/ts}
+ {ts}Tax Amount{/ts}
+ {ts}Total{/ts}
+ {/if}
+ {ts}Membership Start Date{/ts}
+ {ts}Membership End Date{/ts}
+
+ {foreach from=$value item=line}
+
+
+ {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}{$line.description|truncate:30:"..."}
{/if}
+
+
+ {$line.line_total|crmMoney}
+
+ {if $dataArray}
+
+ {$line.unit_price*$line.qty|crmMoney}
+
+ {if $line.tax_rate != "" || $line.tax_amount != ""}
+
+ {$line.tax_rate|string_format:"%.2f"}%
+
+
+ {$line.tax_amount|crmMoney}
+
+ {else}
+
+
+ {/if}
+
+ {$line.line_total+$line.tax_amount|crmMoney}
+
+ {/if}
+
+ {$line.start_date}
+
+
+ {$line.end_date}
+
+
+ {/foreach}
+
+
+
+ {/foreach}
+ {if $dataArray}
+
+
+ {ts}Amount Before Tax:{/ts}
+
+
+ {$amount-$totalTaxAmount|crmMoney}
+
+
+ {foreach from=$dataArray item=value key=priceset}
+
+ {if $priceset || $priceset == 0}
+ {$taxTerm} {$priceset|string_format:"%.2f"}%
+ {$value|crmMoney:$currency}
+ {else}
+ {ts}NO{/ts} {$taxTerm}
+ {$value|crmMoney:$currency}
+ {/if}
+
+ {/foreach}
+ {/if}
+ {/if}
+ {if $totalTaxAmount}
+
+
+ {ts}Total Tax Amount{/ts}
+
+
+ {$totalTaxAmount|crmMoney:$currency}
+
+
+ {/if}
+
+
+ {ts}Amount{/ts}
+
+
+ {$amount|crmMoney} {if $amount_level} - {$amount_level}{/if}
+
+
+
+ {/if}
+
+
+ {elseif $membership_amount}
+
+
+
+
+ {ts}Membership Fee{/ts}
+
+
+
+
+ {ts 1=$membership_name}%1 Membership{/ts}
+
+
+ {$membership_amount|crmMoney}
+
+
+
+
+ {/if}
+
+ {if $receive_date}
+
+
+ {ts}Date{/ts}
+
+
+ {$receive_date|crmDate}
+
+
+ {/if}
+
+ {if $is_monetary and $trxn_id}
+
+
+ {ts}Transaction #{/ts}
+
+
+ {$trxn_id}
+
+
+ {/if}
+
+ {if $membership_trx_id}
+
+
+ {ts}Membership Transaction #{/ts}
+
+
+ {$membership_trx_id}
+
+
+ {/if}
+ {if $is_recur}
+ {if $contributeMode eq 'notify' or $contributeMode eq 'directIPN'}
+
+
+ {ts 1=$cancelSubscriptionUrl}This membership will be renewed automatically. You can cancel the auto-renewal option by visiting this web page .{/ts}
+
+
+ {if $updateSubscriptionBillingUrl}
+
+
+ {ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by visiting this web page .{/ts}
+
+
+ {/if}
+ {/if}
+ {/if}
+
+ {if $honor_block_is_active}
+
+
+ {$soft_credit_type}
+
+
+ {foreach from=$honoreeProfile item=value key=label}
+
+
+ {$label}
+
+
+ {$value}
+
+
+ {/foreach}
+ {/if}
+
+ {if $pcpBlock}
+
+
+ {ts}Personal Campaign Page{/ts}
+
+
+
+
+ {ts}Display In Honor Roll{/ts}
+
+
+ {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}
+
+
+ {if $pcp_roll_nickname}
+
+
+ {ts}Nickname{/ts}
+
+
+ {$pcp_roll_nickname}
+
+
+ {/if}
+ {if $pcp_personal_note}
+
+
+ {ts}Personal Note{/ts}
+
+
+ {$pcp_personal_note}
+
+
+ {/if}
+ {/if}
+
+ {if $onBehalfProfile}
+
+
+ {$onBehalfProfile_grouptitle}
+
+
+ {foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}
+
+
+ {$onBehalfName}
+
+
+ {$onBehalfValue}
+
+
+ {/foreach}
+ {/if}
+
+ {if ! ($contributeMode eq 'notify' OR $contributeMode eq 'directIPN') and $is_monetary}
+ {if $is_pay_later}
+
+
+ {ts}Registered Email{/ts}
+
+
+
+
+ {$email}
+
+
+ {elseif $amount GT 0 OR $membership_amount GT 0}
+
+
+ {ts}Billing Name and Address{/ts}
+
+
+
+
+ {$billingName}
+ {$address|nl2br}
+ {$email}
+
+
+ {/if}
+ {/if}
+
+ {if $contributeMode eq 'direct' AND !$is_pay_later AND ($amount GT 0 OR $membership_amount GT 0)}
+
+
+ {ts}Credit Card Information{/ts}
+
+
+
+
+ {$credit_card_type}
+ {$credit_card_number}
+ {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+
+
+ {/if}
+
+ {if $selectPremium}
+
+
+ {ts}Premium Information{/ts}
+
+
+
+
+ {$product_name}
+
+
+ {if $option}
+
+
+ {ts}Option{/ts}
+
+
+ {$option}
+
+
+ {/if}
+ {if $sku}
+
+
+ {ts}SKU{/ts}
+
+
+ {$sku}
+
+
+ {/if}
+ {if $start_date}
+
+
+ {ts}Start Date{/ts}
+
+
+ {$start_date|crmDate}
+
+
+ {/if}
+ {if $end_date}
+
+
+ {ts}End Date{/ts}
+
+
+ {$end_date|crmDate}
+
+
+ {/if}
+ {if $contact_email OR $contact_phone}
+
+
+ {ts}For information about this premium, contact:{/ts}
+ {if $contact_email}
+ {$contact_email}
+ {/if}
+ {if $contact_phone}
+ {$contact_phone}
+ {/if}
+
+
+ {/if}
+ {if $is_deductible AND $price}
+
+
+ {ts 1=$price|crmMoney}The value of this premium is %1. This may affect the amount of the tax deduction you can claim. Consult your tax advisor for more information.{/ts}
+
+
+ {/if}
+ {/if}
+
+ {if $customPre}
+
+
+ {$customPre_grouptitle}
+
+
+ {foreach from=$customPre item=customValue key=customName}
+ {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
+
+
+ {$customName}
+
+
+ {$customValue}
+
+
+ {/if}
+ {/foreach}
+ {/if}
+
+ {if $customPost}
+
+
+ {$customPost_grouptitle}
+
+
+ {foreach from=$customPost item=customValue key=customName}
+ {if ($trackingFields and ! in_array($customName, $trackingFields)) or ! $trackingFields}
+
+
+ {$customName}
+
+
+ {$customValue}
+
+
+ {/if}
+ {/foreach}
+ {/if}
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_online_receipt_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_online_receipt_subject.tpl
new file mode 100644
index 000000000000..052dce5bd748
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_online_receipt_subject.tpl
@@ -0,0 +1 @@
+{if $is_pay_later}{ts}Invoice{/ts}{else}{ts}Receipt{/ts}{/if} - {$title} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_online_receipt_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_online_receipt_text.tpl
new file mode 100644
index 000000000000..5d8420876c2b
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/membership_online_receipt_text.tpl
@@ -0,0 +1,243 @@
+{contact.email_greeting},
+
+{if $receipt_text}
+{$receipt_text}
+{/if}
+{if $is_pay_later}
+
+===========================================================
+{$pay_later_receipt}
+===========================================================
+{else}
+
+{ts}Please print this receipt for your records.{/ts}
+{/if}
+
+{if $membership_assign && !$useForMember}
+===========================================================
+{ts}Membership Information{/ts}
+
+===========================================================
+{ts}Membership Type{/ts}: {$membership_name}
+{if $mem_start_date}{ts}Membership Start Date{/ts}: {$mem_start_date|crmDate}
+{/if}
+{if $mem_end_date}{ts}Membership End Date{/ts}: {$mem_end_date|crmDate}
+{/if}
+
+{/if}
+{if $amount}
+===========================================================
+{ts}Membership Fee{/ts}
+
+===========================================================
+{if !$useForMember && $membership_amount && $is_quick_config}
+{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}
+{if $amount && !$is_separate_payment }
+{ts}Contribution Amount{/ts}: {$amount|crmMoney}
+-------------------------------------------
+{ts}Total{/ts}: {$amount+$membership_amount|crmMoney}
+{/if}
+{elseif !$useForMember && $lineItem and $priceSetID & !$is_quick_config}
+{foreach from=$lineItem item=value key=priceset}
+---------------------------------------------------------
+{capture assign=ts_item}{ts}Item{/ts}{/capture}
+{capture assign=ts_qty}{ts}Qty{/ts}{/capture}
+{capture assign=ts_each}{ts}Each{/ts}{/capture}
+{capture assign=ts_total}{ts}Total{/ts}{/capture}
+{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {$ts_total|string_format:"%10s"}
+----------------------------------------------------------
+{foreach from=$value item=line}
+{$line.description|truncate:30:"..."|string_format:"%-30s"} {$line.qty|string_format:"%5s"} {$line.unit_price|crmMoney|string_format:"%10s"} {$line.line_total|crmMoney|string_format:"%10s"}
+{/foreach}
+{/foreach}
+
+{ts}Total Amount{/ts}: {$amount|crmMoney}
+{else}
+{if $useForMember && $lineItem && !$is_quick_config}
+{foreach from=$lineItem item=value key=priceset}
+{capture assign=ts_item}{ts}Item{/ts}{/capture}
+{capture assign=ts_total}{ts}Fee{/ts}{/capture}
+{if $dataArray}
+{capture assign=ts_subtotal}{ts}Subtotal{/ts}{/capture}
+{capture assign=ts_taxRate}{ts}Tax Rate{/ts}{/capture}
+{capture assign=ts_taxAmount}{ts}Tax Amount{/ts}{/capture}
+{capture assign=ts_total}{ts}Total{/ts}{/capture}
+{/if}
+{capture assign=ts_start_date}{ts}Membership Start Date{/ts}{/capture}
+{capture assign=ts_end_date}{ts}Membership End Date{/ts}{/capture}
+{$ts_item|string_format:"%-30s"} {$ts_total|string_format:"%10s"} {if $dataArray} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {$ts_total|string_format:"%10s"} {/if} {$ts_start_date|string_format:"%20s"} {$ts_end_date|string_format:"%20s"}
+--------------------------------------------------------------------------------------------------
+
+{foreach from=$value item=line}
+{capture assign=ts_item}{if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description} {$line.description}{/if}{/capture}{$ts_item|truncate:30:"..."|string_format:"%-30s"} {$line.line_total|crmMoney|string_format:"%10s"} {if $dataArray} {$line.unit_price*$line.qty|crmMoney:$currency|string_format:"%10s"} {if $line.tax_rate != "" || $line.tax_amount != ""} {$line.tax_rate|string_format:"%.2f"} % {$line.tax_amount|crmMoney:$currency|string_format:"%10s"} {else} {/if} {$line.line_total+$line.tax_amount|crmMoney|string_format:"%10s"} {/if} {$line.start_date|string_format:"%20s"} {$line.end_date|string_format:"%20s"}
+{/foreach}
+{/foreach}
+
+{if $dataArray}
+{ts}Amount before Tax{/ts}: {$amount-$totalTaxAmount|crmMoney:$currency}
+
+{foreach from=$dataArray item=value key=priceset}
+{if $priceset || $priceset == 0}
+{$taxTerm} {$priceset|string_format:"%.2f"}%: {$value|crmMoney:$currency}
+{else}
+{ts}No{/ts} {$taxTerm}: {$value|crmMoney:$currency}
+{/if}
+{/foreach}
+{/if}
+--------------------------------------------------------------------------------------------------
+{/if}
+
+{if $totalTaxAmount}
+{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
+{/if}
+
+{ts}Amount{/ts}: {$amount|crmMoney} {if $amount_level } - {$amount_level} {/if}
+{/if}
+{elseif $membership_amount}
+===========================================================
+{ts}Membership Fee{/ts}
+
+===========================================================
+{ts 1=$membership_name}%1 Membership{/ts}: {$membership_amount|crmMoney}
+{/if}
+
+{if $receive_date}
+
+{ts}Date{/ts}: {$receive_date|crmDate}
+{/if}
+{if $is_monetary and $trxn_id}
+{ts}Transaction #{/ts}: {$trxn_id}
+
+{/if}
+{if $membership_trx_id}
+{ts}Membership Transaction #{/ts}: {$membership_trx_id}
+
+{/if}
+{if $is_recur}
+{if $contributeMode eq 'notify' or $contributeMode eq 'directIPN'}
+{ts 1=$cancelSubscriptionUrl}This membership will be renewed automatically. You can cancel the auto-renewal option by visiting this web page: %1.{/ts}
+{if $updateSubscriptionBillingUrl}
+
+{ts 1=$updateSubscriptionBillingUrl}You can update billing details for this automatically renewed membership by visiting this web page .{/ts}
+{/if}
+{/if}
+{/if}
+
+{if $honor_block_is_active }
+===========================================================
+{$soft_credit_type}
+===========================================================
+{foreach from=$honoreeProfile item=value key=label}
+{$label}: {$value}
+{/foreach}
+
+{/if}
+{if $pcpBlock}
+===========================================================
+{ts}Personal Campaign Page{/ts}
+
+===========================================================
+{ts}Display In Honor Roll{/ts}: {if $pcp_display_in_roll}{ts}Yes{/ts}{else}{ts}No{/ts}{/if}
+
+{if $pcp_roll_nickname}{ts}Nickname{/ts}: {$pcp_roll_nickname}{/if}
+
+{if $pcp_personal_note}{ts}Personal Note{/ts}: {$pcp_personal_note}{/if}
+
+{/if}
+{if $onBehalfProfile}
+===========================================================
+{ts}On Behalf Of{/ts}
+
+===========================================================
+{foreach from=$onBehalfProfile item=onBehalfValue key=onBehalfName}
+{$onBehalfName}: {$onBehalfValue}
+{/foreach}
+{/if}
+
+{if !( $contributeMode eq 'notify' OR $contributeMode eq 'directIPN' ) and $is_monetary}
+{if $is_pay_later}
+===========================================================
+{ts}Registered Email{/ts}
+
+===========================================================
+{$email}
+{elseif $amount GT 0 OR $membership_amount GT 0 }
+===========================================================
+{ts}Billing Name and Address{/ts}
+
+===========================================================
+{$billingName}
+{$address}
+
+{$email}
+{/if} {* End ! is_pay_later condition. *}
+{/if}
+{if $contributeMode eq 'direct' AND !$is_pay_later AND ( $amount GT 0 OR $membership_amount GT 0 ) }
+
+===========================================================
+{ts}Credit Card Information{/ts}
+
+===========================================================
+{$credit_card_type}
+{$credit_card_number}
+{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+{/if}
+
+{if $selectPremium }
+===========================================================
+{ts}Premium Information{/ts}
+
+===========================================================
+{$product_name}
+{if $option}
+{ts}Option{/ts}: {$option}
+{/if}
+{if $sku}
+{ts}SKU{/ts}: {$sku}
+{/if}
+{if $start_date}
+{ts}Start Date{/ts}: {$start_date|crmDate}
+{/if}
+{if $end_date}
+{ts}End Date{/ts}: {$end_date|crmDate}
+{/if}
+{if $contact_email OR $contact_phone}
+
+{ts}For information about this premium, contact:{/ts}
+
+{if $contact_email}
+ {$contact_email}
+{/if}
+{if $contact_phone}
+ {$contact_phone}
+{/if}
+{/if}
+{if $is_deductible AND $price}
+
+{ts 1=$price|crmMoney}The value of this premium is %1. This may affect the amount of the tax deduction you can claim. Consult your tax advisor for more information.{/ts}{/if}
+{/if}
+
+{if $customPre}
+===========================================================
+{$customPre_grouptitle}
+
+===========================================================
+{foreach from=$customPre item=customValue key=customName}
+{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ {$customName}: {$customValue}
+{/if}
+{/foreach}
+{/if}
+
+
+{if $customPost}
+===========================================================
+{$customPost_grouptitle}
+
+===========================================================
+{foreach from=$customPost item=customValue key=customName}
+{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ {$customName}: {$customValue}
+{/if}
+{/foreach}
+{/if}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_cancelled_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_cancelled_html.tpl
new file mode 100644
index 000000000000..f6bc1b12172b
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_cancelled_html.tpl
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {ts}Your Event Registration has been cancelled.{/ts}
+
+
+
+
+
+
+
+ {ts}Event Information and Location{/ts}
+
+
+
+
+ {$event.event_title}
+ {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
+
+
+
+
+ {ts}Participant Role{/ts}:
+
+
+ {$participant.role}
+
+
+
+ {if $isShowLocation}
+
+
+ {$event.location.address.1.display|nl2br}
+
+
+ {/if}
+
+ {if $event.location.phone.1.phone || $event.location.email.1.email}
+
+
+ {ts}Event Contacts:{/ts}
+
+
+ {foreach from=$event.location.phone item=phone}
+ {if $phone.phone}
+
+
+ {if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}
+
+
+ {$phone.phone}
+
+
+ {/if}
+ {/foreach}
+ {foreach from=$event.location.email item=eventEmail}
+ {if $eventEmail.email}
+
+
+ {ts}Email{/ts}
+
+
+ {$eventEmail.email}
+
+
+ {/if}
+ {/foreach}
+ {/if}
+
+ {if $contact.email}
+
+
+ {ts}Registered Email{/ts}
+
+
+
+
+ {$contact.email}
+
+
+ {/if}
+
+ {if $register_date}
+
+
+ {ts}Registration Date{/ts}
+
+
+ {$participant.register_date|crmDate}
+
+
+ {/if}
+
+
+
+
+
+
+
+ {ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions.{/ts}
+
+
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_cancelled_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_cancelled_subject.tpl
new file mode 100644
index 000000000000..e39740983922
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_cancelled_subject.tpl
@@ -0,0 +1 @@
+{ts 1=$event.event_title}Event Registration Cancelled for %1{/ts} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_cancelled_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_cancelled_text.tpl
new file mode 100644
index 000000000000..566fdfd7372f
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_cancelled_text.tpl
@@ -0,0 +1,47 @@
+{contact.email_greeting},
+
+{ts}Your Event Registration has been cancelled.{/ts}
+
+
+===========================================================
+{ts}Event Information and Location{/ts}
+
+===========================================================
+{$event.event_title}
+{$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
+
+{ts}Participant Role{/ts}: {$participant.role}
+
+{if $isShowLocation}
+{$event.location.address.1.display|strip_tags:false}
+{/if}{*End of isShowLocation condition*}
+
+{if $event.location.phone.1.phone || $event.location.email.1.email}
+
+{ts}Event Contacts:{/ts}
+{foreach from=$event.location.phone item=phone}
+{if $phone.phone}
+
+{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone}{/if}
+{/foreach}
+{foreach from=$event.location.email item=eventEmail}
+{if $eventEmail.email}
+
+{ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach}
+{/if}
+
+{if $contact.email}
+
+===========================================================
+{ts}Registered Email{/ts}
+
+===========================================================
+{$contact.email}
+{/if}
+
+{if $register_date}
+{ts}Registration Date{/ts}: {$participant.register_date|crmDate}
+{/if}
+
+{ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions.{/ts}
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_confirm_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_confirm_html.tpl
new file mode 100644
index 000000000000..af4fa8b53550
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_confirm_html.tpl
@@ -0,0 +1,184 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+
+
+ {if !$isAdditional and $participant.id}
+
+
+ {ts}Confirm Your Registration{/ts}
+
+
+
+
+ {capture assign=confirmUrl}{crmURL p='civicrm/event/confirm' q="reset=1&participantId=`$participant.id`&cs=`$checksumValue`" a=true h=0 fe=1}{/capture}
+ Go to a web page where you can confirm your registration online
+
+
+ {/if}
+ {if $event.allow_selfcancelxfer }
+ This event allows for self-cancel or transfer
+ {capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participantID`&{contact.checksum}" h=0 a=1 fe=1}{/capture}
+ {ts}Self service cancel transfer{/ts}
+ {/if}
+
+
+
+
+
+
+ {ts}Event Information and Location{/ts}
+
+
+
+
+ {$event.event_title}
+ {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
+
+
+ {if $conference_sessions}
+
+
+ {ts}Your schedule:{/ts}
+
+
+
+
+ {assign var='group_by_day' value='NA'}
+ {foreach from=$conference_sessions item=session}
+ {if $session.start_date|date_format:"%Y/%m/%d" != $group_by_day|date_format:"%Y/%m/%d"}
+ {assign var='group_by_day' value=$session.start_date}
+ {$group_by_day|date_format:"%m/%d/%Y"}
+ {/if}
+ {$session.start_date|crmDate:0:1}{if $session.end_date}-{$session.end_date|crmDate:0:1}{/if} {$session.title}
+ {if $session.location} {$session.location} {/if}
+ {/foreach}
+
+
+ {/if}
+
+
+ {ts}Participant Role{/ts}:
+
+
+ {$participant.role}
+
+
+
+ {if $isShowLocation}
+
+
+ {$event.location.address.1.display|nl2br}
+
+
+ {/if}
+
+ {if $event.location.phone.1.phone || $event.location.email.1.email}
+
+
+ {ts}Event Contacts:{/ts}
+
+
+ {foreach from=$event.location.phone item=phone}
+ {if $phone.phone}
+
+
+ {if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}
+
+
+ {$phone.phone}
+
+
+ {/if}
+ {/foreach}
+ {foreach from=$event.location.email item=eventEmail}
+ {if $eventEmail.email}
+
+
+ {ts}Email{/ts}
+
+
+ {$eventEmail.email}
+
+
+ {/if}
+ {/foreach}
+ {/if}
+
+ {if $event.is_public}
+
+
+ {capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture}
+ {ts}Download iCalendar File{/ts}
+
+
+ {/if}
+
+ {if $contact.email}
+
+
+ {ts}Registered Email{/ts}
+
+
+
+
+ {$contact.email}
+
+
+ {/if}
+
+ {if $register_date}
+
+
+ {ts}Registration Date{/ts}
+
+
+ {$participant.register_date|crmDate}
+
+
+ {/if}
+
+
+
+
+ {if $event.allow_selfcancelxfer }
+
+
+ {ts 1=$event.selfcancelxfer_time}You may transfer your registration to another participant or cancel your registration up to %1 hours before the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}
+ {capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participant.id`&{contact.checksum}" h=0 a=1 fe=1}{/capture}
+ {ts}Click here to transfer or cancel your registration.{/ts}
+
+
+ {/if}
+
+
+ {ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions.{/ts}
+
+
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_confirm_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_confirm_text.tpl
new file mode 100644
index 000000000000..3dc53a1999e0
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_confirm_text.tpl
@@ -0,0 +1,81 @@
+{contact.email_greeting},
+{if !$isAdditional and $participant.id}
+
+===========================================================
+{ts}Confirm Your Registration{/ts}
+
+===========================================================
+{capture assign=confirmUrl}{crmURL p='civicrm/event/confirm' q="reset=1&participantId=`$participant.id`&cs=`$checksumValue`" a=true h=0 fe=1}{/capture}
+Click this link to go to a web page where you can confirm your registration online:
+{$confirmUrl}
+{/if}
+{if $event.allow_selfcancelxfer }
+{ts 1=$event.selfcancelxfer_time}You may transfer your registration to another participant or cancel your registration up to %1 hours before the event.{/ts} {if $totalAmount}{ts}Cancellations are not refundable.{/ts}{/if}
+ {capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participant.id`&{contact.checksum}" h=0 a=1 fe=1}{/capture}
+{ts}Transfer or cancel your registration:{/ts} {$selfService}
+{/if}
+===========================================================
+{ts}Event Information and Location{/ts}
+
+===========================================================
+{$event.event_title}
+{$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
+{if $conference_sessions}
+
+
+{ts}Your schedule:{/ts}
+{assign var='group_by_day' value='NA'}
+{foreach from=$conference_sessions item=session}
+{if $session.start_date|date_format:"%Y/%m/%d" != $group_by_day|date_format:"%Y/%m/%d"}
+{assign var='group_by_day' value=$session.start_date}
+
+{$group_by_day|date_format:"%m/%d/%Y"}
+
+
+{/if}
+{$session.start_date|crmDate:0:1}{if $session.end_date}-{$session.end_date|crmDate:0:1}{/if} {$session.title}
+{if $session.location} {$session.location}{/if}
+{/foreach}
+{/if}
+
+
+{ts}Participant Role{/ts}: {$participant.role}
+
+{if $isShowLocation}
+{$event.location.address.1.display|strip_tags:false}
+{/if}{*End of isShowLocation condition*}
+
+{if $event.location.phone.1.phone || $event.location.email.1.email}
+
+{ts}Event Contacts:{/ts}
+{foreach from=$event.location.phone item=phone}
+{if $phone.phone}
+
+{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone}{/if}
+{/foreach}
+{foreach from=$event.location.email item=eventEmail}
+{if $eventEmail.email}
+
+{ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach}
+{/if}
+
+{if $event.is_public}
+{capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture}
+{ts}Download iCalendar File:{/ts} {$icalFeed}
+{/if}
+
+{if $contact.email}
+
+===========================================================
+{ts}Registered Email{/ts}
+
+===========================================================
+{$contact.email}
+{/if}
+
+{if $register_date}
+{ts}Registration Date{/ts}: {$participant.register_date|crmDate}
+{/if}
+
+{ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions.{/ts}
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_expired_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_expired_html.tpl
new file mode 100644
index 000000000000..7af4dea95cb5
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_expired_html.tpl
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {ts 1=$event.event_title}Your pending event registration for %1 has expired
+because you did not confirm your registration.{/ts}
+ {ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions
+or want to inquire about reinstating your registration for this event.{/ts}
+
+
+
+
+
+
+
+ {ts}Event Information and Location{/ts}
+
+
+
+
+ {$event.event_title}
+ {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
+
+
+
+
+ {ts}Participant Role{/ts}:
+
+
+ {$participant.role}
+
+
+
+ {if $isShowLocation}
+
+
+ {$event.location.address.1.display|nl2br}
+
+
+ {/if}
+
+ {if $event.location.phone.1.phone || $event.location.email.1.email}
+
+
+ {ts}Event Contacts:{/ts}
+
+
+ {foreach from=$event.location.phone item=phone}
+ {if $phone.phone}
+
+
+ {if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}
+
+
+ {$phone.phone}
+
+
+ {/if}
+ {/foreach}
+ {foreach from=$event.location.email item=eventEmail}
+ {if $eventEmail.email}
+
+
+ {ts}Email{/ts}
+
+
+ {$eventEmail.email}
+
+
+ {/if}
+ {/foreach}
+ {/if}
+
+ {if $contact.email}
+
+
+ {ts}Registered Email{/ts}
+
+
+
+
+ {$contact.email}
+
+
+ {/if}
+
+ {if $register_date}
+
+
+ {ts}Registration Date{/ts}
+
+
+ {$participant.register_date|crmDate}
+
+
+ {/if}
+
+
+
+
+
+
+
+ {ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions.{/ts}
+
+
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_expired_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_expired_text.tpl
new file mode 100644
index 000000000000..bc8e673f982a
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_expired_text.tpl
@@ -0,0 +1,51 @@
+{contact.email_greeting},
+
+{ts 1=$event.event_title}Your pending event registration for %1 has expired
+because you did not confirm your registration.{/ts}
+
+
+{ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions
+or want to inquire about reinstating your registration for this event.{/ts}
+
+===========================================================
+{ts}Event Information and Location{/ts}
+
+===========================================================
+{$event.event_title}
+{$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
+
+{ts}Participant Role{/ts}: {$participant.role}
+
+{if $isShowLocation}
+{$event.location.address.1.display|strip_tags:false}
+{/if}{*End of isShowLocation condition*}
+
+{if $event.location.phone.1.phone || $event.location.email.1.email}
+
+{ts}Event Contacts:{/ts}
+{foreach from=$event.location.phone item=phone}
+{if $phone.phone}
+
+{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone}{/if}
+{/foreach}
+{foreach from=$event.location.email item=eventEmail}
+{if $eventEmail.email}
+
+{ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach}
+{/if}
+
+{if $contact.email}
+
+===========================================================
+{ts}Registered Email{/ts}
+
+===========================================================
+{$contact.email}
+{/if}
+
+{if $register_date}
+{ts}Registration Date{/ts}: {$participant.register_date|crmDate}
+{/if}
+
+{ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions.{/ts}
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_transferred_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_transferred_html.tpl
new file mode 100644
index 000000000000..ff1a1596084d
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_transferred_html.tpl
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {contact.email_greeting},
+ {ts 1=$to_participant}Your Event Registration has been Transferred to %1.{/ts}
+
+
+
+
+
+
+
+ {ts}Event Information and Location{/ts}
+
+
+
+
+ {$event.event_title}
+ {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
+
+
+
+
+ {ts}Participant Role{/ts}:
+
+
+ {$participant.role}
+
+
+
+ {if $isShowLocation}
+
+
+ {$event.location.address.1.display|nl2br}
+
+
+ {/if}
+
+ {if $event.location.phone.1.phone || $event.location.email.1.email}
+
+
+ {ts}Event Contacts:{/ts}
+
+
+ {foreach from=$event.location.phone item=phone}
+ {if $phone.phone}
+
+
+ {if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}
+
+
+ {$phone.phone}
+
+
+ {/if}
+ {/foreach}
+ {foreach from=$event.location.email item=eventEmail}
+ {if $eventEmail.email}
+
+
+ {ts}Email{/ts}
+
+
+ {$eventEmail.email}
+
+
+ {/if}
+ {/foreach}
+ {/if}
+
+ {if $contact.email}
+
+
+ {ts}Registered Email{/ts}
+
+
+
+
+ {$contact.email}
+
+
+ {/if}
+
+ {if $register_date}
+
+
+ {ts}Registration Date{/ts}
+
+
+ {$participant.register_date|crmDate}
+
+
+ {/if}
+
+
+
+
+
+
+
+ {ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions.{/ts}
+
+
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_transferred_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_transferred_subject.tpl
new file mode 100644
index 000000000000..2e2bf244d575
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_transferred_subject.tpl
@@ -0,0 +1 @@
+{ts 1=$event.event_title}Event Registration Transferred for %1{/ts} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_transferred_text.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_transferred_text.tpl
new file mode 100644
index 000000000000..eaaec828dc74
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/participant_transferred_text.tpl
@@ -0,0 +1,45 @@
+{contact.email_greeting},
+
+{ts 1=$to_participant}Your Event Registration has been transferred to %1.{/ts}
+
+===========================================================
+{ts}Event Information and Location{/ts}
+
+===========================================================
+{$event.event_title}
+{$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
+
+{ts}Participant Role{/ts}: {$participant.role}
+
+{if $isShowLocation}
+{$event.location.address.1.display|strip_tags:false}
+{/if}{*End of isShowLocation condition*}
+
+{if $event.location.phone.1.phone || $event.location.email.1.email}
+
+{ts}Event Contacts:{/ts}
+{foreach from=$event.location.phone item=phone}
+{if $phone.phone}
+
+{if $phone.phone_type}{$phone.phone_type_display}{else}{ts}Phone{/ts}{/if}: {$phone.phone}{/if}
+{/foreach}
+{foreach from=$event.location.email item=eventEmail}
+{if $eventEmail.email}
+
+{ts}Email{/ts}: {$eventEmail.email}{/if}{/foreach}
+{/if}
+
+{if $contact.email}
+
+===========================================================
+{ts}Registered Email{/ts}
+
+===========================================================
+{$contact.email}
+{/if}
+
+{if $register_date}
+{ts}Registration Date{/ts}: {$participant.register_date|crmDate}
+{/if}
+
+{ts 1=$domain.phone 2=$domain.email}Please contact us at %1 or send email to %2 if you have questions.{/ts}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/payment_or_refund_notification_html.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/payment_or_refund_notification_html.tpl
new file mode 100644
index 000000000000..d32860804575
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/payment_or_refund_notification_html.tpl
@@ -0,0 +1,253 @@
+
+
+
+
+
+
+
+
+{capture assign=headerStyle}colspan="2" style="text-align: left; padding: 4px; border-bottom: 1px solid #999; background-color: #eee;"{/capture}
+{capture assign=labelStyle }style="padding: 4px; border-bottom: 1px solid #999; background-color: #f7f7f7;"{/capture}
+{capture assign=valueStyle }style="padding: 4px; border-bottom: 1px solid #999;"{/capture}
+{capture assign=emptyBlockStyle }style="padding: 10px; border-bottom: 1px solid #999;background-color: #f7f7f7;"{/capture}
+{capture assign=emptyBlockValueStyle }style="padding: 10px; border-bottom: 1px solid #999;"{/capture}
+
+
+
+
+
+
+
+
+
+
+
+
+ {if $isRefund}
+ {contact.email_greeting},
+ {ts}A refund has been issued based on changes in your registration selections.{/ts}
+ {else}
+ {ts}A payment has been received.{/ts}
+ {/if}
+ {ts}Please print this confirmation for your records.{/ts}
+
+
+
+
+
+ {if $isRefund}
+
+ {ts}Refund Details{/ts}
+
+
+
+ {ts}Total Amount{/ts}
+
+
+ {$totalAmount|crmMoney}
+
+
+
+
+ {ts}You Paid{/ts}
+
+
+ {$totalPaid|crmMoney}
+
+
+
+
+ {ts}Refund Amount{/ts}
+
+
+ {$refundAmount|crmMoney}
+
+
+ {else}
+
+ {ts}Payment Details{/ts}
+
+
+
+ {ts}Total Amount{/ts}
+
+
+ {$totalAmount|crmMoney}
+
+
+
+
+ {ts}This Payment Amount{/ts}
+
+
+ {$paymentAmount|crmMoney}
+
+
+
+
+ {ts}Balance Owed{/ts}
+
+
+ {$amountOwed|crmMoney}
+ {* This will be zero after final payment. *}
+
+
+
+ {if $paymentsComplete}
+
+
+ {ts}Thank you for completing payment.{/ts}
+
+
+ {/if}
+ {/if}
+ {if $receive_date}
+
+
+ {ts}Transaction Date{/ts}
+
+
+ {$receive_date|crmDate}
+
+
+ {/if}
+ {if $trxn_id}
+
+
+ {ts}Transaction #{/ts}
+
+
+ {$trxn_id}
+
+
+ {/if}
+ {if $paidBy}
+
+
+ {ts}Paid By{/ts}
+
+
+ {$paidBy}
+
+
+ {/if}
+ {if $checkNumber}
+
+
+ {ts}Check Number{/ts}
+
+
+ {$checkNumber}
+
+
+ {/if}
+
+
+
+
+
+
+ {if $contributeMode eq 'direct' and !$isAmountzero}
+
+
+ {ts}Billing Name and Address{/ts}
+
+
+
+
+ {$billingName}
+ {$address|nl2br}
+
+
+ {/if}
+ {if $contributeMode eq'direct' and !$isAmountzero}
+
+
+ {ts}Credit Card Information{/ts}
+
+
+
+
+ {$credit_card_type}
+ {$credit_card_number}
+ {ts}Expires:{/ts} {$credit_card_exp_date|truncate:7:''|crmDate}
+
+
+ {/if}
+ {if $component eq 'event'}
+
+
+ {ts}Event Information and Location{/ts}
+
+
+
+
+ {$event.event_title}
+ {$event.event_start_date|crmDate}{if $event.event_end_date}-{if $event.event_end_date|date_format:"%Y%m%d" == $event.event_start_date|date_format:"%Y%m%d"}{$event.event_end_date|crmDate:0:1}{else}{$event.event_end_date|crmDate}{/if}{/if}
+
+
+
+ {if $event.participant_role}
+
+
+ {ts}Participant Role{/ts}
+
+
+ {$event.participant_role}
+
+
+ {/if}
+
+ {if $isShowLocation}
+
+
+ {$location.address.1.display|nl2br}
+
+
+ {/if}
+
+ {if $location.phone.1.phone || $location.email.1.email}
+
+
+ {ts}Event Contacts:{/ts}
+
+
+ {foreach from=$location.phone item=phone}
+ {if $phone.phone}
+
+
+ {if $phone.phone_type}
+ {$phone.phone_type_display}
+ {else}
+ {ts}Phone{/ts}
+ {/if}
+
+
+ {$phone.phone} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if}
+
+
+ {/if}
+ {/foreach}
+ {foreach from=$location.email item=eventEmail}
+ {if $eventEmail.email}
+
+
+ {ts}Email{/ts}
+
+
+ {$eventEmail.email}
+
+
+ {/if}
+ {/foreach}
+ {/if} {*phone block close*}
+ {/if}
+
+
+
+
+
+
+
+
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/payment_or_refund_notification_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/payment_or_refund_notification_subject.tpl
new file mode 100644
index 000000000000..0bd6ab689f0b
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/payment_or_refund_notification_subject.tpl
@@ -0,0 +1,2 @@
+{if $isRefund}{ts}Refund Notification{/ts}{else}{ts}Payment Receipt{/ts}{/if} - {if $component eq 'event'}{$event.title}{/if} - {contact.display_name}
+
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/petition_confirmation_needed_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/petition_confirmation_needed_subject.tpl
new file mode 100644
index 000000000000..2d39e4c4dcf2
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/petition_confirmation_needed_subject.tpl
@@ -0,0 +1 @@
+Confirmation of signature needed for {$petition.title} - {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/petition_sign_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/petition_sign_subject.tpl
new file mode 100644
index 000000000000..4b53e92119c6
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/petition_sign_subject.tpl
@@ -0,0 +1 @@
+Thank you for signing {$petition.title}, {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/pledge_acknowledge_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/pledge_acknowledge_subject.tpl
new file mode 100644
index 000000000000..60864d3e988e
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/pledge_acknowledge_subject.tpl
@@ -0,0 +1 @@
+{ts}Thank you for your Pledge{/ts}, {contact.display_name}
diff --git a/CRM/Upgrade/5.1.beta1.msg_template/message_templates/pledge_reminder_subject.tpl b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/pledge_reminder_subject.tpl
new file mode 100644
index 000000000000..e648dc2dea9b
--- /dev/null
+++ b/CRM/Upgrade/5.1.beta1.msg_template/message_templates/pledge_reminder_subject.tpl
@@ -0,0 +1 @@
+{ts}Pledge Payment Reminder{/ts} {ts}for{/ts} {contact.display_name}
diff --git a/CRM/Upgrade/Incremental/php/FiveTwo.php b/CRM/Upgrade/Incremental/php/FiveTwo.php
new file mode 100644
index 000000000000..b4f14e452f06
--- /dev/null
+++ b/CRM/Upgrade/Incremental/php/FiveTwo.php
@@ -0,0 +1,87 @@
+' . ts('A new permission has been added called %1 This Permission is now used to control access to the Manage Tags screen', array(1 => 'manage tags')) . '';
+ // }
+ }
+
+ /**
+ * Compute any messages which should be displayed after upgrade.
+ *
+ * @param string $postUpgradeMessage
+ * alterable.
+ * @param string $rev
+ * an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
+ */
+ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+ // Example: Generate a post-upgrade message.
+ // if ($rev == '5.12.34') {
+ // $postUpgradeMessage .= ' ' . ts("By default, CiviCRM now disables the ability to import directly from SQL. To use this feature, you must explicitly grant permission 'import SQL datasource'.");
+ // }
+ }
+
+ /*
+ * Important! All upgrade functions MUST add a 'runSql' task.
+ * Uncomment and use the following template for a new upgrade version
+ * (change the x in the function name):
+ */
+
+ // /**
+ // * Upgrade function.
+ // *
+ // * @param string $rev
+ // */
+ // public function upgrade_5_0_x($rev) {
+ // $this->addTask(ts('Upgrade DB to %1: SQL', array(1 => $rev)), 'runSql', $rev);
+ // $this->addTask('Do the foo change', 'taskFoo', ...);
+ // // Additional tasks here...
+ // // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex.
+ // // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable.
+ // }
+
+ // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) {
+ // return TRUE;
+ // }
+
+}
diff --git a/CRM/Upgrade/Incremental/sql/5.0.beta1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.0.beta1.mysql.tpl
index b58251174b72..72b6a4edf8cf 100644
--- a/CRM/Upgrade/Incremental/sql/5.0.beta1.mysql.tpl
+++ b/CRM/Upgrade/Incremental/sql/5.0.beta1.mysql.tpl
@@ -1 +1,5 @@
{* file to handle db changes in 5.0.beta1 during upgrade *}
+
+-- CRM-20184 Missing email_greeting in Workflow Templates
+{include file='../CRM/Upgrade/5.0.beta1.msg_template/civicrm_msg_template.tpl'}
+
diff --git a/CRM/Upgrade/Incremental/sql/5.1.beta1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.1.beta1.mysql.tpl
index ad3b7a584d69..355df12853cc 100644
--- a/CRM/Upgrade/Incremental/sql/5.1.beta1.mysql.tpl
+++ b/CRM/Upgrade/Incremental/sql/5.1.beta1.mysql.tpl
@@ -1 +1,4 @@
{* file to handle db changes in 5.1.beta1 during upgrade *}
+
+-- CRM-20184 Missing email_greeting in Workflow Templates
+{include file='../CRM/Upgrade/5.1.beta1.msg_template/civicrm_msg_template.tpl'}
diff --git a/CRM/Upgrade/Incremental/sql/5.2.alpha1.mysql.tpl b/CRM/Upgrade/Incremental/sql/5.2.alpha1.mysql.tpl
new file mode 100644
index 000000000000..bf706f18e386
--- /dev/null
+++ b/CRM/Upgrade/Incremental/sql/5.2.alpha1.mysql.tpl
@@ -0,0 +1 @@
+{* file to handle db changes in 5.2.alpha1 during upgrade *}
diff --git a/CRM/Utils/Date.php b/CRM/Utils/Date.php
index 82977dfc6e3f..511954c87ae4 100644
--- a/CRM/Utils/Date.php
+++ b/CRM/Utils/Date.php
@@ -791,26 +791,33 @@ public static function getRange($startDate, $endDate) {
* Get start date and end from
* the given relative term and unit
*
- * @param date $relative
- * Eg: term.unit.
+ * @param string $relative Relative format in the format term.unit.
+ * Eg: previous.day
*
- * @param $from
- * @param $to
+ * @param string $from
+ * @param string $to
+ * @param string $fromTime
+ * @param string $toTime
*
* @return array
* start date, end date
*/
- public static function getFromTo($relative, $from, $to) {
+ public static function getFromTo($relative, $from, $to, $fromTime = NULL, $toTime = '235959') {
if ($relative) {
- list($term, $unit) = explode('.', $relative);
+ list($term, $unit) = explode('.', $relative, 2);
$dateRange = self::relativeToAbsolute($term, $unit);
- $from = $dateRange['from'];
- //Take only Date Part, Sometime Time part is also present in 'to'
+ $from = substr($dateRange['from'], 0, 8);
$to = substr($dateRange['to'], 0, 8);
+ // relativeToAbsolute returns 8 char date strings or 14 char
+ // time strings.
+ if (strlen($dateRange['from']) === 14) {
+ $fromTime = substr($dateRange['from'], -6, 6);
+ }
+ if (strlen($dateRange['to']) === 14) {
}
- $from = self::processDate($from);
- $to = self::processDate($to, '235959');
+ $from = self::processDate($from, $fromTime);
+ $to = self::processDate($to, $toTime);
return array($from, $to);
}
diff --git a/CRM/Utils/System/Drupal8.php b/CRM/Utils/System/Drupal8.php
index 75f3f99701ad..9eaf10a912aa 100644
--- a/CRM/Utils/System/Drupal8.php
+++ b/CRM/Utils/System/Drupal8.php
@@ -440,7 +440,7 @@ public function loadBootStrap($params = array(), $loadUser = TRUE, $throwError =
CRM_Utils_Hook::config($config);
if ($loadUser) {
- if (!empty($params['uid']) && $username = \Drupal\user\Entity\User::load($uid)->getUsername()) {
+ if (!empty($params['uid']) && $username = \Drupal\user\Entity\User::load($params['uid'])->getUsername()) {
$this->loadUser($username);
}
elseif (!empty($params['name']) && !empty($params['pass']) && \Drupal::service('user.auth')->authenticate($params['name'], $params['pass'])) {
diff --git a/ang/crmMailing/BlockMailing.html b/ang/crmMailing/BlockMailing.html
index 6950000ac246..8e09974322ce 100644
--- a/ang/crmMailing/BlockMailing.html
+++ b/ang/crmMailing/BlockMailing.html
@@ -41,15 +41,13 @@
-
- {{grp.title}}
-
+ />
diff --git a/ang/crmMailing/BlockPreview.html b/ang/crmMailing/BlockPreview.html
index 823ea8548d92..1addd5fb4660 100644
--- a/ang/crmMailing/BlockPreview.html
+++ b/ang/crmMailing/BlockPreview.html
@@ -45,16 +45,11 @@
-
+ />
{{ts('Send test')}}
diff --git a/ang/crmMailing/BlockPreview.js b/ang/crmMailing/BlockPreview.js
index 36b72ea981df..c2b692462e53 100644
--- a/ang/crmMailing/BlockPreview.js
+++ b/ang/crmMailing/BlockPreview.js
@@ -29,16 +29,15 @@
scope.previewTestGroup = function(e) {
var $dialog = $(this);
$dialog.html('
').parent().find('button[data-op=yes]').prop('disabled', true);
- $dialog.dialog('option', 'title', ts('Send to %1', {1: _.pluck(_.where(scope.crmMailingConst.testGroupNames, {id: scope.testGroup.gid}), 'title')[0]}));
- CRM.api3('contact', 'get', {
- group: scope.testGroup.gid,
- options: {limit: 0},
- return: 'display_name,email'
+ CRM.api3({
+ contact: ['contact', 'get', {group: scope.testGroup.gid, options: {limit: 0}, return: 'display_name,email'}],
+ group: ['group', 'getsingle', {id: scope.testGroup.gid, return: 'title'}]
}).done(function(data) {
+ $dialog.dialog('option', 'title', ts('Send to %1', {1: data.group.title}));
var count = 0,
// Fixme: should this be in a template?
- markup = '';
- _.each(data.values, function(row) {
+ markup = '';
+ _.each(data.contact.values, function(row) {
// Fixme: contact api doesn't seem capable of filtering out contacts with no email, so we're doing it client-side
if (row.email) {
count++;
@@ -49,7 +48,7 @@
markup = '' + ts('A test message will be sent to %1 people:', {1: count}) + ' ' + markup;
if (!count) {
markup = ' ' +
- (data.count ? ts('None of the contacts in this group have an email address.') : ts('Group is empty.')) +
+ (data.contact.count ? ts('None of the contacts in this group have an email address.') : ts('Group is empty.')) +
'
';
}
$dialog
diff --git a/ang/crmMailingAB/EditCtrl/report.html b/ang/crmMailingAB/EditCtrl/report.html
index d75d0ed23d8a..68b79245a301 100644
--- a/ang/crmMailingAB/EditCtrl/report.html
+++ b/ang/crmMailingAB/EditCtrl/report.html
@@ -78,7 +78,7 @@
class="crm-hover-button action-item"
ng-href="{{statUrl(am.mailing, statType, 'events')}}"
title="{{ts('Browse events of type \'%1\'', {1: statType.title})}}"
- >{{stats[am.name][statType.name] || ts('n/a')}}
+ >{{stats[am.name][statType.name] || ts('n/a')}} {{stats[am.name][rateStats[statType.name]] || ' '}}
diff --git a/templates/CRM/Admin/Page/APIExplorer.tpl b/templates/CRM/Admin/Page/APIExplorer.tpl
index e7cd0181fd7c..c2856deaf0c1 100644
--- a/templates/CRM/Admin/Page/APIExplorer.tpl
+++ b/templates/CRM/Admin/Page/APIExplorer.tpl
@@ -25,10 +25,6 @@
*}
+
-
+
+
{ts}Results are displayed here.{/ts}
+
-
+
{strip}
+{/literal}
\ No newline at end of file
diff --git a/templates/CRM/Mailing/Page/Report.tpl b/templates/CRM/Mailing/Page/Report.tpl
index 3a31c03792e5..41d57c5e0588 100644
--- a/templates/CRM/Mailing/Page/Report.tpl
+++ b/templates/CRM/Mailing/Page/Report.tpl
@@ -36,7 +36,7 @@
{$report.event_totals.actionlinks.delivered}
{if $report.mailing.open_tracking}
{ts}Unique Opens{/ts}
- {$report.event_totals.opened}
+ {$report.event_totals.opened} ({$report.event_totals.opened_rate|string_format:"%0.2f"}%)
{$report.event_totals.actionlinks.opened}
{ts}Total Opens{/ts}
{$report.event_totals.total_opened}
@@ -44,7 +44,7 @@
{/if}
{if $report.mailing.url_tracking}
{ts}Click-throughs{/ts}
- {$report.event_totals.url}
+ {$report.event_totals.url} ({$report.event_totals.clickthrough_rate|string_format:"%0.2f"}%)
{$report.event_totals.actionlinks.clicks}
{/if}
{ts}Forwards{/ts}
diff --git a/tests/phpunit/CRM/Contact/BAO/ContactTest.php b/tests/phpunit/CRM/Contact/BAO/ContactTest.php
index d7250a6cd0fe..2d13628a9780 100644
--- a/tests/phpunit/CRM/Contact/BAO/ContactTest.php
+++ b/tests/phpunit/CRM/Contact/BAO/ContactTest.php
@@ -1565,4 +1565,64 @@ public function _testTimestamps($callbacks) {
$this->contactDelete($contactId);
}
+ /**
+ * Test case for UpdateProfileLocationLeak (CRM-20598).
+ */
+ public function testUpdateProfileLocationLeak() {
+ // create a simple contact with address and phone that share the same location type
+ $defaults = $this->contactParams();
+ $params = array(
+ 'first_name' => $defaults['first_name'],
+ 'last_name' => $defaults['last_name'],
+ 'contact_type' => 'Individual',
+ 'address' => array(1 => $defaults['address'][1]),
+ 'phone' => array(1 => $defaults['phone'][1]),
+ );
+ $contact = CRM_Contact_BAO_Contact::create($params);
+ $contactId = $contact->id;
+
+ // now, update using a profile with phone, email, address... that share the same location type
+ $updatePfParams = array(
+ 'first_name' => $params['first_name'],
+ 'last_name' => $params['first_name'],
+ 'street_address-Primary' => $params['address'][1]['street_address'],
+ 'state_province-Primary' => $params['address'][1]['state_province_id'],
+ 'country-Primary' => $params['address'][1]['country_id'],
+ 'phone-Primary-1' => $params['phone'][1]['phone'],
+ 'phone_ext-Primary-1' => '345',
+ );
+
+ //create the contact using create profile contact.
+ $fields = CRM_Contact_BAO_Contact::exportableFields('Individual');
+
+ // for this test, we need to make CiviCRM think we are logged in
+ // so that updateBlankLocInfo is set to 1 (erase blank value from the database)
+ CRM_Core_Session::singleton()->set('authSrc', CRM_Core_Permission::AUTH_SRC_LOGIN);
+
+ // now, emulate the contact update using a profile
+ $contactID = CRM_Contact_BAO_Contact::createProfileContact($updatePfParams, $fields, $contactId,
+ NULL, NULL, NULL, TRUE
+ );
+
+ //check the contact ids
+ $this->assertEquals($contactId, $contactID, 'check for Contact ids');
+ $phone = $this->callAPISuccess('Phone', 'getsingle', ['contact_id' => $contactID]);
+ $this->assertEquals('345', $phone['phone_ext']);
+ $this->assertEquals($params['phone'][1]['phone'], $phone['phone']);
+
+ //check the values in DB.
+ $searchParams = array(
+ 'contact_id' => $contactId,
+ 'location_type_id' => 1,
+ 'is_primary' => 1,
+ );
+ $compareParams = array(
+ 'street_address' => CRM_Utils_Array::value('street_address-Primary', $updatePfParams),
+ );
+ $this->assertDBCompareValues('CRM_Core_DAO_Address', $searchParams, $compareParams);
+
+ //cleanup DB by deleting the contact
+ $this->contactDelete($contactId);
+ }
+
}
diff --git a/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php b/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php
index be47ad9c4dff..e8651abdde16 100644
--- a/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php
+++ b/tests/phpunit/CRM/Contact/BAO/ContactType/RelationshipTest.php
@@ -101,8 +101,7 @@ public function testRelationshipTypeAddIndiviParent() {
'contact_type_b' => 'Individual',
'contact_sub_type_b' => $this->parent,
);
- $ids = array();
- $result = CRM_Contact_BAO_RelationshipType::add($params, $ids);
+ $result = CRM_Contact_BAO_RelationshipType::add($params);
$this->assertEquals($result->name_a_b, 'indivToparent');
$this->assertEquals($result->contact_type_a, 'Individual');
$this->assertEquals($result->contact_type_b, 'Individual');
@@ -119,8 +118,7 @@ public function testRelationshipTypeAddSponcorIndivi() {
'contact_sub_type_a' => $this->sponsor,
'contact_type_b' => 'Individual',
);
- $ids = array();
- $result = CRM_Contact_BAO_RelationshipType::add($params, $ids);
+ $result = CRM_Contact_BAO_RelationshipType::add($params);
$this->assertEquals($result->name_a_b, 'SponsorToIndiv');
$this->assertEquals($result->contact_type_a, 'Organization');
$this->assertEquals($result->contact_sub_type_a, $this->sponsor);
@@ -138,8 +136,7 @@ public function testRelationshipTypeAddStudentSponcor() {
'contact_type_b' => 'Organization',
'contact_sub_type_b' => $this->sponsor,
);
- $ids = array();
- $result = CRM_Contact_BAO_RelationshipType::add($params, $ids);
+ $result = CRM_Contact_BAO_RelationshipType::add($params);
$this->assertEquals($result->name_a_b, 'StudentToSponser');
$this->assertEquals($result->contact_type_a, 'Individual');
$this->assertEquals($result->contact_sub_type_a, $this->student);
@@ -160,8 +157,7 @@ public function testRelationshipCreateInvalidWithinSameType() {
'contact_type_b' => 'Individual',
'contact_sub_type_b' => $this->parent,
);
- $relTypeIds = array();
- $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams, $relTypeIds);
+ $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams);
$params = array(
'relationship_type_id' => $relType->id . '_a_b',
'contact_check' => array($this->indivi_student => 1),
@@ -187,8 +183,7 @@ public function testRelCreateInvalidWithinDiffTypeSpocorIndivi() {
'contact_sub_type_a' => $this->sponsor,
'contact_type_b' => 'Individual',
);
- $relTypeIds = array();
- $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams, $relTypeIds);
+ $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams);
$params = array(
'relationship_type_id' => $relType->id . '_a_b',
'contact_check' => array($this->individual => 1),
@@ -212,8 +207,7 @@ public function testRelCreateInvalidWithinDiffTypeStudentSponcor() {
'contact_type_b' => 'Organization',
'contact_sub_type_b' => 'Sponser',
);
- $relTypeIds = array();
- $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams, $relTypeIds);
+ $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams);
$params = array(
'relationship_type_id' => $relType->id . '_a_b',
'contact_check' => array($this->individual => 1),
@@ -240,8 +234,7 @@ public function testRelationshipCreateWithinSameType() {
'contact_type_b' => 'Individual',
'contact_sub_type_b' => $this->parent,
);
- $relTypeIds = array();
- $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams, $relTypeIds);
+ $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams);
$params = array(
'relationship_type_id' => $relType->id . '_a_b',
'is_active' => 1,
@@ -268,8 +261,7 @@ public function testRelCreateWithinDiffTypeSponsorIndivi() {
'contact_sub_type_a' => $this->sponsor,
'contact_type_b' => 'Individual',
);
- $relTypeIds = array();
- $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams, $relTypeIds);
+ $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams);
$params = array(
'relationship_type_id' => $relType->id . '_a_b',
'is_active' => 1,
@@ -293,8 +285,7 @@ public function testRelCreateWithinDiffTypeStudentSponsor() {
'contact_type_b' => 'Organization',
'contact_sub_type_b' => $this->sponsor,
);
- $relTypeIds = array();
- $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams, $relTypeIds);
+ $relType = CRM_Contact_BAO_RelationshipType::add($relTypeParams);
$params = array(
'relationship_type_id' => $relType->id . '_a_b',
'is_active' => 1,
diff --git a/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php b/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php
index cb73bbb3f4c7..2c2c4408afdc 100644
--- a/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php
+++ b/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php
@@ -216,7 +216,7 @@ public function testIPNPaymentMembershipRecurSuccessNoLeakage() {
'Last Name: Anderson',
'Email Address: anthony_anderson@civicrm.org',
'This membership will be automatically renewed every',
- 'Dear Mr. Anthony Anderson II',
+ 'Dear Anthony',
'Thanks for your auto renew membership sign-up',
));
$mut->clearMessages();
diff --git a/tests/phpunit/CRM/Mailing/BAO/QueryTest.php b/tests/phpunit/CRM/Mailing/BAO/QueryTest.php
index 020188337f95..72d1edf654ae 100644
--- a/tests/phpunit/CRM/Mailing/BAO/QueryTest.php
+++ b/tests/phpunit/CRM/Mailing/BAO/QueryTest.php
@@ -89,4 +89,27 @@ public function testOpenedMailingQuery() {
$this->assertEquals(4, count($totalOpenedMail));
}
+ /**
+ * CRM-21194: Test accurate count for unique trackable URLs
+ */
+ public function testTrackableUrlMailingQuery() {
+ $op = new PHPUnit_Extensions_Database_Operation_Insert();
+ $op->execute($this->_dbconn,
+ $this->createFlatXMLDataSet(
+ dirname(__FILE__) . '/queryDataset.xml'
+ )
+ );
+
+ // ensure that total unique clicked mail count is same while
+ // fetching rows and row count for mailing_id = 14 and
+ // trackable_url_id 12
+ $totalDistinctTrackableUrlCount = CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount(14, NULL, TRUE, 13);
+ $totalTrackableUrlCount = CRM_Mailing_Event_BAO_TrackableURLOpen::getTotalCount(14, NULL, FALSE, 13);
+ $totalTrackableUrlMail = CRM_Mailing_Event_BAO_TrackableURLOpen::getRows(14, NULL, TRUE, 13);
+
+ $this->assertEquals(3, $totalDistinctTrackableUrlCount, "Accurately display distinct count of unique trackable URLs");
+ $this->assertEquals(4, $totalTrackableUrlCount, "Accurately display count of unique trackable URLs");
+ $this->assertEquals(3, count($totalTrackableUrlMail), "Accurately display list of unique trackable URLs and who clicked them.");
+ }
+
}
diff --git a/tests/phpunit/CRM/Mailing/BAO/queryDataset.xml b/tests/phpunit/CRM/Mailing/BAO/queryDataset.xml
index 99002f828a88..c74ed0b08f9a 100644
--- a/tests/phpunit/CRM/Mailing/BAO/queryDataset.xml
+++ b/tests/phpunit/CRM/Mailing/BAO/queryDataset.xml
@@ -12,7 +12,7 @@
test05 109 n y n n
test06 110 n y2 n y
test07 111 n y y[dc] n
- test08 112 n y y[c] y
+ test08 112 n y y[c2] y
Mailing 15: Second Test Mailing Events, 2011-05-26
@@ -131,6 +131,7 @@
+
diff --git a/tests/phpunit/CRM/Report/FormTest.php b/tests/phpunit/CRM/Report/FormTest.php
new file mode 100644
index 000000000000..80a926c10ba2
--- /dev/null
+++ b/tests/phpunit/CRM/Report/FormTest.php
@@ -0,0 +1,90 @@
+
+ */
+
+/**
+ * Test CRM_Report_Form functions.
+ *
+ * @package CiviCRM
+ * @group headless
+ */
+class CRM_Report_FormTest extends CiviUnitTestCase {
+
+ public function setUp() {
+ // There are only unit tests here at present, we can skip database loading.
+ return TRUE;
+ }
+
+ public function tearDown() {
+ // There are only unit tests here at present, we can skip database loading.
+ return TRUE;
+ }
+
+ public function fromToData() {
+ $cases = array();
+ // Absolute dates
+ $cases[] = array('20170901000000', '20170913235959', 0, '09/01/2017', '09/13/2017');
+ // "Today" relative date filter
+ $date = new DateTime();
+ $expectedFrom = $date->format('Ymd') . '000000';
+ $expectedTo = $date->format('Ymd') . '235959';
+ $cases[] = array($expectedFrom, $expectedTo, 'this.day', '', '');
+ // "yesterday" relative date filter
+ $date = new DateTime();
+ $date->sub(new DateInterval('P1D'));
+ $expectedFrom = $date->format('Ymd') . '000000';
+ $expectedTo = $date->format('Ymd') . '235959';
+ $cases[] = array($expectedFrom, $expectedTo, 'previous.day', '', '');
+ return $cases;
+ }
+
+ /**
+ * Test that getFromTo returns the correct dates.
+ *
+ * @dataProvider fromToData
+ * @param $expectedFrom
+ * @param $expectedTo
+ * @param $relative
+ * @param $from
+ * @param $to
+ */
+ public function testGetFromTo($expectedFrom, $expectedTo, $relative, $from, $to) {
+ $obj = new CRM_Report_Form();
+ list($calculatedFrom, $calculatedTo) = $obj->getFromTo($relative, $from, $to);
+ $this->assertEquals($expectedFrom, $calculatedFrom);
+ $this->assertEquals($expectedTo, $calculatedTo);
+ }
+
+}
diff --git a/tests/phpunit/CRM/Utils/DateTest.php b/tests/phpunit/CRM/Utils/DateTest.php
new file mode 100644
index 000000000000..56272d6d06fb
--- /dev/null
+++ b/tests/phpunit/CRM/Utils/DateTest.php
@@ -0,0 +1,90 @@
+
+ */
+
+/**
+ * Test CRM_Utils_Date functions.
+ *
+ * @package CiviCRM
+ * @group headless
+ */
+class CRM_Utils_DateTest extends CiviUnitTestCase {
+
+ public function setUp() {
+ // There are only unit tests here at present, we can skip database loading.
+ return TRUE;
+ }
+
+ public function tearDown() {
+ // There are only unit tests here at present, we can skip database loading.
+ return TRUE;
+ }
+
+ public function fromToData() {
+ $cases = array();
+ // Absolute dates
+ $cases[] = array('20170901000000', '20170913235959', 0, '09/01/2017', '09/13/2017');
+ // "Today" relative date filter
+ $date = new DateTime();
+ $expectedFrom = $date->format('Ymd') . '000000';
+ $expectedTo = $date->format('Ymd') . '235959';
+ $cases[] = array($expectedFrom, $expectedTo, 'this.day', '', '');
+ // "yesterday" relative date filter
+ $date = new DateTime();
+ $date->sub(new DateInterval('P1D'));
+ $expectedFrom = $date->format('Ymd') . '000000';
+ $expectedTo = $date->format('Ymd') . '235959';
+ $cases[] = array($expectedFrom, $expectedTo, 'previous.day', '', '');
+ return $cases;
+ }
+
+ /**
+ * Test that getFromTo returns the correct dates.
+ *
+ * @dataProvider fromToData
+ * @param $expectedFrom
+ * @param $expectedTo
+ * @param $relative
+ * @param $from
+ * @param $to
+ */
+ public function testGetFromTo($expectedFrom, $expectedTo, $relative, $from, $to) {
+ $obj = new CRM_Utils_Date();
+ list($calculatedFrom, $calculatedTo) = $obj->getFromTo($relative, $from, $to);
+ $this->assertEquals($expectedFrom, $calculatedFrom);
+ $this->assertEquals($expectedTo, $calculatedTo);
+ }
+
+}
diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php
index d4bbc27f1a98..2e95aca070cb 100644
--- a/tests/phpunit/CiviTest/CiviUnitTestCase.php
+++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php
@@ -2786,6 +2786,7 @@ public function setupRecurringPaymentProcessorTransaction($params = array()) {
'contribution_page_id' => $this->_contributionPageID,
'payment_processor_id' => $this->_paymentProcessorID,
'is_test' => 0,
+ 'skipCleanMoney' => TRUE,
),
), $params));
$this->_contributionRecurID = $contributionRecur['id'];
diff --git a/tests/phpunit/api/v3/CaseTest.php b/tests/phpunit/api/v3/CaseTest.php
index 65c0154e9506..09fb4db9ce39 100644
--- a/tests/phpunit/api/v3/CaseTest.php
+++ b/tests/phpunit/api/v3/CaseTest.php
@@ -324,6 +324,43 @@ public function testCaseDelete() {
$this->assertEquals(0, $result['count']);
}
+ /**
+ * Test Case role relationship is correctly created
+ * for contacts.
+ */
+ public function testCaseRoleRelationships() {
+ // Create Case
+ $case = $this->callAPISuccess('case', 'create', $this->_params);
+ $relType = $this->relationshipTypeCreate(array('name_a_b' => 'Test AB', 'name_b_a' => 'Test BA', 'contact_type_b' => 'Individual'));
+ $relContact = $this->individualCreate(array('first_name' => 'First', 'last_name' => 'Last'));
+
+ $_REQUEST = array(
+ 'rel_type' => "{$relType}_b_a",
+ 'rel_contact' => $relContact,
+ 'case_id' => $case['id'],
+ 'is_unit_test' => TRUE,
+ );
+ $ret = CRM_Contact_Page_AJAX::relationship();
+ $this->assertEquals(0, $ret['is_error']);
+ //Check if relationship exist for the case.
+ $relationship = $this->callAPISuccess('Relationship', 'get', array(
+ 'sequential' => 1,
+ 'relationship_type_id' => $relType,
+ 'case_id' => $case['id'],
+ ));
+ $this->assertEquals($relContact, $relationship['values'][0]['contact_id_a']);
+ $this->assertEquals($this->_params['contact_id'], $relationship['values'][0]['contact_id_b']);
+
+ //Check if activity is assigned to correct contact.
+ $activity = $this->callAPISuccess('Activity', 'get', array(
+ 'subject' => 'Test BA : Mr. First Last II',
+ ));
+ $activityContact = $this->callAPISuccess('ActivityContact', 'get', array(
+ 'contact_id' => $relContact,
+ 'activity_id' => $activity['id'],
+ ));
+ }
+
/**
* Test get function based on activity.
*/
diff --git a/tests/phpunit/api/v3/ContactTest.php b/tests/phpunit/api/v3/ContactTest.php
index 3d8ad31dfaf2..62278cec4a12 100644
--- a/tests/phpunit/api/v3/ContactTest.php
+++ b/tests/phpunit/api/v3/ContactTest.php
@@ -1185,6 +1185,7 @@ public function testCreateIndividualWithContributionDottedSyntax() {
'invoice_id' => 67990,
'source' => 'SSF',
'contribution_status_id' => 1,
+ 'skipCleanMoney' => 1,
),
'api.website.create' => array(
'url' => "http://civicrm.org",
@@ -1226,6 +1227,7 @@ public function testCreateIndividualWithContributionChainedArrays() {
'invoice_id' => 67890,
'source' => 'SSF',
'contribution_status_id' => 1,
+ 'skipCleanMoney' => 1,
),
'api.website.create' => array(
array(
@@ -2283,6 +2285,7 @@ public function testGetIndividualWithChainedArraysFormats() {
'net_amount' => 90.00,
'source' => 'SSF',
'contribution_status_id' => 1,
+ 'skipCleanMoney' => 1,
),
'api.contribution.create.1' => array(
'receive_date' => '2011-01-01',
@@ -2294,6 +2297,7 @@ public function testGetIndividualWithChainedArraysFormats() {
'net_amount' => 90.00,
'source' => 'SSF',
'contribution_status_id' => 1,
+ 'skipCleanMoney' => 1,
),
'api.website.create' => array(
array(
@@ -2351,6 +2355,7 @@ public function testGetIndividualWithChainedArraysAndMultipleCustom() {
'invoice_id' => 67890,
'source' => 'SSF',
'contribution_status_id' => 1,
+ 'skipCleanMoney' => 1,
),
'api.contribution.create.1' => array(
'receive_date' => '2011-01-01',
@@ -2364,6 +2369,7 @@ public function testGetIndividualWithChainedArraysAndMultipleCustom() {
'invoice_id' => 67830,
'source' => 'SSF',
'contribution_status_id' => 1,
+ 'skipCleanMoney' => 1,
),
'api.website.create' => array(
array(
diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php
index 1363b1dba5c1..6d3d7ea79653 100644
--- a/tests/phpunit/api/v3/ContributionTest.php
+++ b/tests/phpunit/api/v3/ContributionTest.php
@@ -695,6 +695,7 @@ public function testCreateDefaultNow($thousandSeparator) {
$params['total_amount'] = $this->formatMoneyInput(5000.77);
$params['fee_amount'] = $this->formatMoneyInput(.77);
+ $params['skipCleanMoney'] = FALSE;
$contribution = $this->callAPISuccess('contribution', 'create', $params);
$contribution = $this->callAPISuccessGetSingle('contribution', array('id' => $contribution['id']));
diff --git a/tests/phpunit/api/v3/MailingTest.php b/tests/phpunit/api/v3/MailingTest.php
index 51d0b1fa43ba..1e506e601df6 100644
--- a/tests/phpunit/api/v3/MailingTest.php
+++ b/tests/phpunit/api/v3/MailingTest.php
@@ -685,6 +685,9 @@ public function testMailerStats() {
'Opened' => 20,
'Unique Clicks' => 0,
'Unsubscribers' => 20,
+ 'delivered_rate' => '80%',
+ 'opened_rate' => '25%',
+ 'clickthrough_rate' => '0%',
);
$this->checkArrayEquals($expectedResult, $result['values'][$mail['id']]);
}
diff --git a/xml/templates/listAll.tpl b/xml/templates/listAll.tpl
index 32d6313ec298..33fa586a0ebf 100644
--- a/xml/templates/listAll.tpl
+++ b/xml/templates/listAll.tpl
@@ -1,39 +1,12 @@
array(
+ '{$table.className}' => [
'name' => '{$table.objectName}',
'class' => '{$table.className}',
'table' => '{$tableName}',
- ),
+ ],
{/foreach}
-);
+];
diff --git a/xml/templates/message_templates/contribution_invoice_receipt_subject.tpl b/xml/templates/message_templates/contribution_invoice_receipt_subject.tpl
index f99fe4475025..80d07865574d 100644
--- a/xml/templates/message_templates/contribution_invoice_receipt_subject.tpl
+++ b/xml/templates/message_templates/contribution_invoice_receipt_subject.tpl
@@ -9,3 +9,4 @@
{else}
{ts}Invoice{/ts}
{/if}
+- {contact.display_name}
diff --git a/xml/templates/message_templates/contribution_offline_receipt_html.tpl b/xml/templates/message_templates/contribution_offline_receipt_html.tpl
index 8a840cef62c2..a4cbeee05ed5 100644
--- a/xml/templates/message_templates/contribution_offline_receipt_html.tpl
+++ b/xml/templates/message_templates/contribution_offline_receipt_html.tpl
@@ -21,7 +21,7 @@
-
+ {contact.email_greeting},
{if $formValues.receipt_text}
{$formValues.receipt_text|htmlize}
{else}
diff --git a/xml/templates/message_templates/contribution_offline_receipt_subject.tpl b/xml/templates/message_templates/contribution_offline_receipt_subject.tpl
index a2e2f61c7650..2a19c6e6c3b2 100644
--- a/xml/templates/message_templates/contribution_offline_receipt_subject.tpl
+++ b/xml/templates/message_templates/contribution_offline_receipt_subject.tpl
@@ -1 +1 @@
-{ts}Contribution Receipt{/ts}
+{ts}Contribution Receipt{/ts} - {contact.display_name}
diff --git a/xml/templates/message_templates/contribution_offline_receipt_text.tpl b/xml/templates/message_templates/contribution_offline_receipt_text.tpl
index 6b46e34259eb..5bfac13c7357 100644
--- a/xml/templates/message_templates/contribution_offline_receipt_text.tpl
+++ b/xml/templates/message_templates/contribution_offline_receipt_text.tpl
@@ -1,3 +1,5 @@
+{contact.email_greeting},
+
{if $formValues.receipt_text}
{$formValues.receipt_text}
{else}{ts}Thank you for your support.{/ts}{/if}
diff --git a/xml/templates/message_templates/contribution_online_receipt_html.tpl b/xml/templates/message_templates/contribution_online_receipt_html.tpl
index ec976ed0e525..61dc72d657b4 100644
--- a/xml/templates/message_templates/contribution_online_receipt_html.tpl
+++ b/xml/templates/message_templates/contribution_online_receipt_html.tpl
@@ -21,7 +21,7 @@
-
+ {contact.email_greeting},
{if $receipt_text}
{$receipt_text|htmlize}
{/if}
diff --git a/xml/templates/message_templates/contribution_online_receipt_subject.tpl b/xml/templates/message_templates/contribution_online_receipt_subject.tpl
index 32d4e402a82c..052dce5bd748 100644
--- a/xml/templates/message_templates/contribution_online_receipt_subject.tpl
+++ b/xml/templates/message_templates/contribution_online_receipt_subject.tpl
@@ -1 +1 @@
-{if $is_pay_later}{ts}Invoice{/ts}{else}{ts}Receipt{/ts}{/if} - {$title}
+{if $is_pay_later}{ts}Invoice{/ts}{else}{ts}Receipt{/ts}{/if} - {$title} - {contact.display_name}
diff --git a/xml/templates/message_templates/contribution_online_receipt_text.tpl b/xml/templates/message_templates/contribution_online_receipt_text.tpl
index c6328bc46e89..2820950ed170 100644
--- a/xml/templates/message_templates/contribution_online_receipt_text.tpl
+++ b/xml/templates/message_templates/contribution_online_receipt_text.tpl
@@ -1,3 +1,5 @@
+{contact.email_greeting},
+
{if $receipt_text}
{$receipt_text}
{/if}
@@ -206,4 +208,4 @@
{$customName}: {$customValue}
{/if}
{/foreach}
-{/if}
\ No newline at end of file
+{/if}
diff --git a/xml/templates/message_templates/contribution_recurring_billing_html.tpl b/xml/templates/message_templates/contribution_recurring_billing_html.tpl
index f2b9d4884239..c7b962f4857e 100644
--- a/xml/templates/message_templates/contribution_recurring_billing_html.tpl
+++ b/xml/templates/message_templates/contribution_recurring_billing_html.tpl
@@ -21,7 +21,7 @@
- {ts 1=$contact.display_name}Dear %1{/ts},
+ {contact.email_greeting},
{ts 1=$amount 2=$recur_frequency_interval 3=$recur_frequency_unit}Billing details for your recurring contribution of %1, every %2 %3 have been updated.{/ts}
@@ -62,4 +62,4 @@