'title' => ts('Activity Type'),
'name' => 'activity_type',
'type' => CRM_Utils_Type::T_STRING,
+ 'searchByLabel' => TRUE,
),
'activity_status' => array(
'title' => ts('Activity Status'),
'name' => 'activity_status',
'type' => CRM_Utils_Type::T_STRING,
+ 'searchByLabel' => TRUE,
),
);
$fields = array_merge($Activityfields, $exportableFields);
);
if ($values['is_recurring_activity']) {
- $contactActivities[$activityId]['is_recurring_activity'] = CRM_Core_BAO_RecurringEntity::getPositionAndCount($values['activity_id'], 'civicrm_activity');
+ $activity['is_recurring_activity'] = CRM_Core_BAO_RecurringEntity::getPositionAndCount($values['activity_id'], 'civicrm_activity');
}
array_push($contactActivities, $activity);
);
CRM_Core_Form_Date::buildDateRange($form, 'activity_date', 1, '_low', '_high', ts('From'), FALSE, FALSE);
+ $form->addElement('hidden', 'activity_date_range_error');
+ $form->addFormRule(array('CRM_Activity_BAO_Query', 'formRule'), $form);
+
$followUpActivity = array(
1 => ts('Yes'),
2 => ts('No'),
return $properties;
}
+ /**
+ * Custom form rules.
+ *
+ * @param array $fields
+ * @param array $files
+ * @param CRM_Core_Form $form
+ *
+ * @return bool|array
+ */
+ public static function formRule($fields, $files, $form) {
+ $errors = array();
+
+ if (empty($fields['activity_date_low']) || empty($fields['activity_date_high'])) {
+ return TRUE;
+ }
+
+ CRM_Utils_Rule::validDateRange($fields, 'activity_date', $errors, ts('Activity Date'));
+
+ return empty($errors) ? TRUE : $errors;
+ }
+
}
* @param bool $test
*/
public function updatePaymentProcessor(&$values, $domainID, $test) {
+ if ($test) {
+ foreach (array('user_name', 'password', 'signature') as $field) {
+ $values[$field] = empty($values["test_{$field}"]) ? CRM_Utils_Array::value($field, $values) : $values["test_{$field}"];
+ }
+ }
$params = array_merge(array(
'id' => $test ? $this->_testID : $this->_id,
'domain_id' => $domainID,
// when custom data is included in this page
if (!empty($_POST['hidden_custom'])) {
- CRM_Custom_Form_CustomData::preProcess($this);
+ $this->set('type', 'Event');
+ $this->set('entityId', $this->_surveyId);
+ CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Survey', $this->_surveyId);
CRM_Custom_Form_CustomData::buildQuickForm($this);
+ CRM_Custom_Form_CustomData::setDefaultValues($this);
}
$session = CRM_Core_Session::singleton();
$params['is_active'] = CRM_Utils_Array::value('is_active', $params, 0);
$params['is_default'] = CRM_Utils_Array::value('is_default', $params, 0);
+ $customFields = CRM_Core_BAO_CustomField::getFields('Survey');
+ $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params,
+ $this->_surveyId,
+ 'Survey'
+ );
+
$surveyId = CRM_Campaign_BAO_Survey::create($params);
// also update the ProfileModule tables
$this->assign('action', $this->_action);
$this->assign('surveyId', $this->_surveyId);
+ // when custom data is included in this page
+ if (!empty($_POST['hidden_custom'])) {
+ $this->set('type', 'Event');
+ $this->set('entityId', $this->_surveyId);
+ CRM_Custom_Form_CustomData::preProcess($this, NULL, NULL, 1, 'Survey', $this->_surveyId);
+ CRM_Custom_Form_CustomData::buildQuickForm($this);
+ CRM_Custom_Form_CustomData::setDefaultValues($this);
+ }
+
// CRM-11480, CRM-11682
// Preload libraries required by the "Questions" tab
CRM_UF_Page_ProfileEditor::registerProfileScripts();
// CRM-5081 - formatting the dates to omit seconds.
// Note the 00 in the date format string is needed otherwise later on it thinks scheduled ones are overdue.
$select = "
- SELECT COUNT(ca.id) AS ismultiple,
+ SELECT SQL_CALC_FOUND_ROWS COUNT(ca.id) AS ismultiple,
ca.id AS id,
ca.activity_type_id AS type,
ca.activity_type_id AS activity_type_id,
$queryParams = array(1 => array($caseID, 'Integer'));
$dao = CRM_Core_DAO::executeQuery($query, $queryParams);
+ $caseCount = CRM_Core_DAO::singleValueQuery('SELECT FOUND_ROWS()');
$activityTypes = CRM_Case_PseudoConstant::caseActivityType(FALSE, TRUE);
$activityStatuses = CRM_Core_PseudoConstant::activityStatus();
}
$caseActivities = array();
- $caseCount = 0;
while ($dao->fetch()) {
- $caseCount++;
$caseActivity = array();
$caseActivityId = $dao->id;
CRM_Core_Form_Date::buildDateRange($form, 'case_from', 1, '_start_date_low', '_start_date_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'case_to', 1, '_end_date_low', '_end_date_high', ts('From'), FALSE);
+ $form->addElement('hidden', 'case_from_start_date_range_error');
+ $form->addElement('hidden', 'case_to_end_date_range_error');
+ $form->addFormRule(array('CRM_Case_BAO_Query', 'formRule'), $form);
$form->assign('validCiviCase', TRUE);
public static function searchAction(&$row, $id) {
}
+ /**
+ * Custom form rules.
+ *
+ * @param array $fields
+ * @param array $files
+ * @param CRM_Core_Form $form
+ *
+ * @return bool|array
+ */
+ public static function formRule($fields, $files, $form) {
+ $errors = array();
+
+ if ((empty($fields['case_from_start_date_low']) || empty($fields['case_from_start_date_high'])) && (empty($fields['case_to_end_date_low']) || empty($fields['case_to_end_date_high']))) {
+ return TRUE;
+ }
+
+ CRM_Utils_Rule::validDateRange($fields, 'case_from_start_date', $errors, ts('Case Start Date'));
+ CRM_Utils_Rule::validDateRange($fields, 'case_to_end_date', $errors, ts('Case End Date'));
+
+ return empty($errors) ? TRUE : $errors;
+ }
+
}
// format activity custom data
if (!empty($params['hidden_custom'])) {
if ($this->_activityId) {
+ // retrieve and include the custom data of old Activity
+ $oldActivity = civicrm_api3('Activity', 'getsingle', array('id' => $this->_activityId));
+ $params = array_merge($params, $oldActivity);
+
// unset custom fields-id from params since we want custom
// fields to be saved for new activity.
foreach ($params as $key => $value) {
else {
$newActParams['original_id'] = $activity->id;
}
- //is_current_revision will be set to 1 by default.
+ //is_current_revision will be set to 1 by default.
// add attachments if any
CRM_Core_BAO_File::formatAttachment($newActParams,
$newActParams,
}
}
else {
- $params['group_type'] = '';
+ $params['group_type'] = NULL;
}
$session = CRM_Core_Session::singleton();
$group['DT_RowId'] = 'row_' . $value['id'];
if (!$params['parentsOnly']) {
foreach ($value['class'] as $id => $class) {
- if ($class = 'crm-group-parent') {
+ if ($class == 'crm-group-parent') {
unset($value['class'][$id]);
}
}
";
}
else {
+
$query = "
DELETE gc
FROM civicrm_group_contact_cache gc
INNER JOIN civicrm_group g ON g.id = gc.group_id
-WHERE TIMESTAMPDIFF(MINUTE, g.cache_date, $now) >= $smartGroupCacheTimeout
+WHERE g.cache_date <= %1
";
$update = "
UPDATE civicrm_group g
SET cache_date = null,
refresh_date = null
-WHERE TIMESTAMPDIFF(MINUTE, cache_date, $now) >= $smartGroupCacheTimeout
+WHERE g.cache_date <= %1
";
$refresh = "
UPDATE civicrm_group g
SET refresh_date = $refreshTime
-WHERE TIMESTAMPDIFF(MINUTE, cache_date, $now) < $smartGroupCacheTimeout
+WHERE g.cache_date > %1
AND refresh_date IS NULL
";
+ $cacheTime = date('Y-m-d H-i-s', strtotime("- $smartGroupCacheTimeout minutes"));
+ $params = array(1 => array($cacheTime, 'String'));
}
}
elseif (is_array($groupID)) {
return $params;
}
+ self::filterCountryFromValuesIfStateExists($formValues);
+
foreach ($formValues as $id => $values) {
if (self::isAlreadyProcessedForQueryFormat($values)) {
return in_array($operator, CRM_Core_DAO::acceptedSQLOperators());
}
+ /**
+ * If the state and country are passed remove state.
+ *
+ * Country is implicit from the state, but including both results in
+ * a poor query as there is no combined index on state AND country.
+ *
+ * CRM-18125
+ *
+ * @param array $formValues
+ */
+ public static function filterCountryFromValuesIfStateExists(&$formValues) {
+ if (!empty($formValues['country']) && !empty($formValues['state_province'])) {
+ // The use of array map sanitises the data by ensuring we are dealing with integers.
+ $states = implode(', ', array_map('intval', $formValues['state_province']));
+ $countryList = CRM_Core_DAO::singleValueQuery(
+ "SELECT GROUP_CONCAT(country_id) FROM civicrm_state_province WHERE id IN ($states)"
+ );
+ if ($countryList == $formValues['country']) {
+ unset($formValues['country']);
+ }
+ }
+ }
+
/**
* Create and query the db for an contact search.
*
$pseudoOptions = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
}
elseif ($fieldName == 'country_id') {
- $pseduoOptions = CRM_Core_PseudoConstant::country();
+ $pseudoOptions = CRM_Core_PseudoConstant::country();
}
elseif ($fieldName == 'county_id') {
- $pseduoOptions = CRM_Core_PseudoConstant::county();
+ $pseudoOptions = CRM_Core_PseudoConstant::county();
}
elseif ($fieldName == 'world_region') {
- $pseduoOptions = CRM_Core_PseudoConstant::worldRegion();
+ $pseudoOptions = CRM_Core_PseudoConstant::worldRegion();
}
elseif ($daoName == 'CRM_Event_DAO_Event' && $fieldName == 'id') {
$pseudoOptions = CRM_Event_BAO_Event::getEvents(0, $fieldValue, TRUE, TRUE, TRUE);
// CRM-17778 -- set preferred_mail_format to default if unset
if (empty($defaults['preferred_mail_format'])) {
- $defaults['preferred_mail_format'] = array_search('Both', CRM_Core_SelectValues::pmf());
+ $defaults['preferred_mail_format'] = 'Both';
}
//set default from greeting types CRM-4575, CRM-9739
$message = '<ul><li>' . ts('%1 has been updated.', array(1 => $name)) . '</li><li>' . ts('Contact ID %1 has been deleted.', array(1 => $this->_oid)) . '</li></ul>';
CRM_Core_Session::setStatus($message, ts('Contacts Merged'), 'success');
- //create activity for merge
- //To do: this should be refactored into BAO layer at some point.
- $messageActivity = ts('Contact ID %1 has been merged and deleted.', array(1 => $this->_oid));
- $activityParams = array(
- 'subject' => $messageActivity,
- 'source_contact_id' => $session->get('userID'),
- 'target_contact_id' => $this->_cid,
- 'activity_type_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_type_id', 'Contact Merged'),
- 'status_id' => 'Completed',
- 'priority_id' => 'Normal',
- 'activity_date_time' => date('YmdHis'),
- );
- civicrm_api3('activity', 'create', $activityParams);
-
$url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid={$this->_cid}");
if (!empty($formValues['_qf_Merge_submit'])) {
$listParamsURL = "reset=1&action=update&rgid={$this->_rgid}";
*
* @var array
*/
- protected $entityReferenceFields = array('membership_type_id');
+ protected $entityReferenceFields = array('event_id', 'membership_type_id');
/**
* Name of the selector to use.
if (!is_array($defaults)) {
$defaults = array();
}
-
+ $this->loadDefaultCountryBasedOnState($defaults);
if ($this->_ssID && empty($_POST)) {
$defaults = array_merge($defaults, CRM_Contact_BAO_SavedSearch::getFormValues($this->_ssID));
}
return $defaults;
}
+ /**
+ * Set the default country for the form.
+ *
+ * For performance reasons country might be removed from the form CRM-18125
+ * but we need to include it in our defaults or the state will not be visible.
+ *
+ * @param array $defaults
+ */
+ public function loadDefaultCountryBasedOnState(&$defaults) {
+ if (!empty($defaults['state_province'])) {
+ $defaults['country'] = CRM_Core_DAO::singleValueQuery(
+ "SELECT country_id FROM civicrm_state_province
+ WHERE id = %1",
+ array(1 => array($defaults['state_province'][0], 'Integer'))
+ );
+ }
+ }
+
}
// Get fields of type date
// FIXME: This is a hack until our fields contain this meta-data
$dateFields = array();
+ $stringFields = array();
+ $searchByLabelFields = array();
foreach ($fields as $name => $field) {
if (strpos($name, '_date') || CRM_Utils_Array::value('data_type', $field) == 'Date') {
$dateFields[] = $name;
}
+ // it's necessary to know which of the fields are from string data type
+ if (isset($field['type']) && $field['type'] === CRM_Utils_Type::T_STRING) {
+ $stringFields[] = $name;
+ }
+ // it's necessary to know which of the fields are searchable by label
+ if (isset($field['searchByLabel']) && $field['searchByLabel']) {
+ $searchByLabelFields[] = $name;
+ }
}
// Add javascript
CRM_Core_Resources::singleton()
'newBlock' => $this->get('newBlock'),
'dateFields' => $dateFields,
'fieldOptions' => self::fieldOptions(),
+ 'stringFields' => $stringFields,
+ 'searchByLabelFields' => $searchByLabelFields,
+ 'generalOperators' => array('' => ts('-operator-')) + CRM_Core_SelectValues::getSearchBuilderOperators(),
+ 'stringOperators' => array('' => ts('-operator-')) + CRM_Core_SelectValues::getSearchBuilderOperators(CRM_Utils_Type::T_STRING),
),
));
//get the saved search mapping id
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- */
-class CRM_Contact_Page_View_Sunlight extends CRM_Contact_Page_View {
-
- /**
- * Called when action is browse.
- */
- public function browse() {
- // get the primary city, state and zip for the contact
- $ids = array($this->_contactId);
- $locations = CRM_Contact_BAO_Contact_Location::getMapInfo($ids);
-
- $rows = &CRM_Utils_Sunlight::getInfo($locations[0]['city'],
- $locations[0]['state'],
- $locations[0]['postal_code']
- );
- $this->assign('rowCount', count($rows));
- $this->assign_by_ref('rows', $rows);
- }
-
- /**
- * the main function that is called when the page loads,
- * it decides the which action has to be taken for the page.
- *
- * @return null
- */
- public function run() {
- $this->preProcess();
-
- $this->browse();
-
- return parent::run();
- }
-
-}
}
// add financial item entry
$financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
- $getLine['entity_id'] = $contributionDAO->id;
- $getLine['entity_table'] = 'civicrm_contribution';
- $lineItemId = CRM_Price_BAO_LineItem::retrieve($getLine, CRM_Core_DAO::$_nullArray);
- if (!empty($lineItemId->id)) {
- $addFinancialEntry = array(
- 'transaction_date' => $financialTrxn->trxn_date,
- 'contact_id' => $contributionDAO->contact_id,
- 'amount' => $financialTrxn->total_amount,
- 'status_id' => array_search('Paid', $financialItemStatus),
- 'entity_id' => $lineItemId->id,
- 'entity_table' => 'civicrm_line_item',
- );
- $trxnIds['id'] = $financialTrxn->id;
- CRM_Financial_BAO_FinancialItem::create($addFinancialEntry, NULL, $trxnIds);
+ $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($contributionDAO->id);
+ if (!empty($lineItems)) {
+ foreach ($lineItems as $lineItemId => $lineItemValue) {
+ $paid = $lineItemValue['line_total'] * ($financialTrxn->total_amount / $contributionDAO->total_amount);
+ $addFinancialEntry = array(
+ 'transaction_date' => $financialTrxn->trxn_date,
+ 'contact_id' => $contributionDAO->contact_id,
+ 'amount' => round($paid, 2),
+ 'status_id' => array_search('Paid', $financialItemStatus),
+ 'entity_id' => $lineItemId,
+ 'entity_table' => 'civicrm_line_item',
+ );
+ $trxnIds['id'] = $financialTrxn->id;
+ CRM_Financial_BAO_FinancialItem::create($addFinancialEntry, NULL, $trxnIds);
+ }
}
if ($participantId) {
// update participant status
$values['is_email_receipt'] = $recurContrib->is_email_receipt;
}
- if (!empty($values['is_email_receipt'])) {
- $contributionParams['receipt_date'] = $changeDate;
- }
-
if (!empty($memberships)) {
foreach ($memberships as $membershipTypeIdKey => $membership) {
if ($membership) {
$values['receipt_from_name'] = CRM_Utils_Array::value('receipt_from_name', $input, $userName);
}
}
+ // Contribution ID should really always be set. But ?
+ if (!$returnMessageText && (!isset($input['receipt_update']) || $input['receipt_update'])) {
+ civicrm_api3('Contribution', 'create', array('receipt_date' => 'now', 'id' => $contribution->id));
+ }
return $contribution->composeMessageArray($input, $ids, $values, $recur, $returnMessageText);
}
*/
public static function addPayments($lineItems, $contributions) {
// get financial trxn which is a payment
- $ftSql = "SELECT ft.id
+ $ftSql = "SELECT ft.id, ft.total_amount
FROM civicrm_financial_trxn ft
INNER JOIN civicrm_entity_financial_trxn eft ON eft.financial_trxn_id = ft.id AND eft.entity_table = 'civicrm_contribution'
- WHERE eft.entity_id = %1 AND ft.is_payment = 1";
+ WHERE eft.entity_id = %1 AND ft.is_payment = 1 ORDER BY ft.id DESC LIMIT 1";
$sql = "SELECT fi.id, li.price_field_value_id
FROM civicrm_financial_item fi
INNER JOIN civicrm_line_item li ON li.id = fi.entity_id
if ($contribution->contribution_status_id != CRM_Core_OptionGroup::getValue('contribution_status', 'Partially paid', 'name')) {
continue;
}
- $ftId = CRM_Core_DAO::singleValueQuery($ftSql, array(1 => array($contribution->id, 'Integer')));
+ $ftDao = CRM_Core_DAO::executeQuery($ftSql, array(1 => array($contribution->id, 'Integer')));
+ $ftDao->fetch();
+ $trxnAmount = $ftDao->total_amount;
+ $ftId = $ftDao->id;
+
// get financial item
$dao = CRM_Core_DAO::executeQuery($sql, array(1 => array($contribution->id, 'Integer')));
while ($dao->fetch()) {
'financial_trxn_id' => $ftId,
);
foreach ($lineItems as $key => $value) {
- $paid = $value['line_total'] * ($contribution->net_amount / $contribution->total_amount);
+ $paid = $value['line_total'] * ($trxnAmount / $contribution->total_amount);
// Record Entity Financial Trxn
$params['amount'] = round($paid, 2);
$params['entity_id'] = $ftIds[$value['price_field_value_id']];
public static function recurringContribution(&$form) {
// Recurring contribution fields
foreach (self::getRecurringFields() as $key => $label) {
- if ($key == 'contribution_recur_payment_made' &&
+ if ($key == 'contribution_recur_payment_made' && !empty($form->_formValues) &&
!CRM_Utils_System::isNull(CRM_Utils_Array::value($key, $form->_formValues))
) {
$form->assign('contribution_recur_pane_open', TRUE);
}
CRM_Core_Form_Date::buildDateRange($form, $key, 1, '_low', '_high');
// If data has been entered for a recurring field, tell the tpl layer to open the pane
- if (!empty($form->_formValues[$key . '_relative']) || !empty($form->_formValues[$key . '_low']) || !empty($form->_formValues[$key . '_high'])) {
+ if (!empty($form->_formValues) && !empty($form->_formValues[$key . '_relative']) || !empty($form->_formValues[$key . '_low']) || !empty($form->_formValues[$key . '_high'])) {
$form->assign('contribution_recur_pane_open', TRUE);
break;
}
* @return array
*/
public static function getSoftContributionTotals($contact_id, $isTest = 0) {
- $query = '
+
+ $whereClause = "AND cc.cancel_date IS NULL";
+
+ $query = "
SELECT SUM(amount) as amount, AVG(total_amount) as average, cc.currency
FROM civicrm_contribution_soft ccs
LEFT JOIN civicrm_contribution cc ON ccs.contribution_id = cc.id
- WHERE cc.is_test = %2 AND ccs.contact_id = %1
- GROUP BY currency';
+ WHERE cc.is_test = %2 AND ccs.contact_id = %1 {$whereClause}
+ GROUP BY currency";
$params = array(
1 => array($contact_id, 'Integer'),
$cs = CRM_Core_DAO::executeQuery($query, $params);
$count = 0;
- $amount = $average = array();
+ $amount = $average = $cancelAmount = array();
while ($cs->fetch()) {
if ($cs->amount > 0) {
}
}
+ //to get cancel amount
+ $cancelAmountWhereClause = "AND cc.cancel_date IS NOT NULL";
+ $query = str_replace($whereClause, $cancelAmountWhereClause, $query);
+ $cancelAmountSQL = CRM_Core_DAO::executeQuery($query, $params);
+ while ($cancelAmountSQL->fetch()) {
+ if ($cancelAmountSQL->amount > 0) {
+ $count++;
+ $cancelAmount[] = $cancelAmountSQL->amount;
+ }
+ }
+
if ($count > 0) {
return array(
implode(', ', $amount),
implode(', ', $average),
implode(', ', $currency),
+ implode(', ', $cancelAmount),
);
}
return array(0, 0);
* kills a small kitten so add carefully.
*/
public static function selectorReturnProperties() {
- return array(
+ $properties = array(
'contact_type' => 1,
'contact_sub_type' => 1,
'sort_name' => 1,
'contribution_product_id' => 1,
'product_name' => 1,
);
+ if (self::isSoftCreditOptionEnabled()) {
+ $properties = array_merge($properties, self::softCreditReturnProperties());
+ }
+
+ return $properties;
}
/**
$form->addElement('text', 'contribution_source', ts('Contribution Source'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Contribution', 'source'));
CRM_Core_Form_Date::buildDateRange($form, 'contribution_date', 1, '_low', '_high', ts('From:'), FALSE);
+ // CRM-17602
+ // This hidden element added for displaying Date Range error correctly. Definitely a dirty hack, but... it works.
+ $form->addElement('hidden', 'contribution_date_range_error');
+ $form->addFormRule(array('CRM_Contribute_BAO_Query', 'formRule'), $form);
$form->add('text', 'contribution_amount_low', ts('From'), array('size' => 8, 'maxlength' => 8));
$form->addRule('contribution_amount_low', ts('Please enter a valid money value (e.g. %1).', array(1 => CRM_Utils_Money::format('9.99', ' '))), 'money');
return TRUE;
}
+ /**
+ * Custom form rules.
+ *
+ * @param array $fields
+ * @param array $files
+ * @param CRM_Core_Form $form
+ *
+ * @return bool|array
+ */
+ public static function formRule($fields, $files, $form) {
+ $errors = array();
+
+ if (empty($fields['contribution_date_high']) || empty($fields['contribution_date_low'])) {
+ return TRUE;
+ }
+
+ CRM_Utils_Rule::validDateRange($fields, 'contribution_date', $errors, ts('Date Received'));
+
+ return empty($errors) ? TRUE : $errors;
+ }
+
}
$this->processCreditCard($submittedValues);
}
else {
+ $defaults = array();
$result = CRM_Contribute_BAO_Contribution::recordAdditionalPayment($this->_contributionId, $submittedValues, $this->_paymentType, $participantId);
+ // Fetch the contribution & do proportional line item assignment
+ $params = array('id' => $this->_contributionId);
+ $contribution = CRM_Contribute_BAO_Contribution::retrieve($params, $defaults, $params);
+ $lineItems = CRM_Price_BAO_LineItem::getLineItemsByContributionID($this->_contributionId);
+ if (!empty($lineItems)) {
+ CRM_Contribute_BAO_Contribution::addPayments($lineItems, array($contribution));
+ }
// email sending
if (!empty($result) && !empty($submittedValues['is_email_receipt'])) {
$name = CRM_Utils_Array::value($contributionStatus, $statusName);
switch ($name) {
case 'Completed':
+ // [CRM-17498] Removing unsupported status change options.
+ unset($status[CRM_Utils_Array::key('Pending', $statusName)]);
+ unset($status[CRM_Utils_Array::key('Failed', $statusName)]);
+ unset($status[CRM_Utils_Array::key('Partially paid', $statusName)]);
+ unset($status[CRM_Utils_Array::key('Pending refund', $statusName)]);
case 'Cancelled':
case 'Chargeback':
case 'Refunded':
$isPending = $this->getIsPending();
$this->assign('membership_name', CRM_Utils_Array::value('name', $membershipType));
+ $this->_values['membership_name'] = CRM_Utils_Array::value('name', $membershipType);
$isPaidMembership = FALSE;
if ($this->_amount >= 0.0 && isset($membershipParams['amount'])) {
);
$form->set('renewal_mode', $renewalMode);
if (!empty($dates)) {
- $form->assign('mem_start_date',
- CRM_Utils_Date::customFormat($dates['start_date'], '%Y%m%d')
- );
- $form->assign('mem_end_date',
- CRM_Utils_Date::customFormat($dates['end_date'], '%Y%m%d')
- );
+ $form->assign('mem_start_date', CRM_Utils_Date::customFormat($dates['start_date'], '%Y%m%d'));
+ $form->assign('mem_end_date', CRM_Utils_Date::customFormat($dates['end_date'], '%Y%m%d'));
}
if (!empty($membershipContribution)) {
$form->_values['contribution_id'] = $membershipContributionID;
}
- if ($form->_paymentProcessor) {
+ if (empty($form->_params['is_pay_later']) && $form->_paymentProcessor) {
// the is_monetary concept probably should be deprecated as it can be calculated from
// the existence of 'amount' & seems fragile.
if ($form->_values['is_monetary'] && $form->_amount > 0.0 && !$form->_params['is_pay_later']) {
// Do not send an email if Recurring transaction is done via Direct Mode
// Email will we sent when the IPN is received.
foreach ($paymentResults as $result) {
- $this->completeTransaction($result['result'], $result['contribution_id']);
+ //CRM-18211: Fix situation where second contribution doesn't exist because it is optional.
+ if ($result['contribution_id']) {
+ $this->completeTransaction($result['result'], $result['contribution_id']);
+ }
}
return;
}
- $emailValues = $form->_values;
+ $emailValues = array_merge($membershipParams, $form->_values);
+ $emailValues['membership_assign'] = 1;
// Finally send an email receipt for pay-later scenario (although it might sometimes be caught above!)
if ($totalAmount == 0) {
// This feels like a bizarre hack as the variable name doesn't seem to be directly connected to it's use in the template.
$emailValues['useForMember'] = 0;
- $emailValues['membership_assign'] = 1;
$emailValues['amount'] = 0;
}
+
CRM_Contribute_BAO_ContributionPage::sendMail($contactID,
$emailValues,
$isTest, FALSE,
$params['currencyID'] = CRM_Core_Config::singleton()->defaultCurrency;
+ $is_quick_config = 0;
if (!empty($params['priceSetId'])) {
$is_quick_config = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_priceSetId, 'is_quick_config');
if ($is_quick_config) {
case 'membership_amount':
$this->_params['selectMembership'] = $params['selectMembership'] = CRM_Utils_Array::value('membership_type_id', $priceOptions[$selectedPriceOptionID]);
$this->set('selectMembership', $params['selectMembership']);
- if (CRM_Utils_Array::value('is_separate_payment', $this->_membershipBlock) == 0) {
- $this->_values['amount'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]);
- }
- break;
case 'contribution_amount':
$params['amount'] = $selectedPriceOptionID;
- $this->_values['amount'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]);
+ if ($priceField->name == 'contribution_amount' ||
+ ($priceField->name == 'membership_amount' &&
+ CRM_Utils_Array::value('is_separate_payment', $this->_membershipBlock) == 0)
+ ) {
+ $this->_values['amount'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]);
+ }
$this->_values[$selectedPriceOptionID]['value'] = CRM_Utils_Array::value('amount', $priceOptions[$selectedPriceOptionID]);
$this->_values[$selectedPriceOptionID]['label'] = CRM_Utils_Array::value('label', $priceOptions[$selectedPriceOptionID]);
$this->_values[$selectedPriceOptionID]['amount_id'] = CRM_Utils_Array::value('id', $priceOptions[$selectedPriceOptionID]);
}
// from here on down, $params['amount'] holds a monetary value (or null) rather than an option ID
$params['amount'] = self::computeAmount($params, $this->_values);
-
if (($this->_values['is_pay_later'] &&
empty($this->_paymentProcessor) &&
!array_key_exists('hidden_processor', $params)) ||
(CRM_Utils_Array::value('payment_processor_id', $params) == 0)
- && $params['amount'] != 0
+ && ($is_quick_config == 0 || $params['amount'] != 0)
) {
$params['is_pay_later'] = 1;
}
$ufJoinDAO = new CRM_Core_DAO_UFJoin();
$ufJoinDAO->module = $module;
$ufJoinDAO->entity_id = $this->_id;
+ $ufJoinDAO->entity_table = 'civicrm_contribution_page';
if ($ufJoinDAO->find(TRUE)) {
$jsonData = CRM_Contribute_BAO_ContributionPage::formatModuleData($ufJoinDAO->module_data, TRUE, $module);
if ($module == 'soft_credit') {
//check if any honree profile is enabled if yes then assign its profile type to $_honoreeProfileType
// which will be used to constraint soft-credit contact type in formRule, CRM-13981
- if ($profileId[0]) {
+ if (!empty($profileId[0]) && !empty($profileId[2])) {
$form->_honoreeProfileType = CRM_Core_BAO_UFGroup::getContactType($profileId[0]);
}
}
$input['net_amount'] = $contribution->net_amount;
$input['trxn_id'] = $contribution->trxn_id;
$input['trxn_date'] = isset($contribution->trxn_date) ? $contribution->trxn_date : NULL;
- $input['receipt_date'] = $contribution->receipt_date;
+ $input['receipt_update'] = $params['receipt_update'];
// CRM_Contribute_BAO_Contribution::composeMessageArray expects mysql formatted date
$objects['contribution']->receive_date = CRM_Utils_Date::isoToMysql($objects['contribution']->receive_date);
// reset template values before processing next transactions
$template->clearTemplateVars();
- if (!empty($params['receipt_update'])) {
- $objects['contribution']->receipt_date = date('Y-m-d H-i-s');
- $objects['contribution']->save();
- }
}
if ($elements['createPdf']) {
list($softCreditTotals['amount'],
$softCreditTotals['avg'],
- $softCreditTotals['currency']
+ $softCreditTotals['currency'],
+ $softCreditTotals['cancelAmount'] //to get cancel amount
) = CRM_Contribute_BAO_ContributionSoft::getSoftContributionTotals($this->_contactId, $isTest);
$this->assign('softCredit', TRUE);
public function &getRows($action, $offset, $rowCount, $sort, $output = NULL) {
if ($this->_includeSoftCredits) {
// especial sort order when rows include soft credits
- $sort = "civicrm_contribution.receive_date DESC, civicrm_contribution.id, civicrm_contribution_soft.id";
+ $sort = $sort->orderBy() . ", civicrm_contribution.id, civicrm_contribution_soft.id";
}
$result = $this->_query->searchQuery($offset, $rowCount, $sort,
FALSE, FALSE,
$fName = $value['name'];
$mimeType = $value['type'];
+ // If we are already passing the file id as a value then retrieve and set the file data
+ if (CRM_Utils_Rule::integer($value)) {
+ $fileDAO = new CRM_Core_DAO_File();
+ $fileDAO->id = $value;
+ $fileDAO->find(TRUE);
+ if ($fileDAO->N) {
+ $fileID = $value;
+ $fName = $fileDAO->uri;
+ $mimeType = $fileDAO->mime_type;
+ }
+ }
+
$filename = pathinfo($fName, PATHINFO_BASENAME);
- // rename this file to go into the secure directory
- if (!rename($fName, $config->customFileUploadDir . $filename)) {
+ // rename this file to go into the secure directory only if
+ // user has uploaded new file not existing verfied on the basis of $fileID
+ if (!$fileID && !rename($fName, $config->customFileUploadDir . $filename)) {
CRM_Core_Error::statusBounce(ts('Could not move custom file to custom upload directory'));
}
- if ($customValueId) {
+ if ($customValueId && !$fileID) {
$query = "
SELECT $columnName
FROM $tableName
public static function getContactDashlets($flatFormat = FALSE, $contactID = NULL) {
$dashlets = array();
- if (!$contactID) {
- $contactID = CRM_Core_Session::singleton()->get('userID');
- }
-
// Get contact dashboard dashlets.
$hasDashlets = FALSE;
$dao = new CRM_Contact_DAO_DashboardContact();
- $dao->contact_id = $contactID;
+ $dao->contact_id = $contactID ? $contactID : CRM_Core_Session::singleton()->getLoggedInContactID();
$dao->orderBy('column_no asc, weight asc');
$dao->find();
+
+ // The available list will only include those which are valid for the domain.
+ $availableDashlets = self::getDashlets();
while ($dao->fetch()) {
// When a dashlet is removed, it stays in the table with status disabled,
// so even if a user decides not to have any dashlets show, they will still
// have records in the table to indicate that we are not newly initializing.
- $hasDashlets = TRUE;
- if (!$flatFormat) {
- if ($dao->is_active) {
- // append weight so that order is preserved.
- $dashlets[$dao->column_no]["{$dao->weight}-{$dao->dashboard_id}"] = $dao->is_minimized;
+ if ((!empty($availableDashlets[$dao->dashboard_id]) && $availableDashlets[$dao->dashboard_id]['is_active'])) {
+ $hasDashlets = TRUE;
+ if (!$flatFormat) {
+ if ($dao->is_active) {
+ // append weight so that order is preserved.
+ $dashlets[$dao->column_no]["{$dao->weight}-{$dao->dashboard_id}"] = $dao->is_minimized;
+ }
+ }
+ else {
+ $dashlets[$dao->dashboard_id] = $dao->dashboard_id;
}
- }
- else {
- $dashlets[$dao->dashboard_id] = $dao->dashboard_id;
}
}
'domain_id' => CRM_Core_Config::domainID(),
'option.limit' => 0,
));
- $contactID = CRM_Core_Session::singleton()->get('userID');
+ $contactID = CRM_Core_Session::singleton()->getLoggedInContactID();
$allDashlets = CRM_Utils_Array::index(array('name'), $getDashlets['values']);
$defaultDashlets = array();
$defaults = array('blog' => 1, 'getting-started' => '0');
$domain = CRM_Core_BAO_Domain::getDomain();
$hookTokens = array();
$mailing = new CRM_Mailing_BAO_Mailing();
+ $mailing->subject = $subject;
$mailing->body_text = $text;
$mailing->body_html = $html;
$tokens = $mailing->getTokens();
$contactParams = array('contact_id' => $contactID);
$returnProperties = array();
+ if (isset($tokens['subject']['contact'])) {
+ foreach ($tokens['subject']['contact'] as $name) {
+ $returnProperties[$name] = 1;
+ }
+ }
+
if (isset($tokens['text']['contact'])) {
foreach ($tokens['text']['contact'] as $name) {
$returnProperties[$name] = 1;
$dao->entity_table = CRM_Utils_Array::value('entity_table', $params);
$dao->entity_id = CRM_Utils_Array::value('entity_id', $params);
$dao->weight = CRM_Utils_Array::value('weight', $params);
+ $dao->module = CRM_Utils_Array::value('module', $params);
if ($dao->find(TRUE)) {
return $dao->uf_group_id;
}
CRM_Core_DAO::executeQuery('SET SESSION sql_mode = STRICT_TRANS_TABLES');
}
CRM_Core_DAO::executeQuery('SET NAMES utf8');
+ CRM_Core_DAO::executeQuery('SET @uniqueID = %1', array(1 => array(CRM_Utils_Request::id(), 'String')));
}
/**
* @return Log
*/
public static function createDebugLogger($comp = '') {
- $config = CRM_Core_Config::singleton();
+ if (!isset(\Civi::$statics[__CLASS__]['logger_file' . $comp])) {
+ $config = CRM_Core_Config::singleton();
- if ($comp) {
- $comp = $comp . '.';
- }
-
- $fileName = "{$config->configAndLogDir}CiviCRM." . $comp . md5($config->dsn) . '.log';
-
- // Roll log file monthly or if greater than 256M
- // note that PHP file functions have a limit of 2G and hence
- // the alternative was introduce
- if (file_exists($fileName)) {
- $fileTime = date("Ym", filemtime($fileName));
- $fileSize = filesize($fileName);
- if (($fileTime < date('Ym')) ||
- ($fileSize > 256 * 1024 * 1024) ||
- ($fileSize < 0)
- ) {
- rename($fileName,
- $fileName . '.' . date('YmdHi')
- );
+ if ($comp) {
+ $comp = $comp . '.';
}
- }
- return Log::singleton('file', $fileName);
+ $fileName = "{$config->configAndLogDir}CiviCRM." . $comp . md5($config->dsn) . '.log';
+
+ // Roll log file monthly or if greater than 256M
+ // note that PHP file functions have a limit of 2G and hence
+ // the alternative was introduce
+ if (file_exists($fileName)) {
+ $fileTime = date("Ym", filemtime($fileName));
+ $fileSize = filesize($fileName);
+ if (($fileTime < date('Ym')) ||
+ ($fileSize > 256 * 1024 * 1024) ||
+ ($fileSize < 0)
+ ) {
+ rename($fileName,
+ $fileName . '.' . date('YmdHi')
+ );
+ }
+ }
+ \Civi::$statics[__CLASS__]['logger_file' . $comp] = $fileName;
+ }
+ return Log::singleton('file', \Civi::$statics[__CLASS__]['logger_file' . $comp]);
}
/**
$params['frequency_interval'] . " " .
$params['frequency_unit'];
$args['amt'] = $params['amount'];
- $args['totalbillingcycles'] = $params['installments'];
+ $args['totalbillingcycles'] = CRM_Utils_Array::value('installments', $params);
$args['version'] = 56.0;
$args['PROFILEREFERENCE'] = "" .
"i=" . $params['invoiceID'] . "&m=" . $component .
* @throws \Civi\Payment\Exception\PaymentProcessorException
*/
public function doQuery($params) {
- if (empty($params['trxn_id'])) {
+ //CRM-18140 - trxn_id not returned for recurring paypal transaction
+ if (!empty($params['is_recur'])) {
+ return array();
+ }
+ elseif (empty($params['trxn_id'])) {
throw new \Civi\Payment\Exception\PaymentProcessorException('transaction id not set');
}
$args = array(
$form->assign('suppressSubmitButton', $form->_paymentObject->isSuppressSubmitButtons());
- $form->assign('currency', $form->_values['currency']);
+ $form->assign('currency', CRM_Utils_Array::value('currency', $form->_values));
// also set cancel subscription url
if (!empty($form->_paymentProcessor['is_recur']) && !empty($form->_values['is_recur'])) {
$prefix . ts('view my invoices'),
ts('Allow users to view/ download their own invoices'),
),
+ 'edit api keys' => array(
+ $prefix . ts('edit api keys'),
+ ts('Edit API keys'),
+ ),
+ 'edit own api keys' => array(
+ $prefix . ts('edit own api keys'),
+ ts('Edit user\'s own API keys'),
+ ),
);
return $permissions;
* States/provinces abbreviations
* @var array
*/
- private static $stateProvinceAbbreviation;
+ private static $stateProvinceAbbreviation = array();
/**
* Country.
* array reference of all State/Province abbreviations.
*/
public static function stateProvinceAbbreviation($id = FALSE, $limit = TRUE) {
- if ($id > 1) {
- $query = "
-SELECT abbreviation
+ if ($id && is_numeric($id)) {
+ if (!array_key_exists($id, (array) self::$stateProvinceAbbreviation)) {
+ $query = "SELECT abbreviation
FROM civicrm_state_province
WHERE id = %1";
- $params = array(
- 1 => array(
- $id,
- 'Integer',
- ),
- );
- return CRM_Core_DAO::singleValueQuery($query, $params);
+ $params = array(
+ 1 => array(
+ $id,
+ 'Integer',
+ ),
+ );
+ self::$stateProvinceAbbreviation[$id] = CRM_Core_DAO::singleValueQuery($query, $params);
+ }
+ return self::$stateProvinceAbbreviation[$id];
}
-
- if (!self::$stateProvinceAbbreviation || !$id) {
-
+ else {
$whereClause = FALSE;
if ($limit) {
self::populate(self::$stateProvinceAbbreviation, 'CRM_Core_DAO_StateProvince', TRUE, 'abbreviation', 'is_active', $whereClause);
}
- if ($id) {
- if (array_key_exists($id, self::$stateProvinceAbbreviation)) {
- return self::$stateProvinceAbbreviation[$id];
- }
- else {
- $result = NULL;
- return $result;
- }
- }
return self::$stateProvinceAbbreviation;
}
}
}
+ global $tsLocale;
// Dynamic localization script
- $this->addScriptUrl(CRM_Utils_System::url('civicrm/ajax/l10n-js/' . $config->lcMessages, array('r' => $this->getCacheCode())), $jsWeight++, $region);
+ $this->addScriptUrl(CRM_Utils_System::url('civicrm/ajax/l10n-js/' . $tsLocale, array('r' => $this->getCacheCode())), $jsWeight++, $region);
// Add global settings
$settings = array(
$items[] = "js/crm.optionEdit.js";
}
+ global $tsLocale;
// Add localized jQuery UI files
- if ($config->lcMessages && $config->lcMessages != 'en_US') {
+ if ($tsLocale && $tsLocale != 'en_US') {
// Search for i18n file in order of specificity (try fr-CA, then fr)
- list($lang) = explode('_', $config->lcMessages);
+ list($lang) = explode('_', $tsLocale);
$path = "bower_components/jquery-ui/ui/i18n";
- foreach (array(str_replace('_', '-', $config->lcMessages), $lang) as $language) {
+ foreach (array(str_replace('_', '-', $tsLocale), $lang) as $language) {
$localizationFile = "$path/datepicker-{$language}.js";
if ($this->getPath('civicrm', $localizationFile)) {
$items[] = $localizationFile;
*
* @return array
*/
- public static function getSearchBuilderOperators() {
- return array(
+ public static function getSearchBuilderOperators($fieldType = NULL) {
+ $builderOperators = array(
'=' => '=',
'!=' => '≠',
'>' => '>',
'IS NULL' => ts('Is Null'),
'IS NOT NULL' => ts('Not Null'),
);
+ if ($fieldType) {
+ switch ($fieldType) {
+ case CRM_Utils_Type::T_STRING:
+ unset($builderOperators['>']);
+ unset($builderOperators['<']);
+ unset($builderOperators['>=']);
+ unset($builderOperators['<=']);
+ break;
+ }
+ }
+ return $builderOperators;
}
/**
<title>Smart Groups</title>
<page_callback>CRM_Contact_Page_View_ContactSmartGroup</page_callback>
</item>
- <item>
- <path>civicrm/contact/view/sunlight</path>
- <title>Sunlight</title>
- <page_callback>CRM_Contact_Page_View_Sunlight</page_callback>
- </item>
<item>
<path>civicrm/contact/view/note</path>
<path_arguments>cid=%%cid%%</path_arguments>
$$moniker = $result['values'][$cid];
}
- static $fields = array();
- if (empty($fields)) {
- $fields = CRM_Contact_DAO_Contact::fields();
- CRM_Core_DAO::freeResult();
- }
+ $fields = CRM_Contact_DAO_Contact::fields();
// FIXME: there must be a better way
foreach (array('main', 'other') as $moniker) {
CRM_Core_BAO_CustomValueTable::setValues($viewOnlyCustomFields);
}
- // **** Delete other contact & update prev-next caching
- $otherParams = array(
- 'contact_id' => $otherId,
- 'id' => $otherId,
- 'version' => 3,
- );
if (CRM_Core_Permission::check('merge duplicate contacts') &&
CRM_Core_Permission::check('delete contacts')
) {
CRM_Core_DAO::executeQuery($query);
}
- civicrm_api('contact', 'delete', $otherParams);
+ civicrm_api3('contact', 'delete', array('id' => $otherId));
CRM_Core_BAO_PrevNextCache::deleteItem($otherId);
}
// FIXME: else part
- /* else { */
-
- /* CRM_Core_Session::setStatus( ts('Do not have sufficient permission to delete duplicate contact.') ); */
-
- /* } */
+ // else {
+ // CRM_Core_Session::setStatus( ts('Do not have sufficient permission to delete duplicate contact.') );
+ // }
// CRM-15681 merge sub_types
if ($other_sub_types = CRM_Utils_array::value('contact_sub_type', $migrationInfo['other_details'])) {
CRM_Utils_Hook::post('merge', 'Contact', $mainId, CRM_Core_DAO::$_nullObject);
+ // Create activity for merge.
+ $messageActivity = ts('Contact ID %1 has been merged and deleted.', array(1 => $otherId));
+ civicrm_api3('activity', 'create', array(
+ 'subject' => $messageActivity,
+ 'source_contact_id' => CRM_Core_Session::singleton()->getLoggedInContactID(),
+ 'target_contact_id' => $mainId,
+ 'activity_type_id' => 'Contact Merged',
+ 'status_id' => 'Completed',
+ ));
+
return TRUE;
}
$exEventId = $val;
$extractEventId = explode(" ", $val);
$value = $extractEventId[2];
- unset($query->_where[$grouping][$key]);
+ $where = $query->_where[$grouping][$key];
+ }
+ elseif (strstr($val, 'civicrm_event.id IN')) {
+ //extract the first event id if multiple events are selected
+ preg_match('/civicrm_event.id IN \(\"(\d+)/', $val, $matches);
+ $value = $matches[1];
+ $where = $query->_where[$grouping][$key];
}
}
- $extractEventId = explode(" ", $exEventId);
- $value = $extractEventId[2];
- unset($query->_where[$grouping][$key]);
+ if ($exEventId) {
+ $extractEventId = explode(" ", $exEventId);
+ $value = $extractEventId[2];
+ }
+ elseif (!empty($matches[1])) {
+ $value = $matches[1];
+ }
+ $where = $query->_where[$grouping][$key];
}
$thisEventHasParent = CRM_Core_BAO_RecurringEntity::getParentFor($value, 'civicrm_event');
if ($thisEventHasParent) {
$value = "(" . implode(",", $allEventIds) . ")";
}
}
- $query->_where[$grouping][] = "civicrm_event.id $op {$value}";
+ $query->_where[$grouping][] = "{$where} OR civicrm_event.id $op {$value}";
$query->_qill[$grouping][] = ts('Include Repeating Events');
$query->_tables['civicrm_event'] = $query->_whereTables['civicrm_event'] = 1;
return;
return;
case 'participant_fee_id':
- $feeLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $value, 'label');
- $feeLabel = CRM_Core_DAO::escapeString(trim($feeLabel));
- if ($value) {
- $query->_where[$grouping][] = "civicrm_participant.fee_level LIKE '%$feeLabel%'";
- $query->_qill[$grouping][] = ts("Fee level") . " contains $feeLabel";
+ foreach ($value as $k => &$val) {
+ $val = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label');
+ $val = CRM_Core_DAO::escapeString(trim($val));
}
+ $feeLabel = implode('|', $value);
+ $query->_where[$grouping][] = "civicrm_participant.fee_level REGEXP '{$feeLabel}'";
+ $query->_qill[$grouping][] = ts("Fee level") . " IN " . implode(', ', $value);
$query->_tables['civicrm_participant'] = $query->_whereTables['civicrm_participant'] = 1;
return;
$form->addEntityRef('event_id', ts('Event Name'), array(
'entity' => 'event',
'placeholder' => ts('- any -'),
+ 'multiple' => 1,
'select' => array('minimumInputLength' => 0),
)
);
),
)
);
- $form->add('text', 'participant_fee_id', ts('Fee Level'), array('class' => 'big crm-ajax-select'));
+ $obj = new CRM_Report_Form_Event_ParticipantListing();
+ $form->add('select', 'participant_fee_id',
+ ts('Fee Level'),
+ $obj->getPriceLevels(),
+ FALSE, array('class' => 'crm-select2', 'multiple' => 'multiple', 'placeholder' => ts('- any -'))
+ );
CRM_Core_Form_Date::buildDateRange($form, 'event', 1, '_start_date_low', '_end_date_high', ts('From'), FALSE);
CRM_Core_Form_Date::buildDateRange($form, 'participant', 1, '_register_date_low', '_register_date_high', ts('From'), FALSE);
+ $form->addElement('hidden', 'event_date_range_error');
+ $form->addElement('hidden', 'participant_date_range_error');
+ $form->addFormRule(array('CRM_Event_BAO_Query', 'formRule'), $form);
+
$form->addElement('checkbox', "event_include_repeating_events", NULL, ts('Include participants from all events in the %1 series', array(1 => '<em>%1</em>')));
$form->addSelect('participant_status_id',
}
}
+ /**
+ * Check if the values in the date range are in correct chronological order.
+ *
+ * @todo Get this to work with CRM_Utils_Rule::validDateRange
+ *
+ * @param array $fields
+ * @param array $files
+ * @param CRM_Core_Form $form
+ *
+ * @return bool|array
+ */
+ public static function formRule($fields, $files, $form) {
+ $errors = array();
+
+ if ((empty($fields['event_start_date_low']) || empty($fields['event_end_date_high'])) && (empty($fields['participant_register_date_low']) || empty($fields['participant_register_date_high']))) {
+ return TRUE;
+ }
+ $lowDate = strtotime($fields['event_start_date_low']);
+ $highDate = strtotime($fields['event_end_date_high']);
+
+ if ($lowDate > $highDate) {
+ $errors['event_date_range_error'] = ts('Please check that your Event Date Range is in correct chronological order.');
+ }
+
+ $lowDate1 = strtotime($fields['participant_register_date_low']);
+ $highDate1 = strtotime($fields['participant_register_date_high']);
+
+ if ($lowDate1 > $highDate1) {
+ $errors['participant_date_range_error'] = ts('Please check that your Registration Date Range is in correct chronological order.');
+ }
+ return empty($errors) ? TRUE : $errors;
+ }
+
}
);
}
- $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
+ $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, array('event_id'));
$selector = new CRM_Event_Selector_Search($this->_queryParams,
$this->_action,
NULL,
// CRM-15379
if (!empty($this->_formValues['participant_fee_id'])) {
$participant_fee_id = $this->_formValues['participant_fee_id'];
- $feeLabel = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $participant_fee_id, 'label');
- $feeLabel = CRM_Core_DAO::escapeString(trim($feeLabel));
- $seatClause[] = "( participant.fee_level LIKE '%$feeLabel%' )";
+ foreach ($participant_fee_id as $k => &$val) {
+ $val = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $val, 'label');
+ $val = CRM_Core_DAO::escapeString(trim($val));
+ }
+ $feeLabel = implode('|', $participant_fee_id);
+ $seatClause[] = "( participant.fee_level REGEXP '{$feeLabel}' )";
}
$seatClause = implode(' AND ', $seatClause);
CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
- $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
+ $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, array('event_id'));
$this->set('formValues', $this->_formValues);
$this->set('queryParams', $this->_queryParams);
);
}
- $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
+ $this->_queryParams = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, array('event_id'));
$selector = new CRM_Event_Selector_Search($this->_queryParams,
$this->_action,
*/
public static function defaultReturnProperty($exportMode) {
// hack to add default return property based on export mode
+ $property = NULL;
if ($exportMode == CRM_Export_Form_Select::CONTRIBUTE_EXPORT) {
$property = 'contribution_id';
}
elseif ($exportMode == CRM_Export_Form_Select::ACTIVITY_EXPORT) {
$property = 'activity_id';
}
- elseif ($exportMode == CRM_Export_Form_Select::CONTACT_EXPORT) {
- $property = 'contact_id';
- }
return $property;
}
}
}
}
- $returnProperties[self::defaultReturnProperty($exportMode)] = 1;
+ if (!empty(self::defaultReturnProperty($exportMode))) {
+ $returnProperties[self::defaultReturnProperty($exportMode)] = 1;
+ }
}
else {
$primary = TRUE;
list($select, $from, $where, $having) = $query->query();
if ($mergeSameHousehold == 1) {
- if (!$returnProperties['id']) {
+ if (empty($returnProperties['id'])) {
$returnProperties['id'] = 1;
}
}
}
else {
- $sqlColumns[$fieldName] = "$fieldName varchar(255)";
+ $sqlColumns[$fieldName] = "$fieldName text";
}
}
}
return 'csv';
}
+ public function exportACCNT() {
+ }
+
+ public function exportCUST() {
+ }
+
+ public function exportTRANS() {
+ }
+
}
}
$params['is_reserved'] = CRM_Utils_Array::value('is_reserved', $params, FALSE);
+ $params['group_type'] = CRM_Utils_Array::value('group_type', $params, array());
$customFields = CRM_Core_BAO_CustomField::getFields('Group');
$params['custom'] = CRM_Core_BAO_CustomField::postProcess($params,
unset($groupTypes['Access Control']);
}
- $this->addCheckBox('group_type',
+ $this->addCheckBox('group_type_search',
ts('Type'),
$groupTypes,
NULL, NULL, NULL, NULL, ' '
'logging/contribute/summary',
);
- //CRM-13028 / NYSS-6933 - table => array (cols) - to be excluded from the update statement
+ /**
+ * Columns that should never be subject to logging.
+ *
+ * CRM-13028 / NYSS-6933 - table => array (cols) - to be excluded from the update statement
+ *
+ * @var array
+ */
private $exceptions = array(
'civicrm_job' => array('last_run'),
'civicrm_group' => array('cache_date', 'refresh_date'),
* @param bool $force
*/
public function triggerInfo(&$info, $tableName = NULL, $force = FALSE) {
- // check if we have logging enabled
- $config =& CRM_Core_Config::singleton();
- if (!$config->logging) {
+ if (!CRM_Core_Config::singleton()->logging) {
return;
}
* Disable logging temporarily.
*
* This allow logging to be temporarily disabled for certain cases
- * where we want to do a mass cleanup but dont want to bother with
- * an audit trail
+ * where we want to do a mass cleanup but do not want to bother with
+ * an audit trail.
*/
public static function disableLoggingForThisConnection() {
- // do this only if logging is enabled
- $config = CRM_Core_Config::singleton();
- if ($config->logging) {
+ if (CRM_Core_Config::singleton()->logging) {
CRM_Core_DAO::executeQuery('SET @civicrm_disable_logging = 1');
}
}
}
CRM_Core_Form_Date::buildDateRange($form, 'mailing_date', 1, '_low', '_high', ts('From'), FALSE);
+ $form->addElement('hidden', 'mailing_date_range_error');
+ $form->addFormRule(array('CRM_Mailing_BAO_Query', 'formRule'), $form);
$mailingJobStatuses = array(
'' => ts('- select -'),
$query->_tables[$tableName] = $query->_whereTables[$tableName] = 1;
}
+ /**
+ * Check if the values in the date range are in correct chronological order.
+ *
+ * @param array $fields
+ * @param array $files
+ * @param CRM_Core_Form $form
+ *
+ * @return bool|array
+ */
+ public static function formRule($fields, $files, $form) {
+ $errors = array();
+
+ if (empty($fields['mailing_date_high']) || empty($fields['mailing_date_low'])) {
+ return TRUE;
+ }
+
+ CRM_Utils_Rule::validDateRange($fields, 'mailing_date', $errors, ts('Mailing Date'));
+
+ return empty($errors) ? TRUE : $errors;
+ }
+
}
$form->addElement('text', 'member_source', ts('Source'));
CRM_Core_Form_Date::buildDateRange($form, 'member_join_date', 1, '_low', '_high', ts('From'), FALSE);
+ $form->addElement('hidden', 'member_join_date_range_error');
CRM_Core_Form_Date::buildDateRange($form, 'member_start_date', 1, '_low', '_high', ts('From'), FALSE);
+ $form->addElement('hidden', 'member_start_date_range_error');
CRM_Core_Form_Date::buildDateRange($form, 'member_end_date', 1, '_low', '_high', ts('From'), FALSE);
+ $form->addElement('hidden', 'member_end_date_range_error');
+
+ $form->addFormRule(array('CRM_Member_BAO_Query', 'formRule'), $form);
$form->addYesNo('member_is_primary', ts('Primary Member?'), TRUE);
$form->addYesNo('member_pay_later', ts('Pay Later?'), TRUE);
}
}
+ /**
+ * Custom form rules.
+ *
+ * @param array $fields
+ * @param array $files
+ * @param CRM_Core_Form $form
+ *
+ * @return bool|array
+ */
+ public static function formRule($fields, $files, $form) {
+ $errors = array();
+
+ if ((empty($fields['member_join_date_low']) || empty($fields['member_join_date_high'])) && (empty($fields['member_start_date_low']) || empty($fields['member_start_date_high'])) && (empty($fields['member_end_date_low']) || empty($fields['member_end_date_high']))) {
+ return TRUE;
+ }
+
+ CRM_Utils_Rule::validDateRange($fields, 'member_join_date', $errors, ts('Member Since'));
+ CRM_Utils_Rule::validDateRange($fields, 'member_start_date', $errors, ts('Start Date'));
+ CRM_Utils_Rule::validDateRange($fields, 'member_end_date', $errors, ts('End Date'));
+
+ return empty($errors) ? TRUE : $errors;
+ }
+
}
$lineItem->label = $prevLabel;
$lineItem->find();
while ($lineItem->fetch()) {
- $lineItem->label = $newLabel;
- $lineItem->save();
+ $lineItemParams['id'] = $lineItem->id;
+ $lineItemParams['label'] = $newLabel;
+ CRM_Price_BAO_LineItem::create($lineItemParams);
+
// update amount and fee level in civicrm_contribution and civicrm_participant
$params = array(
1 => array(CRM_Core_DAO::VALUE_SEPARATOR . $prevLabel . ' -', 'String'),
2 => array(CRM_Core_DAO::VALUE_SEPARATOR . $newLabel . ' -', 'String'),
);
+ // Update contribution
if (!empty($lineItem->contribution_id)) {
CRM_Core_DAO::executeQuery("UPDATE `civicrm_contribution` SET `amount_level` = REPLACE(amount_level, %1, %2) WHERE id = {$lineItem->contribution_id}", $params);
- $participantIds = CRM_Event_BAO_Participant::getParticipantIds($lineItem->contribution_id);
- foreach ($participantIds as $key => $id) {
- if (!empty($id)) {
- CRM_Core_DAO::executeQuery("UPDATE `civicrm_participant` SET `fee_level` = REPLACE(fee_level, %1, %2) WHERE id = {$id}", $params);
- }
- }
+ }
+ // Update participant
+ if ($lineItem->entity_table == 'civicrm_participant') {
+ CRM_Core_DAO::executeQuery("UPDATE `civicrm_participant` SET `fee_level` = REPLACE(fee_level, %1, %2) WHERE id = {$lineItem->entity_id}", $params);
}
}
}
$dao = CRM_Core_DAO::executeQuery($query, $params);
+ //CRM-18050: Check count of price set fields which has been set with auto-renew option.
+ //If price set field is already present with auto-renew option then, it will restrict for adding another price set field with auto-renew option.
+ if ($dao->N == 0) {
+ return 0;
+ }
+
$autoRenewOption = 2;
$priceFields = array();
while ($dao->fetch()) {
$components = CRM_Core_Component::getEnabledComponents();
foreach ($components as $componentName => $componentInfo) {
- if (CRM_Core_Permission::check("access $componentName")) {
+ $permission = sprintf("access %s", $componentName == 'CiviCase' ? "all cases and activities" : $componentName);
+ if (CRM_Core_Permission::check($permission)) {
$accessAllowed[] = $componentInfo->componentID;
}
}
) + $this->addressFields(TRUE);
if ($caseEnabled && CRM_Core_Permission::check('access all cases and activities')) {
- $this->activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE);
- $this->_columns['civicrm_activity']['filters']['activity_type_id']['options'] = $this->activityTypes;
$this->_columns['civicrm_activity']['filters']['include_case_activities'] = array(
'name' => 'include_case_activities',
'title' => ts('Include Case Activities'),
strstr($clause, 'civicrm_email_contact_target_email') ||
strstr($clause, 'civicrm_phone_contact_target_phone')
) {
- $this->_selectClauses[$key] = "GROUP_CONCAT($clause SEPARATOR '; ') as $clause";
+ $this->_selectClauses[$key] = "GROUP_CONCAT($clause SEPARATOR ';') as $clause";
}
}
}
$isGroupReserved = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_UFGroup', $this->_gid, 'is_reserved');
$this->assign('isGroupReserved', $isGroupReserved);
- $profileType = CRM_Core_BAO_UFField::getProfileType($this->_gid);
- if ($profileType == 'Contribution' || $profileType == 'Membership' || $profileType == 'Activity' || $profileType == 'Participant') {
+ $isMixedProfile = CRM_Core_BAO_UFField::checkProfileType($this->_gid);
+ if ($isMixedProfile) {
$this->assign('skipCreate', TRUE);
}
$groupTypes = self::extractGroupTypes($value['group_type']);
// drop Create, Edit and View mode links if profile group_type is one of the following:
- $groupComponents = array('Contribution', 'Membership', 'Activity', 'Participant', 'Case');
- $componentFound = array_intersect($groupComponents, array_keys($groupTypes));
- if (!empty($componentFound)) {
+ // Contribution, Membership, Activity, Participant, Case, Grant
+ $isMixedProfile = CRM_Core_BAO_UFField::checkProfileType($id);
+ if ($isMixedProfile) {
$action -= CRM_Core_Action::ADD;
+ $action -= CRM_Core_Action::ADVANCED;
+ $action -= CRM_Core_Action::BASIC;
+ $action -= CRM_Core_Action::PROFILE;
}
$ufGroup[$id]['group_type'] = self::formatGroupTypes($groupTypes);
--- /dev/null
+{php}
+ $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.7.4.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}
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title></title>
+</head>
+<body>
+
+{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}
+
+<center>
+ <table width="620" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;">
+
+ <!-- BEGIN HEADER -->
+ <!-- You can add table row(s) here with logo or other header elements -->
+ <!-- END HEADER -->
+
+ <!-- BEGIN CONTENT -->
+
+ <tr>
+ <td>
+ <p>{contact.email_greeting}</p>
+
+ {if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
+ <p>{$event.confirm_email_text|htmlize}</p>
+ {/if}
+
+ {if $isOnWaitlist}
+ <p>{ts}You have been added to the WAIT LIST for this event.{/ts}</p>
+ {if $isPrimary}
+ <p>{ts}If space becomes available you will receive an email with a link to a web page where you can complete your registration.{/ts}</p>
+ {/if}
+ {elseif $isRequireApproval}
+ <p>{ts}Your registration has been submitted.{/ts}</p>
+ {if $isPrimary}
+ <p>{ts}Once your registration has been reviewed, you will receive an email with a link to a web page where you can complete the registration process.{/ts}</p>
+ {/if}
+ {elseif $is_pay_later}
+ <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
+ {else}
+ <p>{ts}Please print this confirmation for your records.{/ts}</p>
+ {/if}
+
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse; width:100%;">
+ <tr>
+ <th {$headerStyle}>
+ {ts}Event Information and Location{/ts}
+ </th>
+ </tr>
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {$event.event_title}<br />
+ {$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}
+ </td>
+ </tr>
+
+ {if $event.participant_role neq 'Attendee' and $defaultRole}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Participant Role{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$event.participant_role}
+ </td>
+ </tr>
+ {/if}
+
+ {if $isShowLocation}
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {if $location.address.1.name}
+ {$location.address.1.name}<br />
+ {/if}
+ {if $location.address.1.street_address}
+ {$location.address.1.street_address}<br />
+ {/if}
+ {if $location.address.1.supplemental_address_1}
+ {$location.address.1.supplemental_address_1}<br />
+ {/if}
+ {if $location.address.1.supplemental_address_2}
+ {$location.address.1.supplemental_address_2}<br />
+ {/if}
+ {if $location.address.1.city}
+ {$location.address.1.city} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}<br />
+ {/if}
+ </td>
+ </tr>
+ {/if}
+
+ {if $location.phone.1.phone || $location.email.1.email}
+ <tr>
+ <td colspan="2" {$labelStyle}>
+ {ts}Event Contacts:{/ts}
+ </td>
+ </tr>
+ {foreach from=$location.phone item=phone}
+ {if $phone.phone}
+ <tr>
+ <td {$labelStyle}>
+ {if $phone.phone_type}
+ {$phone.phone_type_display}
+ {else}
+ {ts}Phone{/ts}
+ {/if}
+ </td>
+ <td {$valueStyle}>
+ {$phone.phone} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if}
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ {foreach from=$location.email item=eventEmail}
+ {if $eventEmail.email}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Email{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$eventEmail.email}
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ {/if}
+
+ {if $event.is_public}
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture}
+ <a href="{$icalFeed}">{ts}Download iCalendar File{/ts}</a>
+ </td>
+ </tr>
+ {/if}
+
+ {if $email}
+ <tr>
+ <th {$headerStyle}>
+ {ts}Registered Email{/ts}
+ </th>
+ </tr>
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {$email}
+ </td>
+ </tr>
+ {/if}
+
+
+ {if $event.is_monetary}
+
+ <tr>
+ <th {$headerStyle}>
+ {$event.fee_label}
+ </th>
+ </tr>
+
+ {if $lineItem}
+ {foreach from=$lineItem item=value key=priceset}
+ {if $value neq 'skip'}
+ {if $isPrimary}
+ {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
+ <tr>
+ <td colspan="2" {$labelStyle}>
+ {ts 1=$priceset+1}Participant %1{/ts}
+ </td>
+ </tr>
+ {/if}
+ {/if}
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
+ <tr>
+ <th>{ts}Item{/ts}</th>
+ <th>{ts}Qty{/ts}</th>
+ <th>{ts}Each{/ts}</th>
+ {if $dataArray}
+ <th>{ts}SubTotal{/ts}</th>
+ <th>{ts}Tax Rate{/ts}</th>
+ <th>{ts}Tax Amount{/ts}</th>
+ {/if}
+ <th>{ts}Total{/ts}</th>
+ {if $pricesetFieldsCount }<th>{ts}Total Participants{/ts}</th>{/if}
+ </tr>
+ {foreach from=$value item=line}
+ <tr>
+ <td>
+ {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if}
+ </td>
+ <td>
+ {$line.qty}
+ </td>
+ <td>
+ {$line.unit_price|crmMoney}
+ </td>
+ {if $dataArray}
+ <td>
+ {$line.unit_price*$line.qty|crmMoney}
+ </td>
+ {if $line.tax_rate != "" || $line.tax_amount != ""}
+ <td>
+ {$line.tax_rate|string_format:"%.2f"}%
+ </td>
+ <td>
+ {$line.tax_amount|crmMoney}
+ </td>
+ {else}
+ <td></td>
+ <td></td>
+ {/if}
+ {/if}
+ <td>
+ {$line.line_total+$line.tax_amount|crmMoney}
+ </td>
+ {if $pricesetFieldsCount }
+ <td>
+ {$line.participant_count}
+ </td>
+ {/if}
+ </tr>
+ {/foreach}
+ </table>
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ {if $dataArray}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Amount Before Tax:{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$totalAmount-$totalTaxAmount|crmMoney}
+ </td>
+ </tr>
+ {foreach from=$dataArray item=value key=priceset}
+ <tr>
+ {if $priceset || $priceset == 0}
+ <td> {$taxTerm} {$priceset|string_format:"%.2f"}%</td>
+ <td> {$value|crmMoney:$currency}</td>
+ {else}
+ <td> {ts}No{/ts} {$taxTerm}</td>
+ <td> {$value|crmMoney:$currency}</td>
+ {/if}
+ </tr>
+ {/foreach}
+ {/if}
+ {/if}
+
+ {if $amount && !$lineItem}
+ {foreach from=$amount item=amnt key=level}
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {$amnt.amount|crmMoney} {$amnt.label}
+ </td>
+ </tr>
+ {/foreach}
+ {/if}
+ {if $totalTaxAmount}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Total Tax Amount{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$totalTaxAmount|crmMoney:$currency}
+ </td>
+ </tr>
+ {/if}
+ {if $isPrimary}
+ <tr>
+ <td {$labelStyle}>
+ {if $balanceAmount}
+ {ts}Total Paid{/ts}
+ {else}
+ {ts}Total Amount{/ts}
+ {/if}
+ </td>
+ <td {$valueStyle}>
+ {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if}
+ </td>
+ </tr>
+ {if $balanceAmount}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Balance{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$balanceAmount|crmMoney}
+ </td>
+ </tr>
+ {/if}
+ {if $pricesetFieldsCount }
+ <tr>
+ <td {$labelStyle}>
+ {ts}Total Participants{/ts}</td>
+ <td {$valueStyle}>
+ {assign var="count" value= 0}
+ {foreach from=$lineItem item=pcount}
+ {assign var="lineItemCount" value=0}
+ {if $pcount neq 'skip'}
+ {foreach from=$pcount item=p_count}
+ {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
+ {/foreach}
+ {if $lineItemCount < 1 }
+ assign var="lineItemCount" value=1}
+ {/if}
+ {assign var="count" value=$count+$lineItemCount}
+ {/if}
+ {/foreach}
+ {$count}
+ </td>
+ </tr>
+ {/if}
+ {if $is_pay_later}
+ <tr>
+ <td colspan="2" {$labelStyle}>
+ {$pay_later_receipt}
+ </td>
+ </tr>
+ {/if}
+
+ {if $register_date}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Registration Date{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$register_date|crmDate}
+ </td>
+ </tr>
+ {/if}
+
+ {if $receive_date}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Transaction Date{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$receive_date|crmDate}
+ </td>
+ </tr>
+ {/if}
+
+ {if $financialTypeName}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Financial Type{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$financialTypeName}
+ </td>
+ </tr>
+ {/if}
+
+ {if $trxn_id}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Transaction #{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$trxn_id}
+ </td>
+ </tr>
+ {/if}
+
+ {if $paidBy}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Paid By{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$paidBy}
+ </td>
+ </tr>
+ {/if}
+
+ {if $checkNumber}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Check Number{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$checkNumber}
+ </td>
+ </tr>
+ {/if}
+
+ {if $contributeMode ne 'notify' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
+ <tr>
+ <th {$headerStyle}>
+ {ts}Billing Name and Address{/ts}
+ </th>
+ </tr>
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {$billingName}<br />
+ {$address|nl2br}
+ </td>
+ </tr>
+ {/if}
+
+ {if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
+ <tr>
+ <th {$headerStyle}>
+ {ts}Credit Card Information{/ts}
+ </th>
+ </tr>
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {$credit_card_type}<br />
+ {$credit_card_number}<br />
+ {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+ </td>
+ </tr>
+ {/if}
+
+ {/if}
+
+ {/if} {* End of conditional section for Paid events *}
+
+ {if $customPre}
+ <tr>
+ <th {$headerStyle}>
+ {$customPre_grouptitle}
+ </th>
+ </tr>
+ {foreach from=$customPre item=value key=customName}
+ {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ <tr>
+ <td {$labelStyle}>
+ {$customName}
+ </td>
+ <td {$valueStyle}>
+ {$value}
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ {/if}
+
+ {if $customPost}
+ <tr>
+ <th {$headerStyle}>
+ {$customPost_grouptitle}
+ </th>
+ </tr>
+ {foreach from=$customPost item=value key=customName}
+ {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ <tr>
+ <td {$labelStyle}>
+ {$customName}
+ </td>
+ <td {$valueStyle}>
+ {$value}
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ {/if}
+
+ {if $customProfile}
+ {foreach from=$customProfile item=value key=customName}
+ <tr>
+ <th {$headerStyle}>
+ {ts 1=$customName+1}Participant Information - Participant %1{/ts}
+ </th>
+ </tr>
+ {foreach from=$value item=val key=field}
+ {if $field eq 'additionalCustomPre' or $field eq 'additionalCustomPost'}
+ <tr>
+ <td colspan="2" {$labelStyle}>
+ {if $field eq 'additionalCustomPre'}
+ {$additionalCustomPre_grouptitle}
+ {else}
+ {$additionalCustomPost_grouptitle}
+ {/if}
+ </td>
+ </tr>
+ {foreach from=$val item=v key=f}
+ <tr>
+ <td {$labelStyle}>
+ {$f}
+ </td>
+ <td {$valueStyle}>
+ {$v}
+ </td>
+ </tr>
+ {/foreach}
+ {/if}
+ {/foreach}
+ {/foreach}
+ {/if}
+
+ {if $customGroup}
+ {foreach from=$customGroup item=value key=customName}
+ <tr>
+ <th {$headerStyle}>
+ {$customName}
+ </th>
+ </tr>
+ {foreach from=$value item=v key=n}
+ <tr>
+ <td {$labelStyle}>
+ {$n}
+ </td>
+ <td {$valueStyle}>
+ {$v}
+ </td>
+ </tr>
+ {/foreach}
+ {/foreach}
+ {/if}
+
+ </table>
+ </td>
+ </tr>
+
+ </table>
+</center>
+
+</body>
+</html>
--- /dev/null
+{contact.email_greeting}
+{if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
+{$event.confirm_email_text}
+{/if}
+
+{if $isOnWaitlist}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}You have been added to the WAIT LIST for this event.{/ts}
+
+{if $isPrimary}
+{ts}If space becomes available you will receive an email with a link to a web page where you can complete your registration.{/ts}
+
+{/if}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{elseif $isRequireApproval}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Your registration has been submitted.{/ts}
+
+{if $isPrimary}
+{ts}Once your registration has been reviewed, you will receive an email with a link to a web page where you can complete the registration process.{/ts}
+
+{/if}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{elseif $is_pay_later}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$pay_later_receipt}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{else}
+
+{ts}Please print this confirmation for your records.{/ts}
+{/if}
+
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Event Information and Location{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$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 neq 'Attendee' and $defaultRole}
+{ts}Participant Role{/ts}: {$event.participant_role}
+{/if}
+
+{if $isShowLocation}
+{if $location.address.1.name}
+
+{$location.address.1.name}
+{/if}
+{if $location.address.1.street_address}{$location.address.1.street_address}
+{/if}
+{if $location.address.1.supplemental_address_1}{$location.address.1.supplemental_address_1}
+{/if}
+{if $location.address.1.supplemental_address_2}{$location.address.1.supplemental_address_2}
+{/if}
+{if $location.address.1.city}{$location.address.1.city} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}
+{/if}
+
+{/if}{*End of isShowLocation condition*}
+
+{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} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if}
+{/foreach}
+{foreach from=$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 $email}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Registered Email{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$email}
+{/if}
+{if $event.is_monetary} {* This section for Paid events only.*}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$event.fee_label}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{if $lineItem}{foreach from=$lineItem item=value key=priceset}
+
+{if $value neq 'skip'}
+{if $isPrimary}
+{if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
+{ts 1=$priceset+1}Participant %1{/ts}
+{/if}
+{/if}
+---------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{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}
+{capture assign=ts_participant_total}{if $pricesetFieldsCount }{ts}Total Participants{/ts}{/if}{/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|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {/if} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"}
+----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{foreach from=$value item=line}
+{if $pricesetFieldsCount }{capture assign=ts_participant_count}{$line.participant_count}{/capture}{/if}
+{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|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|string_format:"%10s"} {$ts_participant_count|string_format:"%10s"}
+{/foreach}
+{/if}
+{/foreach}
+
+{if $dataArray}
+{ts}Amount before Tax{/ts}: {$totalAmount-$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 $amount && !$lineItem}
+{foreach from=$amount item=amnt key=level}{$amnt.amount|crmMoney} {$amnt.label}
+{/foreach}
+{/if}
+
+{if $totalTaxAmount}
+{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
+{/if}
+{if $isPrimary}
+
+{if $balanceAmount}{ts}Total Paid{/ts}{else}{ts}Total Amount{/ts}{/if}: {$totalAmount|crmMoney} {if $hookDiscount.message}({$hookDiscount.message}){/if}
+
+{if $balanceAmount}
+{ts}Balance{/ts}: {$balanceAmount|crmMoney}
+{/if}
+
+{if $pricesetFieldsCount }
+ {assign var="count" value= 0}
+ {foreach from=$lineItem item=pcount}
+ {assign var="lineItemCount" value=0}
+ {if $pcount neq 'skip'}
+ {foreach from=$pcount item=p_count}
+ {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
+ {/foreach}
+ {if $lineItemCount < 1 }
+ {assign var="lineItemCount" value=1}
+ {/if}
+ {assign var="count" value=$count+$lineItemCount}
+ {/if}
+ {/foreach}
+
+{ts}Total Participants{/ts}: {$count}
+{/if}
+
+{if $is_pay_later }
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$pay_later_receipt}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{/if}
+
+{if $register_date}
+{ts}Registration Date{/ts}: {$register_date|crmDate}
+{/if}
+{if $receive_date}
+{ts}Transaction Date{/ts}: {$receive_date|crmDate}
+{/if}
+{if $financialTypeName}
+{ts}Financial Type{/ts}: {$financialTypeName}
+{/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 ne 'notify' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Billing Name and Address{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$billingName}
+{$address}
+{/if}
+
+{if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
+===========================================================
+{ts}Credit Card Information{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$credit_card_type}
+{$credit_card_number}
+{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+{/if}
+{/if}
+{/if} {* End of conditional section for Paid events *}
+
+{if $customPre}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$customPre_grouptitle}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$customPre item=value key=customName}
+{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+{$customName}: {$value}
+{/if}
+{/foreach}
+{/if}
+
+{if $customPost}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$customPost_grouptitle}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$customPost item=value key=customName}
+{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+{$customName}: {$value}
+{/if}
+{/foreach}
+{/if}
+{if $customProfile}
+
+{foreach from=$customProfile item=value key=customName}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts 1=$customName+1}Participant Information - Participant %1{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$value item=val key=field}
+{if $field eq 'additionalCustomPre' or $field eq 'additionalCustomPost' }
+{if $field eq 'additionalCustomPre' }
+----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{$additionalCustomPre_grouptitle}
+----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{else}
+----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{$additionalCustomPost_grouptitle}
+----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{/if}
+{foreach from=$val item=v key=f}
+{$f}: {$v}
+{/foreach}
+{/if}
+{/foreach}
+{/foreach}
+{/if}
+{if $customGroup}
+{foreach from=$customGroup item=value key=customName}
+=========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$customName}
+=========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$value item=v key=n}
+{$n}: {$v}
+{/foreach}
+{/foreach}
+{/if}
+
+
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <title></title>
+</head>
+<body>
+
+{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=tdfirstStyle}style="width: 180px; padding-bottom: 15px;"{/capture}
+{capture assign=tdStyle}style="width: 100px;"{/capture}
+{capture assign=participantTotal}style="margin: 0.5em 0 0.5em;padding: 0.5em;background-color: #999999;font-weight: bold;color: #FAFAFA;border-radius: 2px;"{/capture}
+
+
+<center>
+ <table width="700" border="0" cellpadding="0" cellspacing="0" id="crm-event_receipt" style="font-family: Arial, Verdana, sans-serif; text-align: left;">
+
+ <!-- BEGIN HEADER -->
+ <!-- You can add table row(s) here with logo or other header elements -->
+ <!-- END HEADER -->
+
+ <!-- BEGIN CONTENT -->
+
+ <tr>
+ <td>
+ <p>{contact.email_greeting},</p>
+
+ {if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
+ <p>{$event.confirm_email_text|htmlize}</p>
+
+ {else}
+ <p>Thank you for your participation. This letter is a confirmation that your registration has been received and your status has been updated to <strong>{if $participant_status}{$participant_status}{else}{if $isOnWaitlist}waitlisted{else}registered{/if}{/if}</strong>.</p>
+
+ {/if}
+
+ <p>
+ {if $isOnWaitlist}
+ <p>{ts}You have been added to the WAIT LIST for this event.{/ts}</p>
+ {if $isPrimary}
+ <p>{ts}If space becomes available you will receive an email with a link to a web page where you can complete your registration.{/ts}</p>
+ {/if}
+ {elseif $isRequireApproval}
+ <p>{ts}Your registration has been submitted.{/ts}</p>
+ {if $isPrimary}
+ <p>{ts}Once your registration has been reviewed, you will receive an email with a link to a web page where you can complete the registration process.{/ts}</p>
+ {/if}
+ {elseif $is_pay_later && !$isAmountzero && !$isAdditionalParticipant}
+ <p>{$pay_later_receipt}</p> {* FIXME: this might be text rather than HTML *}
+ {else}
+ <p>{ts}Please print this confirmation for your records.{/ts}</p>
+ {/if}
+
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table width="700" style="border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">
+ <tr>
+ <th {$headerStyle}>
+ {ts}Event Information and Location{/ts}
+ </th>
+ </tr>
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {$event.event_title}<br />
+ {$event.event_start_date|date_format:"%A"} {$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|date_format:"%A"} {$event.event_end_date|crmDate}{/if}{/if}
+ </td>
+ </tr>
+
+
+ {if $conference_sessions}
+ <tr>
+ <td colspan="2" {$labelStyle}>
+ {ts}Your schedule:{/ts}
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {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}
+ <em>{$group_by_day|date_format:"%m/%d/%Y"}</em><br />
+ {/if}
+ {$session.start_date|crmDate:0:1}{if $session.end_date}-{$session.end_date|crmDate:0:1}{/if} {$session.title}<br />
+ {if $session.location} {$session.location}<br />{/if}
+ {/foreach}
+ </td>
+ </tr>
+ {/if}
+
+ {if $event.participant_role neq 'Attendee' and $defaultRole}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Participant Role{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$event.participant_role}
+ </td>
+ </tr>
+ {/if}
+
+ {if $isShowLocation}
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {if $location.address.1.name}
+ {$location.address.1.name}<br />
+ {/if}
+ {if $location.address.1.street_address}
+ {$location.address.1.street_address}<br />
+ {/if}
+ {if $location.address.1.supplemental_address_1}
+ {$location.address.1.supplemental_address_1}<br />
+ {/if}
+ {if $location.address.1.supplemental_address_2}
+ {$location.address.1.supplemental_address_2}<br />
+ {/if}
+ {if $location.address.1.city}
+ {$location.address.1.city}, {$location.address.1.state_province} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}<br />
+ {/if}
+ </td>
+ </tr>
+ {/if}
+
+ {if $location.phone.1.phone || $location.email.1.email}
+ <tr>
+ <td colspan="2" {$labelStyle}>
+ {ts}Event Contacts:{/ts}
+ </td>
+ </tr>
+ {foreach from=$location.phone item=phone}
+ {if $phone.phone}
+ <tr>
+ <td {$labelStyle}>
+ {if $phone.phone_type}
+ {$phone.phone_type_display}
+ {else}
+ {ts}Phone{/ts}
+ {/if}
+ </td>
+ <td {$valueStyle}>
+ {$phone.phone} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if}
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ {foreach from=$location.email item=eventEmail}
+ {if $eventEmail.email}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Email{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$eventEmail.email}
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ {/if}
+
+ {if $event.is_public}
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {capture assign=icalFeed}{crmURL p='civicrm/event/ical' q="reset=1&id=`$event.id`" h=0 a=1 fe=1}{/capture}
+ <a href="{$icalFeed}">{ts}Download iCalendar File{/ts}</a>
+ </td>
+ </tr>
+ {/if}
+
+ {if $event.is_share}
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {capture assign=eventUrl}{crmURL p='civicrm/event/info' q="id=`$event.id`&reset=1" a=true fe=1 h=1}{/capture}
+ {include file="CRM/common/SocialNetwork.tpl" emailMode=true url=$eventUrl title=$event.title pageURL=$eventUrl}
+ </td>
+ </tr>
+ {/if}
+ {if $payer.name}
+ <tr>
+ <th {$headerStyle}>
+ {ts}You were registered by:{/ts}
+ </th>
+ </tr>
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {$payer.name}
+ </td>
+ </tr>
+ {/if}
+ {if $event.is_monetary}
+
+ <tr>
+ <th {$headerStyle}>
+ {$event.fee_label}
+ </th>
+ </tr>
+
+ {if $lineItem}
+ {foreach from=$lineItem item=value key=priceset}
+ {if $value neq 'skip'}
+ {if $isPrimary}
+ {if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
+ <tr>
+ <td colspan="2" {$labelStyle}>
+ {ts 1=$priceset+1}Participant %1{/ts} {$part.$priceset.info}
+ </td>
+ </tr>
+ {/if}
+ {/if}
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ <table> {* FIXME: style this table so that it looks like the text version (justification, etc.) *}
+ <tr>
+ <th>{ts}Item{/ts}</th>
+ <th>{ts}Qty{/ts}</th>
+ <th>{ts}Each{/ts}</th>
+ {if $dataArray}
+ <th>{ts}SubTotal{/ts}</th>
+ <th>{ts}Tax Rate{/ts}</th>
+ <th>{ts}Tax Amount{/ts}</th>
+ {/if}
+ <th>{ts}Total{/ts}</th>
+ {if $pricesetFieldsCount }<th>{ts}Total Participants{/ts}</th>{/if}
+ </tr>
+ {foreach from=$value item=line}
+ <tr>
+ <td {$tdfirstStyle}>
+ {if $line.html_type eq 'Text'}{$line.label}{else}{$line.field_title} - {$line.label}{/if} {if $line.description}<div>{$line.description|truncate:30:"..."}</div>{/if}
+ </td>
+ <td {$tdStyle} align="middle">
+ {$line.qty}
+ </td>
+ <td {$tdStyle}>
+ {$line.unit_price|crmMoney:$currency}
+ </td>
+ {if $dataArray}
+ <td {$tdStyle}>
+ {$line.unit_price*$line.qty|crmMoney}
+ </td>
+ {if $line.tax_rate != "" || $line.tax_amount != ""}
+ <td {$tdStyle}>
+ {$line.tax_rate|string_format:"%.2f"}%
+ </td>
+ <td {$tdStyle}>
+ {$line.tax_amount|crmMoney}
+ </td>
+ {else}
+ <td></td>
+ <td></td>
+ {/if}
+ {/if}
+ <td {$tdStyle}>
+ {$line.line_total+$line.tax_amount|crmMoney:$currency}
+ </td>
+ {if $pricesetFieldsCount }<td {$tdStyle}>{$line.participant_count}</td> {/if}
+ </tr>
+ {/foreach}
+ {if $individual}
+ <tr {$participantTotal}>
+ <td colspan=3>{ts}Participant Total{/ts}</td>
+ <td colspan=2>{$individual.$priceset.totalAmtWithTax-$individual.$priceset.totalTaxAmt|crmMoney}</td>
+ <td colspan=1>{$individual.$priceset.totalTaxAmt|crmMoney}</td>
+ <td colspan=2>{$individual.$priceset.totalAmtWithTax|crmMoney}</td>
+ </tr>
+ {/if}
+ </table>
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ {if $dataArray}
+ <tr>
+ <td {$labelStyle}>
+ {ts} Amount Before Tax: {/ts}
+ </td>
+ <td {$valueStyle}>
+ {$totalAmount-$totalTaxAmount|crmMoney}
+ </td>
+ </tr>
+ {foreach from=$dataArray item=value key=priceset}
+ <tr>
+ {if $priceset || $priceset == 0}
+ <td> {$taxTerm} {$priceset|string_format:"%.2f"}%</td>
+ <td> {$value|crmMoney:$currency}</td>
+ {else}
+ <td> {ts}No{/ts} {$taxTerm}</td>
+ <td> {$value|crmMoney:$currency}</td>
+ {/if}
+ </tr>
+ {/foreach}
+ {/if}
+ {/if}
+
+ {if $amounts && !$lineItem}
+ {foreach from=$amounts item=amnt key=level}
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {$amnt.amount|crmMoney:$currency} {$amnt.label}
+ </td>
+ </tr>
+ {/foreach}
+ {/if}
+
+ {if $totalTaxAmount}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Total Tax Amount{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$totalTaxAmount|crmMoney:$currency}
+ </td>
+ </tr>
+ {/if}
+ {if $isPrimary}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Total Amount{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$totalAmount|crmMoney:$currency} {if $hookDiscount.message}({$hookDiscount.message}){/if}
+ </td>
+ </tr>
+ {if $pricesetFieldsCount }
+ <tr>
+ <td {$labelStyle}>
+ {ts}Total Participants{/ts}</td>
+ <td {$valueStyle}>
+ {assign var="count" value= 0}
+ {foreach from=$lineItem item=pcount}
+ {assign var="lineItemCount" value=0}
+ {if $pcount neq 'skip'}
+ {foreach from=$pcount item=p_count}
+ {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
+ {/foreach}
+ {if $lineItemCount < 1 }
+ {assign var="lineItemCount" value=1}
+ {/if}
+ {assign var="count" value=$count+$lineItemCount}
+ {/if}
+ {/foreach}
+ {$count}
+ </td> </tr>
+ {/if}
+
+ {if $register_date}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Registration Date{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$register_date|crmDate}
+ </td>
+ </tr>
+ {/if}
+
+ {if $receive_date}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Transaction Date{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$receive_date|crmDate}
+ </td>
+ </tr>
+ {/if}
+
+ {if $financialTypeName}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Financial Type{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$financialTypeName}
+ </td>
+ </tr>
+ {/if}
+
+ {if $trxn_id}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Transaction #{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$trxn_id}
+ </td>
+ </tr>
+ {/if}
+
+ {if $paidBy}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Paid By{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$paidBy}
+ </td>
+ </tr>
+ {/if}
+
+ {if $checkNumber}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Check Number{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$checkNumber}
+ </td>
+ </tr>
+ {/if}
+
+ {if $contributeMode ne 'notify' and !$isAmountzero and (!$is_pay_later or $isBillingAddressRequiredForPayLater) and !$isOnWaitlist and !$isRequireApproval}
+ <tr>
+ <th {$headerStyle}>
+ {ts}Billing Name and Address{/ts}
+ </th>
+ </tr>
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {$billingName}<br />
+ {$address|nl2br}
+ </td>
+ </tr>
+ {/if}
+
+ {if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
+ <tr>
+ <th {$headerStyle}>
+ {ts}Credit Card Information{/ts}
+ </th>
+ </tr>
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {$credit_card_type}<br />
+ {$credit_card_number}<br />
+ {ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+ </td>
+ </tr>
+ {/if}
+
+ {/if}
+
+ {/if} {* End of conditional section for Paid events *}
+
+
+{if $customPre}
+{foreach from=$customPre item=customPr key=i}
+ <tr> <th {$headerStyle}>{$customPre_grouptitle.$i}</th></tr>
+ {foreach from=$customPr item=customValue key=customName}
+ {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ <tr>
+ <td {$labelStyle}>{$customName}</td>
+ <td {$valueStyle}>{$customValue}</td>
+ </tr>
+ {/if}
+ {/foreach}
+{/foreach}
+{/if}
+
+{if $customPost}
+{foreach from=$customPost item=customPos key=j}
+ <tr> <th {$headerStyle}>{$customPost_grouptitle.$j}</th></tr>
+ {foreach from=$customPos item=customValue key=customName}
+ {if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ <tr>
+ <td {$labelStyle}>{$customName}</td>
+ <td {$valueStyle}>{$customValue}</td>
+ </tr>
+{/if}
+{/foreach}
+{/foreach}
+{/if}
+
+{if $customProfile}
+{foreach from=$customProfile.profile item=eachParticipant key=participantID}
+ <tr><th {$headerStyle}>{ts 1=$participantID+2}Participant %1{/ts} </th></tr>
+ {foreach from=$eachParticipant item=eachProfile key=pid}
+ <tr><th {$headerStyle}>{$customProfile.title.$pid}</th></tr>
+ {foreach from=$eachProfile item=val key=field}
+ <tr>{foreach from=$val item=v key=f}
+ <td {$labelStyle}>{$field}</td>
+ <td {$valueStyle}>{$v}</td>
+ {/foreach}
+ </tr>
+ {/foreach}
+{/foreach}
+{/foreach}
+{/if}
+
+ {if $customGroup}
+ {foreach from=$customGroup item=value key=customName}
+ <tr>
+ <th {$headerStyle}>
+ {$customName}
+ </th>
+ </tr>
+ {foreach from=$value item=v key=n}
+ <tr>
+ <td {$labelStyle}>
+ {$n}
+ </td>
+ <td {$valueStyle}>
+ {$v}
+ </td>
+ </tr>
+ {/foreach}
+ {/foreach}
+ {/if}
+ </table>
+ {if $event.allow_selfcancelxfer }
+ <tr>
+ <td colspan="2" {$valueStyle}>
+ {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}<br />
+ {capture assign=selfService}{crmURL p='civicrm/event/selfsvcupdate' q="reset=1&pid=`$participant.id`&{contact.checksum}" h=0 a=1 fe=1}{/capture}
+ <a href="{$selfService}">{ts}Click here to transfer or cancel your registration.{/ts}</a>
+ </td>
+ </tr>
+ {/if}
+ </td>
+ </tr>
+ </table>
+</center>
+
+</body>
+</html>
--- /dev/null
+{contact.email_greeting},
+
+{if $event.confirm_email_text AND (not $isOnWaitlist AND not $isRequireApproval)}
+{$event.confirm_email_text}
+
+{else}
+Thank you for your participation. This letter is a confirmation that your registration has been received and your status has been updated to {if $participant_status}{$participant_status}{else}{if $isOnWaitlist}waitlisted{else}registered{/if}{/if}.
+
+{/if}
+
+{if $isOnWaitlist}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}You have been added to the WAIT LIST for this event.{/ts}
+
+{if $isPrimary}
+{ts}If space becomes available you will receive an email with a link to a web page where you can complete your registration.{/ts}
+{/if}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{elseif $isRequireApproval}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Your registration has been submitted.{/ts}
+
+{if $isPrimary}
+{ts}Once your registration has been reviewed, you will receive an email with a link to a web page where you can complete the registration process.{/ts}
+
+{/if}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{elseif $is_pay_later && !$isAmountzero && !$isAdditionalParticipant}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$pay_later_receipt}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{else}
+
+{ts}Please print this confirmation for your records.{/ts}
+{/if}
+
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Event Information and Location{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$event.event_title}
+{$event.event_start_date|date_format:"%A"} {$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|date_format:"%A"} {$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}
+
+{if $event.participant_role neq 'Attendee' and $defaultRole}
+{ts}Participant Role{/ts}: {$event.participant_role}
+{/if}
+
+{if $isShowLocation}
+{if $location.address.1.name}
+
+{$location.address.1.name}
+{/if}
+{if $location.address.1.street_address}{$location.address.1.street_address}
+{/if}
+{if $location.address.1.supplemental_address_1}{$location.address.1.supplemental_address_1}
+{/if}
+{if $location.address.1.supplemental_address_2}{$location.address.1.supplemental_address_2}
+{/if}
+{if $location.address.1.city}{$location.address.1.city}, {$location.address.1.state_province} {$location.address.1.postal_code}{if $location.address.1.postal_code_suffix} - {$location.address.1.postal_code_suffix}{/if}
+{/if}
+
+{/if}{*End of isShowLocation condition*}
+
+{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} {if $phone.phone_ext} {ts}ext.{/ts} {$phone.phone_ext}{/if}
+{/foreach}
+{foreach from=$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 $payer.name}
+You were registered by: {$payer.name}
+{/if}
+{if $event.is_monetary} {* This section for Paid events only.*}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$event.fee_label}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{if $lineItem}{foreach from=$lineItem item=value key=priceset}
+
+{if $value neq 'skip'}
+{if $isPrimary}
+{if $lineItem|@count GT 1} {* Header for multi participant registration cases. *}
+{ts 1=$priceset+1}Participant %1{/ts} {$part.$priceset.info}
+
+{/if}
+{/if}
+-----------------------------------------------------------{if $pricesetFieldsCount }-----------------------------------------------------{/if}
+
+{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}
+{if $pricesetFieldsCount }{capture assign=ts_participant_total}{ts}Total Participants{/ts}{/capture}{/if}
+{$ts_item|string_format:"%-30s"} {$ts_qty|string_format:"%5s"} {$ts_each|string_format:"%10s"} {if $dataArray} {$ts_subtotal|string_format:"%10s"} {$ts_taxRate|string_format:"%10s"} {$ts_taxAmount|string_format:"%10s"} {/if} {$ts_total|string_format:"%10s"} {$ts_participant_total|string_format:"%10s"}
+-----------------------------------------------------------{if $pricesetFieldsCount }-----------------------------------------------------{/if}
+
+{foreach from=$value item=line}
+{if $pricesetFieldsCount }{capture assign=ts_participant_count}{$line.participant_count}{/capture}{/if}
+{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"}{$ts_participant_count|string_format:"%10s"}
+{/foreach}
+----------------------------------------------------------------------------------------------------------------
+{if $individual}{ts}Participant Total{/ts} {$individual.$priceset.totalAmtWithTax-$individual.$priceset.totalTaxAmt|crmMoney:$currency|string_format:"%29s"} {$individual.$priceset.totalTaxAmt|crmMoney:$currency|string_format:"%33s"} {$individual.$priceset.totalAmtWithTax|crmMoney:$currency|string_format:"%12s"}{/if}
+{/if}
+{""|string_format:"%120s"}
+{/foreach}
+{""|string_format:"%120s"}
+
+{if $dataArray}
+{ts}Amount before Tax{/ts}: {$totalAmount-$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 $amounts && !$lineItem}
+{foreach from=$amounts item=amnt key=level}{$amnt.amount|crmMoney:$currency} {$amnt.label}
+{/foreach}
+{/if}
+
+{if $totalTaxAmount}
+{ts}Total Tax Amount{/ts}: {$totalTaxAmount|crmMoney:$currency}
+{/if}
+{if $isPrimary }
+
+{ts}Total Amount{/ts}: {$totalAmount|crmMoney:$currency} {if $hookDiscount.message}({$hookDiscount.message}){/if}
+
+{if $pricesetFieldsCount }
+ {assign var="count" value= 0}
+ {foreach from=$lineItem item=pcount}
+ {assign var="lineItemCount" value=0}
+ {if $pcount neq 'skip'}
+ {foreach from=$pcount item=p_count}
+ {assign var="lineItemCount" value=$lineItemCount+$p_count.participant_count}
+ {/foreach}
+ {if $lineItemCount < 1 }
+ {assign var="lineItemCount" value=1}
+ {/if}
+ {assign var="count" value=$count+$lineItemCount}
+ {/if}
+ {/foreach}
+
+{ts}Total Participants{/ts}: {$count}
+{/if}
+
+{if $register_date}
+{ts}Registration Date{/ts}: {$register_date|crmDate}
+{/if}
+{if $receive_date}
+{ts}Transaction Date{/ts}: {$receive_date|crmDate}
+{/if}
+{if $financialTypeName}
+{ts}Financial Type{/ts}: {$financialTypeName}
+{/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 ne 'notify' and !$isAmountzero and (!$is_pay_later or $isBillingAddressRequiredForPayLater) and !$isOnWaitlist and !$isRequireApproval}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Billing Name and Address{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$billingName}
+{$address}
+{/if}
+
+{if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts}Credit Card Information{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$credit_card_type}
+{$credit_card_number}
+{ts}Expires{/ts}: {$credit_card_exp_date|truncate:7:''|crmDate}
+{/if}
+{/if}
+{/if} {* End of conditional section for Paid events *}
+
+{if $customPre}
+{foreach from=$customPre item=customPr key=i}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$customPre_grouptitle.$i}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$customPr item=customValue key=customName}
+{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ {$customName}: {$customValue}
+{/if}
+{/foreach}
+{/foreach}
+{/if}
+
+{if $customPost}
+{foreach from=$customPost item=customPos key=j}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$customPost_grouptitle.$j}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$customPos item=customValue key=customName}
+{if ( $trackingFields and ! in_array( $customName, $trackingFields ) ) or ! $trackingFields}
+ {$customName}: {$customValue}
+{/if}
+{/foreach}
+{/foreach}
+{/if}
+{if $customProfile}
+
+{foreach from=$customProfile.profile item=eachParticipant key=participantID}
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{ts 1=$participantID+2}Participant Information - Participant %1{/ts}
+
+==========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$eachParticipant item=eachProfile key=pid}
+----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{$customProfile.title.$pid}
+----------------------------------------------------------{if $pricesetFieldsCount }--------------------{/if}
+
+{foreach from=$eachProfile item=val key=field}
+{foreach from=$val item=v key=f}
+{$field}: {$v}
+{/foreach}
+{/foreach}
+{/foreach}
+{/foreach}
+{/if}
+{if $customGroup}
+{foreach from=$customGroup item=value key=customName}
+=========================================================={if $pricesetFieldsCount }===================={/if}
+
+{$customName}
+=========================================================={if $pricesetFieldsCount }===================={/if}
+
+{foreach from=$value item=v key=n}
+{$n}: {$v}
+{/foreach}
+{/foreach}
+{/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}
$this->addTask('Add Index to civicrm_contribution.source', 'addIndexContributionSource');
}
+ /**
+ * Upgrade function.
+ *
+ * @param string $rev
+ */
+ public function upgrade_4_7_3($rev) {
+ $this->addTask('Add Index to civicrm_contribution.total_amount', 'addIndexContributionAmount');
+ }
+
/**
* CRM-16354
*
return TRUE;
}
+ /**
+ * CRM-18124 Add index to civicrm_contribution.total_amount.
+ *
+ * Note that I made this a combined index with receive_date because the issue included
+ * both criteria and they seemed likely to be used in conjunction to me in other cases.
+ *
+ * @param \CRM_Queue_TaskContext $ctx
+ *
+ * @return bool
+ */
+ public function addIndexContributionAmount(CRM_Queue_TaskContext $ctx) {
+ CRM_Core_BAO_SchemaHandler::createIndexes(array(
+ 'civicrm_contribution' => array(array('total_amount', 'receive_date')),
+ ));
+ return TRUE;
+ }
+
}
--- /dev/null
+{* file to handle db changes in 4.7.4 during upgrade *}
+{include file='../CRM/Upgrade/4.7.4.msg_template/civicrm_msg_template.tpl'}
+
+-- CRM-18037 - update preferred mail format to set as default
+UPDATE `civicrm_contact` SET `preferred_mail_format` = 'Both' WHERE `preferred_mail_format` IS NULL;
* @copyright CiviCRM LLC (c) 2004-2015
*/
-require_once 'tcpdf/tcpdf.php';
-
/**
* Class CRM_Utils_PDF_Label
*/
*/
class CRM_Utils_Request {
+ /**
+ * Get a unique ID for the request.
+ *
+ * This unique ID is assigned to mysql when the connection is opened and is
+ * available in PHP.
+ *
+ * The intent is that it is available for logging purposes and for triggers.
+ *
+ * The resulting string is 17 characters long. This consists of 13 characters of uniqid
+ * and 4 more random characters.
+ *
+ * Uniqid is unique to the microsecond - to make it more unique we add 4 more characters
+ * but stop short of the full 23 character string that a prefix would generate.
+ *
+ * It is intended that this string will be saved to log tables so striking a balance between
+ * uniqueness and length is important. Note that I did check & lining up with byte values
+ * (e.g 16 characters) does not confer any benefits. Using a CHAR field rather than VARCHAR
+ * may improve speed, if indexed.
+ *
+ * @return string
+ */
+ public static function id() {
+ if (!isset(\Civi::$statics[__CLASS__]['id'])) {
+ \Civi::$statics[__CLASS__]['id'] = uniqid() . CRM_Utils_String::createRandom(CRM_Utils_String::ALPHANUMERIC, 4);
+ }
+ return \Civi::$statics[__CLASS__]['id'];
+ }
+
/**
* Retrieve a value from the request (GET/POST/REQUEST)
*
return ($key) ? CRM_Core_Key::valid($key) : FALSE;
}
+ /**
+ * Check if the values in the date range are in correct chronological order.
+ *
+ * @param array $fields
+ * Fields of the form.
+ * @param $fieldName
+ * Name of date range field.
+ * @param $errors
+ * The error array.
+ * @param $title
+ * Title of the date range to be displayed in the error message.
+ */
+ public static function validDateRange($fields, $fieldName, &$errors, $title) {
+ $lowDate = strtotime($fields[$fieldName . '_low']);
+ $highDate = strtotime($fields[$fieldName . '_high']);
+
+ if ($lowDate > $highDate) {
+ $errors[$fieldName . '_range_error'] = ts('%1: Please check that your date range is in correct chronological order.', array(1 => $title));
+ }
+ }
+
}
+++ /dev/null
-<?php
-/*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
- */
-
-/**
- *
- * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
- */
-class CRM_Utils_Sunlight {
- static $_apiURL = 'http://api.sunlightlabs.com/';
- static $_apiKey = NULL;
-
- /**
- * @param $uri
- *
- * @return SimpleXMLElement
- * @throws Exception
- */
- public static function makeAPICall($uri) {
- require_once 'HTTP/Request.php';
- $params = array(
- 'method' => HTTP_REQUEST_METHOD_GET,
- 'allowRedirects' => FALSE,
- );
-
- $request = new HTTP_Request(self::$_apiURL . $uri, $params);
- $result = $request->sendRequest();
- if (PEAR::isError($result)) {
- CRM_Core_Error::fatal($result->getMessage());
- }
- if ($request->getResponseCode() != 200) {
- CRM_Core_Error::fatal(ts('Invalid response code received from Sunlight servers: %1',
- array(1 => $request->getResponseCode())
- ));
- }
- $string = $request->getResponseBody();
- return simplexml_load_string($string);
- }
-
- /**
- * @param $zipcode
- *
- * @return array
- */
- public static function getCityState($zipcode) {
- $key = self::$_apiKey;
- $uri = "places.getCityStateFromZip.php?zip={$zipcode}&apikey={$key}&output=xml";
- $xml = self::makeAPICall($uri);
-
- return array($xml->city, $xml->state);
- }
-
- /**
- * @param int $peopleID
- *
- * @return array
- */
- public static function getDetailedInfo($peopleID) {
- $key = self::$_apiKey;
- $uri = "people.getPersonInfo.php?id={$peopleID}&apikey={$key}&output=xml";
- $xml = self::makeAPICall($uri);
-
- $result = array();
- $fields = array(
- 'title' => 'title',
- 'firstname' => 'first_name',
- 'lastname' => 'last_name',
- 'gender' => 'gender',
- 'party' => 'party',
- 'congress_office' => 'address',
- 'phone' => 'phone',
- 'email' => 'email',
- 'congresspedia' => 'url',
- 'photo' => 'image_url',
- 'webform' => 'contact_url',
- );
-
- foreach ($fields as $old => $new) {
- $result[$new] = (string ) $xml->$old;
- }
-
- $result['image_url'] = 'http://sunlightlabs.com/widgets/popuppoliticians/resources/images/' . $result['image_url'];
-
- return $result;
- }
-
- /**
- * @param $uri
- *
- * @return array
- */
- public static function getPeopleInfo($uri) {
- $xml = self::makeAPICall($uri);
-
- $result = array();
- foreach ($xml->entity_id_list->entity_id as $key => $value) {
- $result[] = self::getDetailedInfo($value);
- }
- return $result;
- }
-
- /**
- * @param $city
- * @param $state
- *
- * @return array|null
- */
- public static function getRepresentativeInfo($city, $state) {
- if (!$city ||
- !$state
- ) {
- return NULL;
- }
- $key = self::$_apiKey;
- $city = urlencode($city);
- $uri = "people.reps.getRepsFromCityState.php?city={$city}&state={$state}&apikey={$key}&output=xml";
- return self::getPeopleInfo($uri);
- }
-
- /**
- * @param $state
- *
- * @return array|null
- */
- public static function getSenatorInfo($state) {
- if (!$state) {
- return NULL;
- }
-
- $key = self::$_apiKey;
- $uri = "people.sens.getSensFromState.php?state={$state}&apikey={$key}&output=xml";
- return self::getPeopleInfo($uri);
- }
-
- /**
- * @param $city
- * @param $state
- * @param null $zipcode
- *
- * @return array
- */
- public static function getInfo($city, $state, $zipcode = NULL) {
- if ($zipcode) {
- list($city, $state) = self::getCityState($zipcode);
- }
-
- $reps = self::getRepresentativeInfo($city, $state);
- $sens = self::getSenatorInfo($state);
-
- $result = array();
- if (is_array($reps)) {
- $result = array_merge($result, $reps);
- }
- if (is_array($sens)) {
- $result = array_merge($result, $sens);
- }
-
- return $result;
- }
-
-}
// compares $url (which is some unknown/untrusted value from a third-party dev) to the CMS's base url (which is independent of civi's url)
// to see if the url is within our drupal dir, if it is we are able to treated it as an internal url
if (strpos($url, $base_url) === 0) {
- $internal = TRUE;
- $url = trim(str_replace($base_url, '', $url), '/');
+ $file = trim(str_replace($base_url, '', $url), '/');
+ // CRM-18130: Custom CSS URL not working if aliased or rewritten
+ if (file_exists(DRUPAL_ROOT . $file)) {
+ $url = $file;
+ $internal = TRUE;
+ }
}
// Handle relative urls that are within the CiviCRM module directory
elseif (strpos($url, $base) === 0) {
}
/**
- * FIXME: Do something
- *
- * @param \obj $user
+ * @param \string $username
+ * @param \string $password
*
* @return bool
*/
- public function loadUser($user) {
+ public function loadUser($username, $password = NULL) {
+ $uid = JUserHelper::getUserId($username);
+ if (empty($uid)) {
+ return FALSE;
+ }
+ $contactID = CRM_Core_BAO_UFMatch::getContactId($uid);
+ if (!empty($password)) {
+ $instance = JFactory::getApplication('site');
+ $params = array(
+ 'username' => $username,
+ 'password' => $password,
+ );
+ //perform the login action
+ $instance->login($params);
+ }
+
+ $session = CRM_Core_Session::singleton();
+ $session->set('ufID', $uid);
+ $session->set('userID', $contactID);
return TRUE;
}
}
/**
- * FIXME: Do something
- *
- * @param \obj $user
+ * @param \string $user
*
* @return bool
*/
public function loadUser($user) {
+ $userdata = get_user_by('login', $user);
+ if (!$userdata->data->ID) {
+ return FALSE;
+ }
+
+ $uid = $userdata->data->ID;
+ wp_set_current_user($uid);
+ $contactID = CRM_Core_BAO_UFMatch::getContactId($uid);
+
+ // lets store contact id and user id in session
+ $session = CRM_Core_Session::singleton();
+ $session->set('ufID', $uid);
+ $session->set('userID', $contactID);
return TRUE;
}
return $values;
}
+ if (array_key_exists('api_key', $params) && !empty($params['check_permissions'])) {
+ if (CRM_Core_Permission::check('edit api keys') || CRM_Core_Permission::check('administer CiviCRM')) {
+ // OK
+ }
+ elseif ($contactID && CRM_Core_Permission::check('edit own api keys') && CRM_Core_Session::singleton()->get('userID') == $contactID) {
+ // OK
+ }
+ else {
+ throw new \Civi\API\Exception\UnauthorizedException('Permission denied to modify api key');
+ }
+ }
+
if (!$contactID) {
// If we get here, we're ready to create a new contact
if (($email = CRM_Utils_Array::value('email', $params)) && !is_array($params['email'])) {
* @throws CiviCRM_API3_Exception
*/
function civicrm_api3_contact_merge($params) {
- $mode = CRM_Utils_Array::value('mode', $params, 'safe');
- $autoFlip = CRM_Utils_Array::value('auto_flip', $params, TRUE);
-
- $dupePairs = array(
- array(
- 'srcID' => CRM_Utils_Array::value('main_id', $params),
- 'dstID' => CRM_Utils_Array::value('other_id', $params),
- ),
- );
-
- if (($result = CRM_Dedupe_Merger::merge($dupePairs, array(), $mode, $autoFlip)) != FALSE) {
+ if (($result = CRM_Dedupe_Merger::merge(array(
+ array(
+ 'srcID' => $params['to_remove_id'],
+ 'dstID' => $params['to_keep_id'],
+ ),
+ ), array(), $params['mode'], $params['auto_flip'])) != FALSE) {
return civicrm_api3_create_success($result, $params);
}
throw new CiviCRM_API3_Exception('Merge failed');
}
/**
- * Adjust metadata for contact_proximity api function.
+ * Adjust metadata for contact_merge api function.
*
* @param array $params
*/
function _civicrm_api3_contact_merge_spec(&$params) {
- $params['main_id'] = array(
+ $params['to_remove_id'] = array(
'title' => 'ID of the contact to merge & remove',
'description' => ts('Wow - these 2 params are the logical reverse of what I expect - but what to do?'),
'api.required' => 1,
'type' => CRM_Utils_Type::T_INT,
+ 'api.aliases' => array('main_id'),
);
- $params['other_id'] = array(
+ $params['to_keep_id'] = array(
'title' => 'ID of the contact to keep',
'description' => ts('Wow - these 2 params are the logical reverse of what I expect - but what to do?'),
'api.required' => 1,
'type' => CRM_Utils_Type::T_INT,
+ 'api.aliases' => array('other_id'),
+ );
+ $params['auto_flip'] = array(
+ 'title' => 'Swap destination and source to retain lowest id?',
+ 'api.default' => TRUE,
+ );
+ $params['mode'] = array(
+ // @todo need more detail on what this means.
+ 'title' => 'Dedupe mode',
+ 'api.default' => 'safe',
);
}
function civicrm_api3_create_error($msg, $data = array()) {
$data['is_error'] = 1;
$data['error_message'] = $msg;
+
// we will show sql to privileged user only (not sure of a specific
// security hole here but seems sensible - perhaps should apply to the trace as well?)
- if (isset($data['sql']) && CRM_Core_Permission::check('Administer CiviCRM')) {
+ if (isset($data['sql']) && (CRM_Core_Permission::check('Administer CiviCRM') || CIVICRM_UF == 'UnitTests')) {
// Isn't this redundant?
$data['debug_information'] = $data['sql'];
}
$this->_log(ts("Failed to login as %1. Wrong username or password.", array('1' => $this->_user)));
return FALSE;
}
- if (!$cms->loadUser($this->_user)) {
+ if (($this->_config->userFramework == 'Joomla' && !$cms->loadUser($this->_user, $this->_password)) || !$cms->loadUser($this->_user)) {
$this->_log(ts("Failed to login as %1", array('1' => $this->_user)));
return FALSE;
}
"Civi\\": [".", "tests/phpunit/"]
}
},
+ "include-path": ["vendor/tecnickcom"],
"require": {
"dompdf/dompdf" : "0.6.*",
"symfony/config": "~2.5.0",
"symfony/process": "~2.5.0",
"psr/log": "1.0.0",
"symfony/finder": "~2.5.0",
+ "tecnickcom/tcpdf" : "6.2.*",
"totten/ca-config": "~13.02",
"civicrm/civicrm-cxn-rpc": "~0.15.12.04",
"zetacomponents/base": "1.7.*",
],
"scripts": {
"post-install-cmd": [
- "bash tools/scripts/composer/dompdf-cleanup.sh"
+ "bash tools/scripts/composer/dompdf-cleanup.sh",
+ "bash tools/scripts/composer/tcpdf-cleanup.sh"
],
"post-update-cmd": [
- "bash tools/scripts/composer/dompdf-cleanup.sh"
+ "bash tools/scripts/composer/dompdf-cleanup.sh",
+ "bash tools/scripts/composer/tcpdf-cleanup.sh"
]
}
}
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "77c841b4a3ad8ae6b4e740251e10526f",
+ "hash": "6d663f79b264d072ee699147bc572115",
+ "content-hash": "9d0da097291dbad481650b039869f719",
"packages": [
{
"name": "civicrm/civicrm-cxn-rpc",
"homepage": "http://symfony.com",
"time": "2015-02-08 07:07:45"
},
+ {
+ "name": "tecnickcom/tcpdf",
+ "version": "6.2.12",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/tecnickcom/TCPDF.git",
+ "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/2f732eaa91b5665274689b1d40b285a7bacdc37f",
+ "reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "fonts",
+ "config",
+ "include",
+ "tcpdf.php",
+ "tcpdf_parser.php",
+ "tcpdf_import.php",
+ "tcpdf_barcodes_1d.php",
+ "tcpdf_barcodes_2d.php",
+ "include/tcpdf_colors.php",
+ "include/tcpdf_filters.php",
+ "include/tcpdf_font_data.php",
+ "include/tcpdf_fonts.php",
+ "include/tcpdf_images.php",
+ "include/tcpdf_static.php",
+ "include/barcodes/datamatrix.php",
+ "include/barcodes/pdf417.php",
+ "include/barcodes/qrcode.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPLv3"
+ ],
+ "authors": [
+ {
+ "name": "Nicola Asuni",
+ "email": "info@tecnick.com",
+ "homepage": "http://nicolaasuni.tecnick.com"
+ }
+ ],
+ "description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
+ "homepage": "http://www.tcpdf.org/",
+ "keywords": [
+ "PDFD32000-2008",
+ "TCPDF",
+ "barcodes",
+ "datamatrix",
+ "pdf",
+ "pdf417",
+ "qrcode"
+ ],
+ "time": "2015-09-12 10:08:34"
+ },
{
"name": "totten/ca-config",
"version": "v13.02.0",
LOCK TABLES `civicrm_domain` WRITE;
/*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */;
-INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'4.7.3',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
+INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `config_backend`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,NULL,'4.7.4',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
/*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */;
UNLOCK TABLES;
</div>
</div><!-- /.crm-accordion-body -->
</div><!-- /.crm-accordion-wrapper -->
- <table class="contact-activity-selector-{$context} crm-ajax-table" data-order='[[5,"desc"]]'>
+ <table class="contact-activity-selector-{$context} crm-ajax-table" data-order='[[5,"asc"]]'>
<thead>
<tr>
<th data-data="activity_type" class="crm-contact-activity-activity_type">{ts}Type{/ts}</th>
</td>
</tr>
</table>
+ <div id="customData"></div>
+ {*include custom data js file*}
+ {include file="CRM/common/customData.tpl"}
+ {literal}
+ <script type="text/javascript">
+ CRM.$(function($) {
+ {/literal}
+ CRM.buildCustomData( 'Survey' );
+ {literal}
+ });
+ </script>
+ {/literal}
{/if}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
<table class="campaigns">
<thead>
<tr class="columnheader">
- <th class="hiddenElement">{ts}Campaign ID{/ts}</th>
+ <th>{ts}ID{/ts}</th>
<th class="hiddenElement">{ts}Campaign Name{/ts}</th>
<th>{ts}Title{/ts}</th>
<th>{ts}Description{/ts}</th>
"bLengthChange": false,
"aaSorting": [],
"aoColumns": [
- {sClass: 'crm-campaign-id hiddenElement' },
+ {sClass: 'crm-campaign-id' },
{sClass: 'crm-campaign-name hiddenElement' },
{sClass: 'crmf-title' },
{sClass: 'crmf-description' },
</td>
</tr>
</table>
+ <div id="customData"></div>
+ {*include custom data js file*}
+ {include file="CRM/common/customData.tpl"}
+ {literal}
+ <script type="text/javascript">
+ CRM.$(function($) {
+ {/literal}
+ CRM.buildCustomData( 'Survey' );
+ {literal}
+ });
+ </script>
+ {/literal}
<div class="crm-submit-buttons">{include file="CRM/common/formButtons.tpl" location="bottom"}</div>
</div>
+--------------------------------------------------------------------+
*}
<div class="crm-block crm-form-block crm-contact-merge-form-block">
-<div class="help">
-{ts}Click <strong>Merge</strong> to move data from the Duplicate Contact on the left into the Main Contact. In addition to the contact data (address, phone, email...), you may choose to move all or some of the related activity records (groups, contributions, memberships, etc.).{/ts} {help id="intro"}
-</div>
-
-<div class="message status">
- <div class="icon inform-icon"></div>
- <strong>{ts}WARNING: The duplicate contact record WILL BE DELETED after the merge is complete.{/ts}</strong>
-</div>
+ <div class="help">
+ {ts}Click <strong>Merge</strong> to move data from the Duplicate Contact on the left into the Main Contact. In addition to the contact data (address, phone, email...), you may choose to move all or some of the related activity records (groups, contributions, memberships, etc.).{/ts} {help id="intro"}
+ </div>
-{if $user}
<div class="message status">
<div class="icon inform-icon"></div>
- <strong>{ts 1=$config->userFramework}WARNING: There are %1 user accounts associated with both the original and duplicate contacts. Ensure that the %1 user you want to retain is on the right - if necessary use the 'Flip between original and duplicate contacts.' option at top to swap the positions of the two records before doing the merge.
-The user record associated with the duplicate contact will not be deleted, but will be unlinked from the associated contact record (which will be deleted).
-You will need to manually delete that user (click on the link to open the %1 user account in new screen). You may need to give thought to how you handle any content or contents associated with that user.{/ts}</strong>
+ <strong>{ts}WARNING: The duplicate contact record WILL BE DELETED after the merge is complete.{/ts}</strong>
</div>
-{/if}
-<div class="crm-submit-buttons">
- {include file="CRM/common/formButtons.tpl" location="top"}
-</div>
+ {if $user}
+ <div class="message status">
+ <div class="icon inform-icon"></div>
+ <strong>{ts 1=$config->userFramework}WARNING: There are %1 user accounts associated with both the original and duplicate contacts. Ensure that the %1 user you want to retain is on the right - if necessary use the 'Flip between original and duplicate contacts.' option at top to swap the positions of the two records before doing the merge.
+ The user record associated with the duplicate contact will not be deleted, but will be unlinked from the associated contact record (which will be deleted).
+ You will need to manually delete that user (click on the link to open the %1 user account in new screen). You may need to give thought to how you handle any content or contents associated with that user.{/ts}</strong>
+ </div>
+ {/if}
+
+ <div class="crm-submit-buttons">
+ {include file="CRM/common/formButtons.tpl" location="top"}
+ </div>
-<div class="action-link">
- {if $prev}<a href="{$prev}" class="crm-hover-button action-item"><i class="crm-i fa-chevron-left"></i> {ts}Previous{/ts}</a>{/if}
- {if $next}<a href="{$next}" class="crm-hover-button action-item">{ts}Next{/ts} <i class="crm-i fa-chevron-right"></i></a>{/if}
- <a href="{$flip}" class="action-item crm-hover-button">
- <i class="crm-i fa-random"></i>
- {ts}Flip between original and duplicate contacts.{/ts}
- </a>
-</div>
+ <div class="action-link">
+ {if $prev}<a href="{$prev}" class="crm-hover-button action-item"><i class="crm-i fa-chevron-left"></i> {ts}Previous{/ts}</a>{/if}
+ {if $next}<a href="{$next}" class="crm-hover-button action-item">{ts}Next{/ts} <i class="crm-i fa-chevron-right"></i></a>{/if}
+ <a href="{$flip}" class="action-item crm-hover-button">
+ <i class="crm-i fa-random"></i>
+ {ts}Flip between original and duplicate contacts.{/ts}
+ </a>
+ </div>
-<div class="action-link">
- <a href="#" class="action-item crm-hover-button crm-notDuplicate" title={ts}Mark this pair as not a duplicate.{/ts} onClick="processDupes( {$main_cid}, {$other_cid}, 'dupe-nondupe', 'merge-contact', '{if $rgid}{crmURL p="civicrm/contact/dedupefind" q="reset=1&action=update&rgid=$rgid"}{/if}' );return false;">
- <i class="crm-i fa-times-circle"></i>
- {ts}Mark this pair as not a duplicate.{/ts}
- </a>
-</div>
+ <div class="action-link">
+ <a href="#" class="action-item crm-hover-button crm-notDuplicate" title={ts}Mark this pair as not a duplicate.{/ts} onClick="processDupes( {$main_cid}, {$other_cid}, 'dupe-nondupe', 'merge-contact', '{if $rgid}{crmURL p="civicrm/contact/dedupefind" q="reset=1&action=update&rgid=$rgid"}{/if}' );return false;">
+ <i class="crm-i fa-times-circle"></i>
+ {ts}Mark this pair as not a duplicate.{/ts}
+ </a>
+ </div>
-<div class="action-link">
- <a href="javascript:void(0);" class="action-item crm-hover-button toggle_equal_rows">
- <i class="crm-i fa-eye-slash"></i>
- {ts}Show/hide rows with the same data on each contact record.{/ts}
- </a>
-</div>
+ <div class="action-link">
+ <a href="javascript:void(0);" class="action-item crm-hover-button toggle_equal_rows">
+ <i class="crm-i fa-eye-slash"></i>
+ {ts}Show/hide rows with the same data on each contact record.{/ts}
+ </a>
+ </div>
-<table class="row-highlight">
- <tr class="columnheader">
- <th> </th>
- <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$other_cid"}">{$other_name}</a> ({ts}duplicate{/ts})</th>
- <th>{ts}Mark All{/ts}<br />=={$form.toggleSelect.html} ==></th>
- <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$main_cid"}">{$main_name}</a></th>
- <th width="300">Add/overwrite?</th>
- </tr>
-
- {crmAPI var='other_result' entity='Contact' action='get' return="modified_date" id=$other_cid}
-
- {crmAPI var='main_result' entity='Contact' action='get' return="modified_date" id=$main_cid}
-
- <tr>
- <td>Last modified</td>
- <td>{$other_result.values.0.modified_date|crmDate} {if $other_result.values.0.modified_date gt $main_result.values.0.modified_date} (Most recent) {/if}</td>
- <td></td>
- <td>{$main_result.values.0.modified_date|crmDate} {if $main_result.values.0.modified_date gt $other_result.values.0.modified_date} (Most recent) {/if}</td>
- <td></td>
- </tr>
-
- {foreach from=$rows item=row key=field}
-
- {if !isset($row.main) && !isset($row.other)}
- <tr style="background-color: #fff !important; border-bottom:1px solid #ccc !important;" class="no-data">
- <td>
- <strong>{$row.title}</strong>
- </td>
- {else}
- {if $row.main eq $row.other}
- <tr class="merge-row-equal crm-row-ok {cycle values="odd-row,even-row"}">
- {else}
- <tr class="crm-row-error {cycle values="odd-row,even-row"}">
- {/if}
- <td>
- {$row.title}
- </td>
- {/if}
+ <table class="row-highlight">
+ <tr class="columnheader">
+ <th> </th>
+ <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$other_cid"}">{$other_name}</a> ({ts}duplicate{/ts})</th>
+ <th>{ts}Mark All{/ts}<br />=={$form.toggleSelect.html} ==></th>
+ <th><a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=$main_cid"}">{$main_name}</a></th>
+ <th width="300">Add/overwrite?</th>
+ </tr>
- {assign var=position value=$field|strrpos:'_'}
- {assign var=blockId value=$field|substr:$position+1}
- {assign var=blockName value=$field|substr:14:$position-14}
+ {crmAPI var='other_result' entity='Contact' action='get' return="modified_date" id=$other_cid}
- <td>
- {if $row.title|substr:0:7 == "Address"}<span style="white-space:pre">{else}<span>{/if}{if !is_array($row.other)}{$row.other}{elseif $row.other.fileName}{$row.other.fileName}{else}{', '|implode:$row.other}{/if}</span>
- </td>
+ {crmAPI var='main_result' entity='Contact' action='get' return="modified_date" id=$main_cid}
- <td style='white-space: nowrap'>
- {if $form.$field}=={$form.$field.html|crmAddClass:"select-row"}==>{/if}
- </td>
+ <tr>
+ <td>Last modified</td>
+ <td>{$other_result.values.0.modified_date|crmDate} {if $other_result.values.0.modified_date gt $main_result.values.0.modified_date} (Most recent) {/if}</td>
+ <td></td>
+ <td>{$main_result.values.0.modified_date|crmDate} {if $main_result.values.0.modified_date gt $other_result.values.0.modified_date} (Most recent) {/if}</td>
+ <td></td>
+ </tr>
- {* For location blocks *}
- {if $row.title|substr:0:5 == "Email" OR
- $row.title|substr:0:7 == "Address" OR
- $row.title|substr:0:2 == "IM" OR
- $row.title|substr:0:7 == "Website" OR
- $row.title|substr:0:5 == "Phone"}
+ {foreach from=$rows item=row key=field}
+ {if !isset($row.main) && !isset($row.other)}
+ <tr style="background-color: #fff !important; border-bottom:1px solid #ccc !important;" class="no-data">
<td>
- {if $row.title|substr:0:7 == "Address"}<span id="main_{$blockName}_{$blockId}" style="white-space:pre">{else}<span id="main_{$blockName}_{$blockId}">{/if}{if !is_array($row.main)}{$row.main}{elseif $row.main.fileName}{$row.main.fileName}{else}{', '|implode:$row.main}{/if}</span>
+ <strong>{$row.title}</strong>
</td>
-
+ {else}
+ {if $row.main eq $row.other}
+ <tr class="merge-row-equal crm-row-ok {cycle values="odd-row,even-row"}">
+ {else}
+ <tr class="crm-row-error {cycle values="odd-row,even-row"}">
+ {/if}
<td>
- {* Display location for fields with locations *}
- {if $blockName eq 'email' || $blockName eq 'phone' || $blockName eq 'address' || $blockName eq 'im' }
- {$form.location.$blockName.$blockId.locTypeId.html}
- {/if}
-
- {* Display other_type_id for websites, ims and phones *}
- {if $blockName eq 'website' || $blockName eq 'im' || $blockName eq 'phone' }
- {$form.location.$blockName.$blockId.typeTypeId.html}
- {/if}
-
- {* Display the overwrite/add/add new label *}
- <span id="main_{$blockName}_{$blockId}_overwrite">
- {if $row.main}
- <span class="action_label">({ts}overwrite{/ts})</span>
- {if $blockName eq 'email' || $blockName eq 'phone' }
- {$form.location.$blockName.$blockId.operation.html}
- {/if}
- <br />
- {else}
- <span class="action_label">({ts}add{/ts})</span>
- {/if}
- </span>
+ {$row.title}
</td>
+ {/if}
- {* For non-location blocks *}
- {else}
+ {assign var=position value=$field|strrpos:'_'}
+ {assign var=blockId value=$field|substr:$position+1}
+ {assign var=blockName value=$field|substr:14:$position-14}
<td>
- <span>
- {if !is_array($row.main)}
- {$row.main}
- {elseif $row.main.fileName}
- {$row.main.fileName}
- {else}
- {', '|implode:$row.main}
- {/if}
- </span>
+ {if $row.title|substr:0:7 == "Address"}<span style="white-space:pre">{else}<span>{/if}{if !is_array($row.other)}{$row.other}{elseif $row.other.fileName}{$row.other.fileName}{else}{', '|implode:$row.other}{/if}</span>
</td>
- <td>
- {if isset($row.main) || isset($row.other)}
+ <td style='white-space: nowrap'>
+ {if $form.$field}=={$form.$field.html|crmAddClass:"select-row"}==>{/if}
+ </td>
+
+ {* For location blocks *}
+ {if $row.title|substr:0:5 == "Email" OR
+ $row.title|substr:0:7 == "Address" OR
+ $row.title|substr:0:2 == "IM" OR
+ $row.title|substr:0:7 == "Website" OR
+ $row.title|substr:0:5 == "Phone"}
+
+ <td>
+ {if $row.title|substr:0:7 == "Address"}<span id="main_{$blockName}_{$blockId}" style="white-space:pre">{else}<span id="main_{$blockName}_{$blockId}">{/if}{if !is_array($row.main)}{$row.main}{elseif $row.main.fileName}{$row.main.fileName}{else}{', '|implode:$row.main}{/if}</span>
+ </td>
+
+ <td>
+ {* Display location for fields with locations *}
+ {if $blockName eq 'email' || $blockName eq 'phone' || $blockName eq 'address' || $blockName eq 'im' }
+ {$form.location.$blockName.$blockId.locTypeId.html}
+ {/if}
+
+ {* Display other_type_id for websites, ims and phones *}
+ {if $blockName eq 'website' || $blockName eq 'im' || $blockName eq 'phone' }
+ {$form.location.$blockName.$blockId.typeTypeId.html}
+ {/if}
+
+ {* Display the overwrite/add/add new label *}
+ <span id="main_{$blockName}_{$blockId}_overwrite">
+ {if $row.main}
+ <span class="action_label">({ts}overwrite{/ts})</span>
+ {if $blockName eq 'email' || $blockName eq 'phone' }
+ {$form.location.$blockName.$blockId.operation.html}
+ {/if}
+ <br />
+ {else}
+ <span class="action_label">({ts}add{/ts})</span>
+ {/if}
+ </span>
+ </td>
+
+ {* For non-location blocks *}
+ {else}
+
+ <td>
<span>
- {if $row.main == $row.other}
- <span class="action_label">({ts}match{/ts})</span><br />
- {elseif $row.main}
- <span class="action_label">({ts}overwrite{/ts})</span><br />
- {else}
- <span class="action_label">({ts}add{/ts})</span>
+ {if !is_array($row.main)}
+ {$row.main}
+ {elseif $row.main.fileName}
+ {$row.main.fileName}
+ {else}
+ {', '|implode:$row.main}
{/if}
</span>
- {/if}
- </td>
+ </td>
+
+ <td>
+ {if isset($row.main) || isset($row.other)}
+ <span>
+ {if $row.main == $row.other}
+ <span class="action_label">({ts}match{/ts})</span><br />
+ {elseif $row.main}
+ <span class="action_label">({ts}overwrite{/ts})</span><br />
+ {else}
+ <span class="action_label">({ts}add{/ts})</span>
+ {/if}
+ </span>
+ {/if}
+ </td>
- {/if}
+ {/if}
- </tr>
- {/foreach}
+ </tr>
+ {/foreach}
- {foreach from=$rel_tables item=params key=paramName}
- {if $paramName eq 'move_rel_table_users'}
+ {foreach from=$rel_tables item=params key=paramName}
+ {if $paramName eq 'move_rel_table_users'}
+ <tr class="{cycle values="even-row,odd-row"}">
+ <td><strong>{ts}Move related...{/ts}</strong></td><td>{if $otherUfId}<a target="_blank" href="{$params.other_url}">{$otherUfName}</a></td><td style='white-space: nowrap'>=={$form.$paramName.html|crmAddClass:"select-row"}==>{else}<td style='white-space: nowrap'></td>{/if}</td><td>{if $mainUfId}<a target="_blank" href="{$params.main_url}">{$mainUfName}</a>{/if}</td>
+ <td>({ts}migrate{/ts})</td>
+ </tr>
+ {else}
<tr class="{cycle values="even-row,odd-row"}">
- <td><strong>{ts}Move related...{/ts}</strong></td><td>{if $otherUfId}<a target="_blank" href="{$params.other_url}">{$otherUfName}</a></td><td style='white-space: nowrap'>=={$form.$paramName.html|crmAddClass:"select-row"}==>{else}<td style='white-space: nowrap'></td>{/if}</td><td>{if $mainUfId}<a target="_blank" href="{$params.main_url}">{$mainUfName}</a>{/if}</td>
- <td>({ts}migrate{/ts})</td>
- </tr>
- {else}
- <tr class="{cycle values="even-row,odd-row"}">
- <td><strong>{ts}Move related...{/ts}</strong></td><td><a href="{$params.other_url}">{$params.title}</a></td><td style='white-space: nowrap'>=={$form.$paramName.html|crmAddClass:"select-row"}==></td><td><a href="{$params.main_url}">{$params.title}</a>{if $form.operation.$paramName.add.html} {$form.operation.$paramName.add.html}{/if}</td>
- <td>({ts}migrate{/ts})</td>
- </tr>
- {/if}
- {/foreach}
-</table>
-<div class='form-item'>
- <!--<p>{$form.moveBelongings.html} {$form.moveBelongings.label}</p>-->
- <!--<p>{$form.deleteOther.html} {$form.deleteOther.label}</p>-->
-</div>
+ <td><strong>{ts}Move related...{/ts}</strong></td><td><a href="{$params.other_url}">{$params.title}</a></td><td style='white-space: nowrap'>=={$form.$paramName.html|crmAddClass:"select-row"}==></td><td><a href="{$params.main_url}">{$params.title}</a>{if $form.operation.$paramName.add.html} {$form.operation.$paramName.add.html}{/if}</td>
+ <td>({ts}migrate{/ts})</td>
+ </tr>
+ {/if}
+ {/foreach}
+ </table>
+ <div class='form-item'>
+ <!--<p>{$form.moveBelongings.html} {$form.moveBelongings.label}</p>-->
+ <!--<p>{$form.deleteOther.html} {$form.deleteOther.label}</p>-->
+ </div>
-<div class="crm-submit-buttons">
- {include file="CRM/common/formButtons.tpl" location="bottom"}
+ <div class="crm-submit-buttons">
+ {include file="CRM/common/formButtons.tpl" location="bottom"}
+ </div>
</div>
{literal}
function handleUserInputField() {
var row = $(this).closest('tr');
var field = $('select[id^=mapper][id$="_1"]', row).val();
- var op = $('select[id^=operator]', row).val();
+ var operator = $('select[id^=operator]', row);
+ var op = operator.val();
+
+ var patt = /_1$/; // pattern to check if the change event came from field name
+ if (field !== null && patt.test(this.id)) {
+ if ($.inArray(field, CRM.searchBuilder.stringFields) >= 0) {
+ // string operators
+ buildOperator(operator, CRM.searchBuilder.stringOperators);
+ } else {
+ // general operators
+ buildOperator(operator, CRM.searchBuilder.generalOperators);
+ }
+ }
// These Ops don't get any input field.
var noFieldOps = ['', 'IS EMPTY', 'IS NOT EMPTY', 'IS NULL', 'IS NOT NULL'];
}
}
+ /**
+ * Add appropriate operator to selected field
+ * @param operator: jQuery object
+ * @param options: array
+ */
+ function buildOperator(operator, options) {
+ var selected = operator.val();
+ operator.html('');
+ $.each(options, function(value, label) {
+ operator.append('<option value="' + value + '">' + label + '</option>');
+ });
+ operator.val(selected);
+ }
+
/**
* Add select list if appropriate for this operation
* @param row: jQuery object
}
}
$.each(CRM.searchBuilder.fieldOptions[field], function(key, option) {
- var selected = ($.inArray(''+option.key, options) > -1) ? 'selected="selected"' : '';
- select.append('<option value="' + option.key + '"' + selected + '>' + option.value + '</option>');
+ var optionKey = option.key;
+ if ($.inArray(field, CRM.searchBuilder.searchByLabelFields) >= 0) {
+ optionKey = option.value;
+ }
+ var selected = ($.inArray(''+optionKey, options) > -1) ? 'selected="selected"' : '';
+ select.append('<option value="' + optionKey + '"' + selected + '>' + option.value + '</option>');
});
select.change();
}
+++ /dev/null
-{*
- +--------------------------------------------------------------------+
- | CiviCRM version 4.7 |
- +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015 |
- +--------------------------------------------------------------------+
- | This file is a part of CiviCRM. |
- | |
- | CiviCRM is free software; you can copy, modify, and distribute it |
- | under the terms of the GNU Affero General Public License |
- | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
- | |
- | CiviCRM is distributed in the hope that it will be useful, but |
- | WITHOUT ANY WARRANTY; without even the implied warranty of |
- | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
- | See the GNU Affero General Public License for more details. |
- | |
- | You should have received a copy of the GNU Affero General Public |
- | License and the CiviCRM Licensing Exception along |
- | with this program; if not, contact CiviCRM LLC |
- | at info[AT]civicrm[DOT]org. If you have questions about the |
- | GNU Affero General Public License or the licensing of CiviCRM, |
- | see the CiviCRM license FAQ at http://civicrm.org/licensing |
- +--------------------------------------------------------------------+
-*}
-<div id="electedOfficals" class="view-content">
- <p></p>
- <div class="bold">{ts}Elected Officials:{/ts} {$displayName}</div>
- <div class="form-item">
- {if $rowCount > 0 }
- <table>
- <tr class="columnheader">
- <th>{ts}Image{/ts}</th>
- <th>{ts}Name{/ts}</th>
- <th>{ts}Party{/ts}</th>
- <th>{ts}Address{/ts}</th>
- <th>{ts}Phone{/ts}</th>
- <th>{ts}Email{/ts}</th>
- </tr>
- {foreach from=$rows item=row}
- <tr class="{cycle values="odd-row,even-row"}">
- <td><a href="{$row.url}"><img src="{$row.image_url}"></a></td>
- <td>{$row.title} {$row.first_name} {$row.last_name}</td>
- <td>{$row.party}</td>
- <td>{$row.address}</td>
- <td>{$row.phone}</td>
- <td>{$row.email}</td>
- </tr>
- {/foreach}
- </table>
- {else}
- <div class="messages status no-popup">
- <img src="{$config->resourceBase}i/Inform.gif" alt="{ts}status{/ts}">
- {ts}No data available for this contact. Please check city/state/zipcode{/ts}
- </div>
- {/if}
- </div>
- </p>
-</div>
<td>{$row.contact_type} <a href="{crmURL p='civicrm/contact/view' q="reset=1&cid=`$row.contact_id`"}">{$row.sort_name}</a></td>
{/if}
<td class="crm-contribution-amount">
- <a class="nowrap bold crm-expand-row" title="{ts}view payments{/ts}" href="{crmURL p='civicrm/payment' q="view=transaction&component=contribution&action=browse&cid=`$row.contact_id`&id=`$row.contribution_id`&selector=1"}">
- {if !$row.contribution_soft_credit_amount}{$row.total_amount|crmMoney:$row.currency}{/if}
- </a>
+ {if !$row.contribution_soft_credit_amount}
+ <a class="nowrap bold crm-expand-row" title="{ts}view payments{/ts}" href="{crmURL p='civicrm/payment' q="view=transaction&component=contribution&action=browse&cid=`$row.contact_id`&id=`$row.contribution_id`&selector=1"}">
+ {$row.total_amount|crmMoney:$row.currency}
+ </a>
+ {/if}
{if $row.amount_level }<br/>({$row.amount_level}){/if}
{if $row.contribution_recur_id}<br/>{ts}(Recurring Contribution){/ts}{/if}
</td>
{include file="CRM/common/pager.tpl" location="bottom"}
{crmScript file='js/crm.expandRow.js'}
-
{if $context neq 'membership'}
<table class="form-layout-compressed">
<tr>
+ {if $softCreditTotals.amount}
<th class="contriTotalLeft">{ts}Total Soft Credits{/ts} - {$softCreditTotals.amount|crmMoney:$softCreditTotals.currency}</th>
<th class="right" width="10px"> </th>
<th class="right contriTotalRight"> {ts}Avg Soft Credits{/ts} - {$softCreditTotals.avg|crmMoney:$softCreditTotals.currency}</th>
+ {/if}
+ {if $softCreditTotals.cancelAmount}
+ <th class="right contriTotalRight"> {ts}Total Cancelled Soft Credits{/ts} - {$softCreditTotals.cancelAmount|crmMoney:$softCreditTotals.currency}</th>
+ {/if}
</tr>
</table>
<p></p>
if (!$(this).data('select2')) {
$(this).crmEntityRef();
}
- isRepeating = $(this).select2('data').extra.is_recur;
+ // allow repeat checkbox to be shown for first event selected
+ if (!$.isEmptyObject($(this).select2('data')[0])) {
+ isRepeating = $(this).select2('data')[0].extra.is_recur;
+ }
}
if (isRepeating) {
$('.crm-event-form-block-event_include_repeating_events').show();
- $('label[for=event_include_repeating_events]').html(recurringLabel.replace('%1', $(this).select2('data').label));
+ $('label[for=event_include_repeating_events]').html(recurringLabel.replace('%1', $(this).select2('data')[0].label));
} else {
$('.crm-event-form-block-event_include_repeating_events').hide().find('input').prop('checked', false);
}
}
$('#event_id').each(toggleRecurrigCheckbox).change(toggleRecurrigCheckbox);
-
- // FIXME: This could be much simpler as an entityRef field but the priceFieldValue api doesn't currently support the filters we need
- $('#participant_fee_id').crmSelect2({
- placeholder: {/literal}'{ts escape="js"}- any -{/ts}'{literal},
- minimumInputLength: 1,
- allowClear: true,
- ajax: {
- url: "{/literal}{$dataURLEventFee}{literal}",
- data: function(term) {
- return {term: term};
- },
- results: function(response) {
- return {results: response};
- }
- },
- initSelection: function(el, callback) {
- CRM.api3('price_field_value', 'getsingle', {id: $(el).val()}).done(function(data) {
- callback({id: data.id, text: data.label});
- });
- }
- });
});
</script>
{/literal}
</span>
</td>
<td id="group_type-block">
- {$form.group_type.label}<br />
- {$form.group_type.html}<br />
+ {$form.group_type_search.label}<br />
+ {$form.group_type_search.html}<br />
<span class="description font-italic">
{ts}Filter search by group type(s).{/ts}
</span>
"url": {/literal}'{crmURL p="civicrm/ajax/grouplist" h=0 q="snippet=4"}'{literal},
"data": function (d) {
- var groupTypes = ($('.crm-group-search-form-block #group_type_1').prop('checked')) ? '1' : '';
+ var groupTypes = ($('.crm-group-search-form-block #group_type_search_1').prop('checked')) ? '1' : '';
if (groupTypes) {
- groupTypes = ($('.crm-group-search-form-block #group_type_2').prop('checked')) ? groupTypes + ',2' : groupTypes;
+ groupTypes = ($('.crm-group-search-form-block #group_type_search_2').prop('checked')) ? groupTypes + ',2' : groupTypes;
} else {
- groupTypes = ($('.crm-group-search-form-block #group_type_2').prop('checked')) ? '2' : '';
+ groupTypes = ($('.crm-group-search-form-block #group_type_search_2').prop('checked')) ? '2' : '';
}
var groupStatus = ($('.crm-group-search-form-block #group_status_1').prop('checked')) ? 1 : '';
appendHTML += '<td class="crm-group-name crmf-title crm-editable ' + levelClass + '">' + '{/literal}<span class="collapsed show-children" title="{ts}show child groups{/ts}"/></span>{literal}' + val.title + '</td>';
}
else {
- appendHTML += '<td class="crm-group-name crmf-title crm-editable ' + levelClass + '"><span class="crm-no-children"></span>' + val.title + '</td>';
+ appendHTML += '<td class="' + levelClass + '">' + '{/literal}<span class="collapsed show-children" title="{ts}show child groups{/ts}"/></span><span class="crm-group-name crmf-title crm-editable">{literal}' + val.title + '</span></td>';
}
appendHTML += '<td class="right">' + val.count + "</td>";
appendHTML += "<td>" + val.created_by + "</td>";
public function setUp() {
parent::setUp();
+ $this->_orgContactID = $this->organizationCreate();
}
public function teardown() {
$this->assertEquals(empty($result), TRUE, 'Verify financial types record deletion.');
}
+ /**
+ * Set ACLs for Financial Types()
+ */
+ public function setACL() {
+ CRM_Core_BAO_Setting::setItem(array('acl_financial_type' => 1), NULL, 'contribution_invoice_settings');
+ }
+
+ /**
+ * Check method testgetAvailableFinancialTypes()
+ */
+ public function testgetAvailableFinancialTypes() {
+ $this->setACL();
+ $config = &CRM_Core_Config::singleton();
+ $config->userPermissionClass->permissions = array(
+ 'view contributions of type Donation',
+ 'view contributions of type Member Dues',
+ );
+ CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types);
+ $expectedResult = array(
+ 1 => "Donation",
+ 2 => "Member Dues",
+ );
+ $this->assertEquals($expectedResult, $types, 'Verify that only certain financial types can be retrieved');
+ CRM_Financial_BAO_FinancialType::$_availableFinancialTypes = NULL;
+ $config->userPermissionClass->permissions = array(
+ 'view contributions of type Donation',
+ );
+ unset($expectedResult[2]);
+ CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($types);
+ $this->assertEquals($expectedResult, $types, 'Verify that removing permission for a financial type restricts the available financial types');
+ }
+
+ /**
+ * Check method testgetAvailableMembershipTypes()
+ */
+ public function testgetAvailableMembershipTypes() {
+ // Create Membership types
+ $ids = array();
+ $params = array(
+ 'name' => 'Type One',
+ 'domain_id' => 1,
+ 'minimum_fee' => 10,
+ 'duration_unit' => 'year',
+ 'member_of_contact_id' => $this->_orgContactID,
+ 'period_type' => 'fixed',
+ 'duration_interval' => 1,
+ 'financial_type_id' => 1,
+ 'visibility' => 'Public',
+ 'is_active' => 1,
+ );
+
+ $membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
+ // Add another
+ $params['name'] = 'Type Two';
+ $params['financial_type_id'] = 2;
+ $membershipType = CRM_Member_BAO_MembershipType::add($params, $ids);
+
+ $this->setACL();
+ $config = &CRM_Core_Config::singleton();
+ $config->userPermissionClass->permissions = array(
+ 'view contributions of type Donation',
+ 'view contributions of type Member Dues',
+ );
+ CRM_Financial_BAO_FinancialType::getAvailableMembershipTypes($types);
+ $expectedResult = array(
+ 1 => "Type One",
+ 2 => "Type Two",
+ );
+ $this->assertEquals($expectedResult, $types, 'Verify that only certain membership types can be retrieved');
+ $config->userPermissionClass->permissions = array(
+ 'view contributions of type Donation',
+ );
+ unset($expectedResult[2]);
+ CRM_Financial_BAO_FinancialType::getAvailableMembershipTypes($types);
+ $this->assertEquals($expectedResult, $types, 'Verify that removing permission for a financial type restricts the available membership types');
+ }
+
+ /**
+ * Check method testpermissionedFinancialTypes()
+ */
+ public function testpermissionedFinancialTypes() {
+ // First get all core permissions
+ $permissions = $checkPerms = CRM_Core_Permission::getCorePermissions();
+ $this->setACL();
+ CRM_Financial_BAO_FinancialType::permissionedFinancialTypes($permissions, TRUE);
+ $financialTypes = CRM_Contribute_PseudoConstant::financialType();
+ $prefix = ts('CiviCRM') . ': ';
+ $actions = array('add', 'view', 'edit', 'delete');
+ foreach ($financialTypes as $id => $type) {
+ foreach ($actions as $action) {
+ $checkPerms[$action . ' contributions of type ' . $type] = array(
+ $prefix . ts($action . ' contributions of type ') . $type,
+ ts(ucfirst($action) . ' contributions of type ') . $type,
+ );
+ }
+ }
+ $checkPerms['administer CiviCRM Financial Types'] = array(
+ $prefix . ts('administer CiviCRM Financial Types'),
+ ts('Administer access to Financial Types'),
+ );
+ $this->assertEquals($permissions, $checkPerms, 'Verify that permissions for each financial type have been added');
+ }
+
+ /**
+ * Check method testcheckPermissionedLineItems()
+ */
+ public function testcheckPermissionedLineItems() {
+ $contactId = Contact::createIndividual();
+ $paramsSet['title'] = 'Price Set' . substr(sha1(rand()), 0, 4);
+ $paramsSet['name'] = CRM_Utils_String::titleToVar($paramsSet['title']);
+ $paramsSet['is_active'] = TRUE;
+ $paramsSet['financial_type_id'] = 1;
+ $paramsSet['extends'] = 1;
+
+ $priceset = CRM_Price_BAO_PriceSet::create($paramsSet);
+ $priceSetId = $priceset->id;
+
+ //Checking for priceset added in the table.
+ $this->assertDBCompareValue('CRM_Price_BAO_PriceSet', $priceSetId, 'title',
+ 'id', $paramsSet['title'], 'Check DB for created priceset'
+ );
+ $paramsField = array(
+ 'label' => 'Price Field',
+ 'name' => CRM_Utils_String::titleToVar('Price Field'),
+ 'html_type' => 'CheckBox',
+ 'option_label' => array('1' => 'Price Field 1', '2' => 'Price Field 2'),
+ 'option_value' => array('1' => 100, '2' => 200),
+ 'option_name' => array('1' => 'Price Field 1', '2' => 'Price Field 2'),
+ 'option_weight' => array('1' => 1, '2' => 2),
+ 'option_amount' => array('1' => 100, '2' => 200),
+ 'is_display_amounts' => 1,
+ 'weight' => 1,
+ 'options_per_line' => 1,
+ 'is_active' => array('1' => 1, '2' => 1),
+ 'price_set_id' => $priceset->id,
+ 'is_enter_qty' => 1,
+ 'financial_type_id' => 1,
+ );
+ $priceField = CRM_Price_BAO_PriceField::create($paramsField);
+ $priceFields = $this->callAPISuccess('PriceFieldValue', 'get', array('price_field_id' => $priceField->id));
+ $contributionParams = array(
+ 'total_amount' => 300,
+ 'currency' => 'USD',
+ 'contact_id' => $contactId,
+ 'financial_type_id' => 1,
+ 'contribution_status_id' => 1,
+ );
+
+ foreach ($priceFields['values'] as $key => $priceField) {
+ $lineItems[1][$key] = array(
+ 'price_field_id' => $priceField['price_field_id'],
+ 'price_field_value_id' => $priceField['id'],
+ 'label' => $priceField['label'],
+ 'field_title' => $priceField['label'],
+ 'qty' => 1,
+ 'unit_price' => $priceField['amount'],
+ 'line_total' => $priceField['amount'],
+ 'financial_type_id' => $priceField['financial_type_id'],
+ );
+ }
+ $contributionParams['line_item'] = $lineItems;
+ $contributions = CRM_Contribute_BAO_Contribution::create($contributionParams);
+ CRM_Financial_BAO_FinancialType::$_statusACLFt = array();
+ $this->setACL();
+ $config = &CRM_Core_Config::singleton();
+ $config->userPermissionClass->permissions = array(
+ 'view contributions of type Member Dues',
+ );
+
+ try {
+ $error = CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($contributions->id, 'view');
+ $this->fail("Missed expected exception");
+ }
+ catch (Exception $e) {
+ $this->assertEquals("A fatal error was triggered: You do not have permission to access this page.", $e->getMessage());
+ }
+ $config = &CRM_Core_Config::singleton();
+ $config->userPermissionClass->permissions = array(
+ 'view contributions of type Donation',
+ );
+ $perm = CRM_Financial_BAO_FinancialType::checkPermissionedLineItems($contributions->id, 'view');
+ $this->assertEquals($perm, TRUE, 'Verify that lineitems now have permission.');
+ }
+
+ /**
+ * Check method testisACLFinancialTypeStatus()
+ */
+ public function testisACLFinancialTypeStatus() {
+ $isACL = CRM_Core_BAO_Setting::getItem(NULL, 'contribution_invoice_settings');
+ $this->assertEquals(array_search('acl_financial_type', $isACL), NULL);
+ $this->setACL();
+ $isACL = CRM_Core_BAO_Setting::getItem(NULL, 'contribution_invoice_settings');
+ $this->assertEquals($isACL, array('acl_financial_type' => 1));
+ }
+
+ /**
+ * Check method testisACLFinancialTypeStatus()
+ */
+ public function testbuildPermissionedClause() {
+ $this->setACL();
+ $config = &CRM_Core_Config::singleton();
+ $config->userPermissionClass->permissions = array(
+ 'view contributions of type Donation',
+ 'view contributions of type Member Dues',
+ );
+ CRM_Financial_BAO_FinancialType::buildPermissionedClause($whereClause, 'contribution');
+ $this->assertEquals($whereClause, ' civicrm_contribution.financial_type_id IN (1,2)');
+ $config->userPermissionClass->permissions[] = 'view contributions of type Event Fee';
+ $whereClause = NULL;
+ CRM_Financial_BAO_FinancialType::$_availableFinancialTypes = array();
+ CRM_Financial_BAO_FinancialType::buildPermissionedClause($whereClause, 'contribution');
+ $this->assertEquals($whereClause, ' civicrm_contribution.financial_type_id IN (1,4,2)');
+ }
+
}
* database population.
*/
public function createDomainContacts() {
- $default_domain_contact = $this->organizationCreate();
- $second_domain_contact = $this->organizationCreate();
+ $this->organizationCreate();
+ $this->organizationCreate(array('organization_name' => 'Second Domain'));
}
/**
$this->assertTrue($this->isElementPresent("xpath=//div[@id='crm-contact-thumbnail']/div/a/img"));
}
+ public function testOnBehalfSetDefaults() {
+ $this->webtestLogin();
+ $hash = substr(sha1(rand()), 0, 7);
+ $pageTitle = 'Donate Online ' . $hash;
+ $rand = 2 * rand(2, 50);
+
+ // go to the New Contribution Page page
+ $this->openCiviPage('admin/contribute', 'action=add&reset=1');
+
+ // fill in step 1 (Title and Settings)
+ $this->type('title', $pageTitle);
+
+ //to select financial type
+ $this->select('financial_type_id', "label=Donation");
+ $this->clickLink('_qf_Settings_next');
+
+ $this->click('link=Profiles');
+ $this->waitForElementPresent('_qf_Custom_next-bottom');
+ $this->select('css=tr.crm-contribution-contributionpage-custom-form-block-custom_pre_id span.crm-profile-selector-select select', "value=1");
+ $this->click('_qf_Custom_next-bottom');
+ $this->waitForElementPresent('_qf_Custom_next-bottom');
+
+ $this->click('link=Title');
+ $this->waitForElementPresent('_qf_Settings_next');
+ $this->click('is_organization');
+ $this->clickLink('_qf_Settings_next');
+ $this->waitForElementPresent('_qf_Settings_next');
+ $this->click('is_organization');
+ $this->clickLink('_qf_Settings_next');
+ $this->waitForElementPresent('_qf_Settings_next');
+ $this->click('is_organization');
+ $this->waitForElementPresent("xpath=//*[@id='select2-chosen-2']");
+ $sel = $this->getText("xpath=//*[@id='select2-chosen-2']");
+ $this->assertEquals($sel, 'On Behalf Of Organization');
+ }
+
}
'details' => 'a test activity',
'status_id' => 1,
'activity_type_id' => 29,
- 'priority_id' => 1,
);
$result = $this->callAPISuccess('activity', 'create', $params);
- $result = $this->callAPISuccess('activity', 'get', array('id' => $result['id']));
- $this->assertEquals($result['values'][$result['id']]['duration'], 120);
- $this->assertEquals($result['values'][$result['id']]['subject'], 'Make-it-Happen Meeting');
- $this->assertEquals($result['values'][$result['id']]['activity_date_time'], '2011-03-16 00:00:00');
- $this->assertEquals($result['values'][$result['id']]['location'], 'Pennsylvania');
- $this->assertEquals($result['values'][$result['id']]['details'], 'a test activity');
- $this->assertEquals($result['values'][$result['id']]['status_id'], 1);
+ $result = $this->callAPISuccess('activity', 'getsingle', array('id' => $result['id']));
+ $this->assertEquals($result['duration'], 120);
+ $this->assertEquals($result['subject'], 'Make-it-Happen Meeting');
+ $this->assertEquals($result['activity_date_time'], '2011-03-16 00:00:00');
+ $this->assertEquals($result['location'], 'Pennsylvania');
+ $this->assertEquals($result['details'], 'a test activity');
+ $this->assertEquals($result['status_id'], 1);
+
+ $priorities = $this->callAPISuccess('activity', 'getoptions', array('field' => 'priority_id'));
+ $this->assertEquals($result['priority_id'], array_search('Normal', $priorities['values']));
}
/**
* @throws \Exception
*/
public function tearDown() {
+ $this->callAPISuccess('Setting', 'create', array('includeOrderByClause' => TRUE));
// truncate a few tables
$tablesToTruncate = array(
- 'civicrm_contact',
'civicrm_email',
'civicrm_contribution',
'civicrm_line_item',
'civicrm_uf_match',
'civicrm_phone',
'civicrm_address',
+ 'civicrm_acl_contact_cache',
+ 'civicrm_activity_contact',
+ 'civicrm_activity',
);
$this->quickCleanup($tablesToTruncate, TRUE);
+ parent::tearDown();
}
/**
$contact = $this->callAPISuccess('contact', 'create', $params);
- $this->assertEquals(1, $contact['id']);
+ $this->assertEquals(3, $contact['id']);
$email = $this->callAPISuccess('email', 'get', array('contact_id' => $contact['id']));
$this->assertEquals(1, $email['count']);
$this->assertEquals('man3@yahoo.com', $email['values'][$email['id']]['email']);
'last_name' => 'xyz1',
);
- $contact = $this->callAPISuccess('contact', 'create', $params);
- $this->assertEquals(1, $contact['id']);
+ $this->callAPISuccess('contact', 'create', $params);
}
/**
'household_name' => 'The abc Household',
'contact_type' => 'Household',
);
- $contact = $this->callAPISuccess('contact', 'create', $params);
- $this->assertEquals(1, $contact['id']);
+ $this->callAPISuccess('contact', 'create', $params);
}
/**
'organization_name' => 'The abc Organization',
'contact_type' => 'Organization',
);
- $contact = $this->callAPISuccess('contact', 'create', $params);
- $this->assertEquals(1, $contact['id']);
+ $this->callAPISuccess('contact', 'create', $params);
}
/**
'return.first_name' => 1,
'sequential' => 1,
'rowCount' => 1,
+ 'contact_type' => 'Individual',
));
$this->assertEquals('abc1', $result['values'][0]['first_name']);
$params['is_deleted'] = 1;
$params['last_name'] = 'bcd';
$contact2 = $this->callAPISuccess('contact', 'create', $params);
- $countActive = $this->callAPISuccess('contact', 'getcount', array('showAll' => 'active'));
- $countAll = $this->callAPISuccess('contact', 'getcount', array('showAll' => 'all'));
- $countTrash = $this->callAPISuccess('contact', 'getcount', array('showAll' => 'trash'));
- $countDefault = $this->callAPISuccess('contact', 'getcount', array());
+ $countActive = $this->callAPISuccess('contact', 'getcount', array(
+ 'showAll' => 'active',
+ 'contact_type' => 'Individual',
+ ));
+ $countAll = $this->callAPISuccess('contact', 'getcount', array('showAll' => 'all', 'contact_type' => 'Individual'));
+ $countTrash = $this->callAPISuccess('contact', 'getcount', array('showAll' => 'trash', 'contact_type' => 'Individual'));
+ $countDefault = $this->callAPISuccess('contact', 'getcount', array('contact_type' => 'Individual'));
$countDeleted = $this->callAPISuccess('contact', 'getcount', array(
+ 'contact_type' => 'Individual',
'contact_is_deleted' => 1,
));
$countNotDeleted = $this->callAPISuccess('contact', 'getcount', array(
'contact_is_deleted' => 0,
+ 'contact_type' => 'Individual',
));
$this->callAPISuccess('contact', 'delete', array('id' => $contact1['id']));
$this->callAPISuccess('contact', 'delete', array('id' => $contact2['id']));
- $this->assertEquals(1, $countNotDeleted, 'contact_is_deleted => 0 is respected in line ' . __LINE__);
+ $this->assertEquals(1, $countNotDeleted, 'contact_is_deleted => 0 is respected');
$this->assertEquals(1, $countActive);
$this->assertEquals(1, $countTrash);
$this->assertEquals(2, $countAll);
$this->assertEquals(1, $countDeleted);
- $this->assertEquals(1, $countDefault, 'Only active by default in line ' . __LINE__);
+ $this->assertEquals(1, $countDefault, 'Only active by default in line');
}
/**
));
$result = $this->callAPISuccess($this->_entity, 'getvalue', array(
'return' => 'first_name',
+ 'contact_type' => 'Individual',
'options' => array(
'limit' => 1,
'sort' => 'first_name',
),
));
- $this->assertEquals('abc1', $result, 'in line' . __LINE__);
+ $this->assertEquals('abc1', $result);
$result = $this->callAPISuccess($this->_entity, 'getvalue', array(
'return' => 'first_name',
+ 'contact_type' => 'Individual',
'options' => array(
'limit' => 1,
'sort' => 'first_name DESC',
$result = $this->callAPIAndDocument('Contact', 'create', $params, __FUNCTION__, __FILE__, $description, $subFile);
- $this->assertEquals(1, $result['id']);
// checking child function result not covered in callAPIAndDocument
$this->assertAPISuccess($result['values'][$result['id']]['api.website.create']);
$this->assertEquals("http://chained.org", $result['values'][$result['id']]['api.website.create.2']['values'][0]['url']);
$subfile = "ChainTwoWebsitesSyntax2";
$result = $this->callAPIAndDocument('Contact', 'create', $params, __FUNCTION__, __FILE__, $description, $subfile);
- $this->assertEquals(1, $result['id']);
// the callAndDocument doesn't check the chained call
$this->assertEquals(0, $result['values'][$result['id']]['api.website.create'][0]['is_error']);
$this->assertEquals("http://chained.org", $result['values'][$result['id']]['api.website.create'][1]['values'][0]['url']);
);
$contact = $this->callAPISuccess('contact', 'create', $params);
- $this->assertEquals(1, $contact['id']);
$this->callAPISuccess('contact', 'delete', $contact);
}
);
$result = $this->callAPISuccess('contact', 'create', $params);
- $this->assertEquals(1, $result['id']);
-
$this->callAPISuccess('contact', 'delete', array('id' => $result['id']));
}
$contact = $this->callAPISuccess('contact', 'create', $params);
- $this->assertEquals(1, $contact['id']);
-
$this->callAPISuccess('contact', 'delete', $contact);
}
$contact = $this->callAPISuccess('contact', 'create', $params);
- $this->assertEquals(1, $contact['id']);
-
$params = array(
'email' => 'man2@yahoo.com',
);
$result = $this->callAPIAndDocument('contact', 'get', $params, __FUNCTION__, __FILE__);
- $this->assertEquals(1, $result['values'][1]['contact_id']);
- $this->assertEquals('man2@yahoo.com', $result['values'][1]['email']);
+ $this->assertEquals('man2@yahoo.com', $result['values'][$result['id']]['email']);
- // delete the contact
$this->callAPISuccess('contact', 'delete', $contact);
}
$this->callAPISuccess('contact', 'delete', $result);
$this->customGroupDelete($ids['custom_group_id']);
$this->customGroupDelete($moreIDs['custom_group_id']);
- $this->assertEquals(1, $result['id']);
$this->assertEquals(0, $result['values'][$result['id']]['api.website.get']['is_error']);
$this->assertEquals("http://civicrm.org", $result['values'][$result['id']]['api.website.get']['values'][0]['url']);
}
'api.Membership.getCount' => array(),
);
$result = $this->callAPIAndDocument('Contact', 'Get', $params, __FUNCTION__, __FILE__, $description, $subfile);
- $this->assertEquals(1, $result['id']);
$this->assertEquals(2, $result['values'][$result['id']]['api.Contribution.getCount']);
$this->assertEquals(0, $result['values'][$result['id']]['api.Note.get']['is_error']);
$this->assertEquals("http://civicrm.org", $result['values'][$result['id']]['api.website.getValue']);
$this->customGroupDelete($ids['custom_group_id']);
$this->customGroupDelete($moreIDs['custom_group_id']);
$this->customGroupDelete($andMoreIDs['custom_group_id']);
- $this->assertEquals(1, $result['id']);
$this->assertEquals(0, $result['values'][$result['id']]['api.CustomValue.get']['is_error']);
$this->assertEquals('http://civicrm.org', $result['values'][$result['id']]['api.website.getValue']);
}
*/
public function testGetQuickEmail() {
$this->getQuickSearchSampleData();
- $userID = $this->createLoggedInUser();
+ $loggedInContactID = $this->createLoggedInUser();
$result = $this->callAPISuccess('contact', 'getquick', array(
'name' => 'c',
));
'C Bobby, Bobby',
'E Bobby, Bobby :: bob@bobby.com',
'H Bobby, Bobby :: bob@h.com',
+ 'Second Domain',
+ $this->callAPISuccessGetValue('Contact', array('id' => $loggedInContactID, 'return' => 'last_name')) . ', Logged In :: anthony_anderson@civicrm.org',
);
- $this->assertEquals(5, $result['count']);
+ $this->assertEquals(6, $result['count']);
foreach ($expectedData as $index => $value) {
$this->assertEquals($value, $result['values'][$index]['data']);
}
*/
public function testGetQuickEmailACL() {
$this->getQuickSearchSampleData();
- $userID = $this->createLoggedInUser();
+ $loggedInContactID = $this->createLoggedInUser();
CRM_Core_Config::singleton()->userPermissionClass->permissions = array();
$result = $this->callAPISuccess('contact', 'getquick', array(
'name' => 'c',
$this->assertEquals(0, $result['count']);
$this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereNoBobH'));
- CRM_Contact_BAO_Contact_Permission::cache($userID, CRM_Core_Permission::VIEW, TRUE);
+ CRM_Contact_BAO_Contact_Permission::cache($loggedInContactID, CRM_Core_Permission::VIEW, TRUE);
$result = $this->callAPISuccess('contact', 'getquick', array(
'name' => 'c',
));
- // Without the acl it would be 5 like the previous email getquick test.
- $this->assertEquals(4, $result['count']);
+
+ // Without the acl it would be 6 like the previous email getquick test.
+ $this->assertEquals(5, $result['count']);
$expectedData = array(
'Bob, Bob :: bob@bob.com',
'C Bobby, Bobby',
'E Bobby, Bobby :: bob@bobby.com',
+ 'Second Domain',
+ $this->callAPISuccessGetValue('Contact', array('id' => $loggedInContactID, 'return' => 'last_name')) . ', Logged In :: anthony_anderson@civicrm.org',
);
foreach ($expectedData as $index => $value) {
$this->assertEquals($value, $result['values'][$index]['data']);
* Test that getquick returns contacts with an exact first name match first.
*/
public function testGetQuickID() {
+ $max = CRM_Core_DAO::singleValueQuery("SELECT max(id) FROM civicrm_contact");
$this->getQuickSearchSampleData();
$result = $this->callAPISuccess('contact', 'getquick', array(
- 'name' => 2,
+ 'name' => $max + 2,
'field_name' => 'id',
'table_name' => 'cc',
));
$this->assertEquals(1, $result['count']);
$this->assertEquals('A Bobby, Bobby', $result['values'][0]['sort_name']);
$result = $this->callAPISuccess('contact', 'getquick', array(
- 'name' => 2,
+ 'name' => $max + 2,
'field_name' => 'contact_id',
'table_name' => 'cc',
));
/**
* Test merging 2 contacts.
+ *
+ * Someone kindly bequethed us the legacy of mixed up use of main_id & other_id
+ * in the params for contact.merge api.
+ *
+ * This test protects that legacy.
*/
- public function testMerge() {
+ public function testMergeBizzareOldParams() {
+ $this->createLoggedInUser();
$otherContact = $this->callAPISuccess('contact', 'create', $this->_params);
$mainContact = $this->callAPISuccess('contact', 'create', $this->_params);
- $this->callAPISuccess('contact', 'merge', array('main_id' => $mainContact['id'], 'other_id' => $otherContact['id']));
+ $this->callAPISuccess('contact', 'merge', array(
+ 'main_id' => $mainContact['id'],
+ 'other_id' => $otherContact['id'],
+ ));
$contacts = $this->callAPISuccess('contact', 'get', $this->_params);
$this->assertEquals($otherContact['id'], $contacts['id']);
+ }
+
+ /**
+ * Test merging 2 contacts.
+ */
+ public function testMerge() {
+ $this->createLoggedInUser();
+ $otherContact = $this->callAPISuccess('contact', 'create', $this->_params);
+ $retainedContact = $this->callAPISuccess('contact', 'create', $this->_params);
+ $this->callAPISuccess('contact', 'merge', array(
+ 'to_keep_id' => $retainedContact['id'],
+ 'to_remove_id' => $otherContact['id'],
+ 'auto_flip' => FALSE,
+ ));
+
+ $contacts = $this->callAPISuccess('contact', 'get', $this->_params);
+ $this->assertEquals($retainedContact['id'], $contacts['id']);
+ $activity = $this->callAPISuccess('Activity', 'getsingle', array(
+ 'target_contact_id' => $retainedContact['id'],
+ 'activity_type_id' => 'Contact Merged',
+ ));
+ $this->assertEquals(date('Y-m-d'), date('Y-m-d', strtotime($activity['activity_date_time'])));
}
$this->callAPISuccess('contribution', 'completetransaction', array(
'id' => $contribution['id'],
));
- $contribution = $this->callAPISuccess('contribution', 'get', array('id' => $contribution['id'], 'sequential' => 1));
- $this->assertEquals('Completed', $contribution['values'][0]['contribution_status']);
+ $contribution = $this->callAPISuccess('contribution', 'getsingle', array('id' => $contribution['id']));
+ $this->assertEquals('Completed', $contribution['contribution_status']);
+ $this->assertEquals(date('Y-m-d'), date('Y-m-d', strtotime($contribution['receipt_date'])));
$mut->checkMailLog(array(
'Receipt - Contribution',
'Please print this confirmation for your records.',
array_push(CRM_Core_Config::singleton()->userPermissionClass->permissions, 'access CiviCRM', 'edit contributions');
$payment = $this->callAPIAndDocument('payment', 'create', $params, __FUNCTION__, __FILE__, 'Update Payment', 'UpdatePayment');
+ // Check for proportional cancelled payment against lineitems.
+ $minParams = array(
+ 'entity_table' => 'civicrm_financial_item',
+ 'financial_trxn_id' => $payment['id'] - 1,
+ );
+
+ $eft = $this->callAPISuccess('EntityFinancialTrxn', 'get', $minParams);
+ $amounts = array(-33.33, -16.67);
+
+ foreach ($eft['values'] as $value) {
+ $this->assertEquals($value['amount'], array_pop($amounts));
+ }
+
+ // Check for proportional updated payment against lineitems.
$params = array(
'entity_table' => 'civicrm_financial_item',
'financial_trxn_id' => $payment['id'],
--- /dev/null
+#!/bin/bash
+
+## Cleanup the vendor tree. The main issue here is that civi Civi is
+## deployed as a module inside a CMS, so all its source-code gets published.
+## Some libraries distribute admin tools and sample files which should not
+## be published.
+##
+## This script should be idempotent -- if you rerun it several times, it
+## should always produce the same post-condition.
+
+##############################################################################
+## usage: safe_delete <relpath...>
+function safe_delete() {
+ for file in "$@" ; do
+ if [ -z "$file" ]; then
+ echo "Skip: empty file name"
+ elif [ -e "$file" ]; then
+ rm -rf "$file"
+ fi
+ done
+}
+
+##############################################################################
+## Remove example/CLI scripts. They're not needed and increase the attack-surface.
+safe_delete vendor/tecnickcom/tcpdf/examples
+safe_delete vendor/tecnickcom/tcpdf/tools
+
+## Remove all fonts not included before CRM-18098.
+safe_delete vendor/tecnickcom/tcpdf/fonts/a*
+safe_delete vendor/tecnickcom/tcpdf/fonts/ci*
+safe_delete vendor/tecnickcom/tcpdf/fonts/courierb*
+safe_delete vendor/tecnickcom/tcpdf/fonts/courieri*
+safe_delete vendor/tecnickcom/tcpdf/fonts/dejavu-fonts-ttf-2.33
+safe_delete vendor/tecnickcom/tcpdf/fonts/dejavusansb*
+safe_delete vendor/tecnickcom/tcpdf/fonts/dejavusansc*
+safe_delete vendor/tecnickcom/tcpdf/fonts/dejavusanse*
+safe_delete vendor/tecnickcom/tcpdf/fonts/dejavusansi*
+safe_delete vendor/tecnickcom/tcpdf/fonts/dejavusansm*
+safe_delete vendor/tecnickcom/tcpdf/fonts/dejavuserif*
+safe_delete vendor/tecnickcom/tcpdf/fonts/free*
+safe_delete vendor/tecnickcom/tcpdf/fonts/helveticab*
+safe_delete vendor/tecnickcom/tcpdf/fonts/helveticai*
+safe_delete vendor/tecnickcom/tcpdf/fonts/k*
+safe_delete vendor/tecnickcom/tcpdf/fonts/m*
+safe_delete vendor/tecnickcom/tcpdf/fonts/p*
+safe_delete vendor/tecnickcom/tcpdf/fonts/s*
+safe_delete vendor/tecnickcom/tcpdf/fonts/u*
+safe_delete vendor/tecnickcom/tcpdf/fonts/z*
<type>Text</type>
</html>
</field>
+ <index>
+ <name>index_total_amount_receive_date</name>
+ <fieldName>total_amount</fieldName>
+ <fieldName>receive_date</fieldName>
+ <add>4.7</add>
+ </index>
<field>
<name>fee_amount</name>
<type>decimal</type>
<?xml version="1.0" encoding="iso-8859-1" ?>
<version>
- <version_no>4.7.3</version_no>
+ <version_no>4.7.4</version_no>
</version>