$tableFields = array(
'activity_id' => 'int unsigned',
'activity_date_time' => 'datetime',
+ 'source_record_id' => 'int unsigned',
'status_id' => 'int unsigned',
'subject' => 'varchar(255)',
'source_contact_name' => 'varchar(255)',
$insertSQL = "INSERT INTO {$activityTempTable} (" . implode(',', $insertValueSQL) . " ) ";
$order = $limit = $groupBy = '';
+ $groupBy = " GROUP BY tbl.activity_id ";
if (!empty($input['sort'])) {
if (is_a($input['sort'], 'CRM_Utils_Sort')) {
// create temp table for target contacts
$activityContactTempTable = "civicrm_temp_activity_contact_{$randomNum}";
$query = "CREATE TEMPORARY TABLE {$activityContactTempTable} (
- activity_id int unsigned, contact_id int unsigned, record_type_id varchar(16), contact_name varchar(255) )
+ activity_id int unsigned, contact_id int unsigned, record_type_id varchar(16), contact_name varchar(255), is_deleted int unsigned )
ENGINE=MYISAM DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci";
CRM_Core_DAO::executeQuery($query);
// note that we ignore bulk email for targets, since we don't show it in selector
$query = "
-INSERT INTO {$activityContactTempTable} ( activity_id, contact_id, record_type_id, contact_name )
+INSERT INTO {$activityContactTempTable} ( activity_id, contact_id, record_type_id, contact_name, is_deleted )
SELECT ac.activity_id,
ac.contact_id,
ac.record_type_id,
- c.sort_name
+ c.sort_name,
+ c.is_deleted
FROM civicrm_activity_contact ac
INNER JOIN {$activityTempTable} ON ( ac.activity_id = {$activityTempTable}.activity_id )
INNER JOIN civicrm_contact c ON c.id = ac.contact_id
-WHERE c.is_deleted = 0
-
";
CRM_Core_DAO::executeQuery($query);
SELECT {$activityTempTable}.*,
{$activityContactTempTable}.contact_id,
{$activityContactTempTable}.record_type_id,
- {$activityContactTempTable}.contact_name
+ {$activityContactTempTable}.contact_name,
+ {$activityContactTempTable}.is_deleted
FROM {$activityTempTable}
INNER JOIN {$activityContactTempTable} on {$activityTempTable}.activity_id = {$activityContactTempTable}.activity_id
ORDER BY fixed_sort_order
$values[$activityID]['target_contact_name'] = array();
}
+ // if deleted, wrap in <del>
+ if ( $dao->is_deleted ) {
+ $dao->contact_name = "<del>{$dao->contact_name}</dao>";
+ }
+
if ($dao->record_type_id == $sourceID && $dao->contact_id) {
$values[$activityID]['source_contact_id'] = $dao->contact_id;
$values[$activityID]['source_contact_name'] = $dao->contact_name;
}
}
- // add info on whether the related contacts are deleted (CRM-5673)
- // FIXME: ideally this should be tied to ACLs
-
- // grab all the related contact ids
- $cids = array();
- foreach ($values as $value) {
- $cids[] = $value['source_contact_id'];
- }
- $cids = array_filter(array_unique($cids));
-
- // see which of the cids are of deleted contacts
- if ($cids) {
- $sql = 'SELECT id FROM civicrm_contact WHERE id IN (' . implode(', ', $cids) . ') AND is_deleted = 1';
- $dao = CRM_Core_DAO::executeQuery($sql);
- $dels = array();
- while ($dao->fetch()) {
- $dels[] = $dao->id;
- }
-
- // hide the deleted contacts
- foreach ($values as & $value) {
- if (in_array($value['source_contact_id'], $dels)) {
- unset($value['source_contact_id'], $value['source_contact_name']);
- }
- }
- }
-
return $values;
}
$activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
$sourceID = CRM_Utils_Array::key('Activity Source', $activityContacts);
$sourceJoin = "
-INNER JOIN civicrm_activity_contact ac ON ac.activity_id = civicrm_activity.id AND record_type_id = {$sourceID}
+INNER JOIN civicrm_activity_contact ac ON ac.activity_id = civicrm_activity.id
INNER JOIN civicrm_contact contact ON ac.contact_id = contact.id
";
if (!$input['count']) {
$sourceSelect = ',
civicrm_activity.activity_date_time,
+ civicrm_activity.source_record_id,
civicrm_activity.status_id,
civicrm_activity.subject,
contact.sort_name as source_contact_name,
civicrm_activity.campaign_id as campaign_id
';
+ $sourceJoin .= "
+LEFT JOIN civicrm_activity_contact src ON (src.activity_id = ac.activity_id AND src.record_type_id = {$sourceID} AND src.contact_id = contact.id)
+";
}
$sourceClause = "
if (!$input['count']) {
$caseSelect = ',
civicrm_activity.activity_date_time,
+ civicrm_activity.source_record_id,
civicrm_activity.status_id,
civicrm_activity.subject,
- ac.contact_id,
contact.sort_name as source_contact_name,
civicrm_option_value.value as activity_type_id,
civicrm_option_value.label as activity_type,
}
/**
- * This function delete activity record related to contact record,
+ * This function deletes the activity record related to contact record,
* when there are no target and assignee record w/ other contact.
*
* @param int $contactId contactId
$transaction = new CRM_Core_Transaction();
- // delete activity if there is no record in
- // civicrm_activity_contact
- // pointing to any other contact record.
+ // delete activity if there is no record in civicrm_activity_contact
+ // pointing to any other contact record
$activityContact = new CRM_Activity_DAO_ActivityContact();
$activityContact->contact_id = $contactId;
$activityContact->record_type_id = $sourceID;
$activityContact->find();
while ($activityContact->fetch()) {
- // finally delete activity.
- $activityParams = array('id' => $activityContact->activity_id);
- $result = self::deleteActivity($activityParams);
+ // delete activity_contact record for the deleted contact
+ $activityContact->delete();
+
+ $activityContactOther = new CRM_Activity_DAO_ActivityContact();
+ $activityContactOther->activity_id = $activityContact->activity_id;
+
+ // delete activity only if no other contacts connected
+ if ( ! $activityContactOther->find(TRUE) ) {
+ $activityParams = array('id' => $activityContact->activity_id);
+ $result = self::deleteActivity($activityParams);
+ }
+
+ $activityContactOther->free();
}
$activityContact->free();
//check for source contact.
if (!$componentId || $allow) {
$sourceContactId = self::getActivityContact($activity->id, $sourceID);
- $allow = CRM_Contact_BAO_Contact_Permission::allow($sourceContactId, $permission);
+ //account for possibility of activity not having a source contact (as it may have been deleted)
+ if ( $sourceContactId ) {
+ $allow = CRM_Contact_BAO_Contact_Permission::allow($sourceContactId, $permission);
+ }
}
//check for target and assignee contacts.
}
$activityFilter = array(
- 'activity_type_filter_id' =>
- ( CRM_Utils_Array::value('activity_type_id', $params) ) ?
- CRM_Utils_Type::escape(CRM_Utils_Array::value('activity_type_id', $params), 'Integer') : '',
- 'activity_type_exclude_filter_id' =>
- ( CRM_Utils_Array::value('activity_type_exclude_id', $params) ) ?
- CRM_Utils_Type::escape(CRM_Utils_Array::value('activity_type_exclude_id', $params), 'Integer') : '',
+ 'activity_type_filter_id' => empty($params['activity_type_id']) ? '' :
+ CRM_Utils_Type::escape($params['activity_type_id'], 'Integer'),
+ 'activity_type_exclude_filter_id' => empty($params['activity_type_exclude_id']) ? '' :
+ CRM_Utils_Type::escape($params['activity_type_exclude_id'], 'Integer'),
);
CRM_Core_BAO_Setting::setItem(
}
//fix for CRM-3552, CRM-4575
- if (in_array($this->_gName, array(
- 'communication_style', 'email_greeting', 'postal_greeting', 'addressee', 'from_email_address', 'case_status', 'encounter_medium', 'case_type'))) {
+ $showIsDefaultGroups = array(
+ 'email_greeting',
+ 'postal_greeting',
+ 'addressee',
+ 'from_email_address',
+ 'case_status',
+ 'encounter_medium',
+ 'case_type',
+ 'payment_instrument',
+ 'communication_style',
+ );
+
+ if (in_array($this->_gName, $showIsDefaultGroups)) {
$this->assign('showDefault', TRUE);
$this->add('checkbox', 'is_default', ts('Default Option?'));
}
'postal_greeting', 'addressee',
'communication_style',
'case_status', 'encounter_medium',
- 'case_type',
+ 'case_type', 'payment_instrument'
)
)) {
$this->assign('showIsDefault', TRUE);
*/
function phone_numeric(&$values) {
list($name, $op, $value, $grouping, $wildcard) = $values;
- // Strip non-numeric characters
- $number = preg_replace('/[^\d]/', '', $value);
+ // Strip non-numeric characters; allow wildcards
+ $number = preg_replace('/[^\d%]/', '', $value);
if ($number) {
+ if ( strpos($number, '%') === FALSE ) {
+ $number = "%$number%";
+ }
+
$this->_qill[$grouping][] = ts('Phone number contains') . " $number";
- $this->_where[$grouping][] = self::buildClause('civicrm_phone.phone_numeric', 'LIKE', "%$number%", 'String');
+ $this->_where[$grouping][] = self::buildClause('civicrm_phone.phone_numeric', 'LIKE', "$number", 'String');
$this->_tables['civicrm_phone'] = $this->_whereTables['civicrm_phone'] = 1;
}
}
} else {
$contactTypes = array();
foreach ($contactProfiles as $key => $value) {
- if (strpos($value, $leftType) !== FALSE) {
+ $groupTypes = CRM_Core_BAO_UFGroup::profileGroups($key);
+ if (in_array($leftType, $groupTypes)) {
$contactTypes = array($key => $value);
}
}
}
}
+ // CRM-13420, set payment instrument to default if payment_instrument_id is empty
+ if (!$contributionID && !CRM_Utils_Array::value('payment_instrument_id', $params)) {
+ $params['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument',
+ FALSE, FALSE, FALSE, 'AND is_default = 1'));
+ }
+
if (CRM_Utils_Array::value('payment_instrument_id', $params)) {
$paymentInstruments = CRM_Contribute_PseudoConstant::paymentInstrument('name');
if ($params['payment_instrument_id'] != array_search('Check', $paymentInstruments)) {
$params['trxnParams'] = $trxnParams;
if (CRM_Utils_Array::value('prevContribution', $params)) {
+ $params['trxnParams']['total_amount'] = $trxnParams['total_amount'] = $params['total_amount'] = $params['prevContribution']->total_amount;
+ $params['trxnParams']['fee_amount'] = $params['prevContribution']->fee_amount;
+ $params['trxnParams']['net_amount'] = $params['prevContribution']->net_amount;
+ $params['trxnParams']['trxn_id'] = $params['prevContribution']->trxn_id;
+ $params['trxnParams']['status_id'] = $params['prevContribution']->contribution_status_id;
+ $params['trxnParams']['payment_instrument_id'] = $params['prevContribution']->payment_instrument_id;
+ $params['trxnParams']['check_number'] = $params['prevContribution']->check_number;
- //if Change contribution amount
- if (array_key_exists('total_amount', $params) && isset($params['total_amount']) &&
- $params['total_amount'] != $params['prevContribution']->total_amount) {
- //Update Financial Records
- self::updateFinancialAccounts($params, 'changedAmount');
+ //if financial type is changed
+ if (CRM_Utils_Array::value('financial_type_id', $params) &&
+ $params['contribution']->financial_type_id != $params['prevContribution']->financial_type_id) {
+ $incomeTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
+ $oldFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['prevContribution']->financial_type_id, $incomeTypeId);
+ $newFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $incomeTypeId);
+ if ($oldFinancialAccount != $newFinancialAccount) {
+ $params['total_amount'] = 0;
+ if ($params['contribution']->contribution_status_id == array_search('Pending', $contributionStatuses)) {
+ $params['trxnParams']['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType(
+ $params['prevContribution']->financial_type_id, $relationTypeId);
+ }
+ else {
+ $lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['prevContribution']->id, 'DESC');
+ if (CRM_Utils_Array::value('financialTrxnId', $lastFinancialTrxnId)) {
+ $params['trxnParams']['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $lastFinancialTrxnId['financialTrxnId'], 'to_financial_account_id');
+ }
+ }
+ self::updateFinancialAccounts($params, 'changeFinancialType');
+ /* $params['trxnParams']['to_financial_account_id'] = $trxnParams['to_financial_account_id']; */
+ $params['financial_account_id'] = $newFinancialAccount;
+ $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
+ self::updateFinancialAccounts($params);
+ $params['trxnParams']['to_financial_account_id'] = $trxnParams['to_financial_account_id'];
+ }
}
//Update contribution status
+ $params['trxnParams']['status_id'] = $params['contribution']->contribution_status_id;
if (CRM_Utils_Array::value('contribution_status_id', $params) &&
$params['prevContribution']->contribution_status_id != $params['contribution']->contribution_status_id) {
//Update Financial Records
// change Payment Instrument for a Completed contribution
// first handle special case when contribution is changed from Pending to Completed status when initial payment
// instrument is null and now new payment instrument is added along with the payment
+ $params['trxnParams']['payment_instrument_id'] = $params['contribution']->payment_instrument_id;
+ $params['trxnParams']['check_number'] = CRM_Utils_Array::value('check_number', $params);
if (array_key_exists('payment_instrument_id', $params)) {
+ $params['trxnParams']['total_amount'] = - $trxnParams['total_amount'];
if (CRM_Utils_System::isNull($params['prevContribution']->payment_instrument_id) &&
!CRM_Utils_System::isNull($params['contribution']->payment_instrument_id)) {
//check if status is changed from Pending to Completed
$params['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatuses))) {
// for all other statuses create new financial records
self::updateFinancialAccounts($params, 'changePaymentInstrument');
+ $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
+ self::updateFinancialAccounts($params, 'changePaymentInstrument');
}
}
else if ((!CRM_Utils_System::isNull($params['contribution']->payment_instrument_id) ||
$params['contribution']->payment_instrument_id != $params['prevContribution']->payment_instrument_id) {
// for any other payment instrument changes create new financial records
self::updateFinancialAccounts($params, 'changePaymentInstrument');
+ $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
+ self::updateFinancialAccounts($params, 'changePaymentInstrument');
}
else if (!CRM_Utils_System::isNull($params['contribution']->check_number) &&
$params['contribution']->check_number != $params['prevContribution']->check_number) {
// another special case when check number is changed, create new financial records
// create financial trxn with negative amount
- $params['trxnParams']['total_amount'] = - $trxnParams['total_amount'];
$params['trxnParams']['check_number'] = $params['prevContribution']->check_number;
self::updateFinancialAccounts($params, 'changePaymentInstrument');
// create financial trxn with positive amount
}
}
- //if financial type is changed
- if (CRM_Utils_Array::value('financial_type_id', $params) &&
- $params['contribution']->financial_type_id != $params['prevContribution']->financial_type_id) {
- $incomeTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Income Account is' "));
- $oldFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['prevContribution']->financial_type_id, $incomeTypeId);
- $newFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $incomeTypeId);
- if ($oldFinancialAccount != $newFinancialAccount) {
- $params['total_amount'] = 0;
- if ($params['contribution']->contribution_status_id == array_search('Pending', $contributionStatuses)) {
- $params['trxnParams']['to_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType(
- $params['prevContribution']->financial_type_id, $relationTypeId);
- }
- self::updateFinancialAccounts($params, 'changeFinancialType');
- $params['trxnParams']['to_financial_account_id'] = $trxnParams['to_financial_account_id'];
- $params['financial_account_id'] = $newFinancialAccount;
- $params['total_amount'] = $params['trxnParams']['total_amount'] = $trxnParams['total_amount'];
- self::updateFinancialAccounts($params);
- }
+ //if Change contribution amount
+ $params['trxnParams']['fee_amount'] = CRM_Utils_Array::value('fee_amount', $params);
+ $params['trxnParams']['net_amount'] = CRM_Utils_Array::value('net_amount', $params);
+ $params['trxnParams']['total_amount'] = $trxnParams['total_amount'] = $params['total_amount'] = $totalAmount;
+ $params['trxnParams']['trxn_id'] = $params['contribution']->trxn_id;
+ if (isset($totalAmount) &&
+ $totalAmount != $params['prevContribution']->total_amount) {
+ //Update Financial Records
+ $params['trxnParams']['from_financial_account_id'] = NULL;
+ self::updateFinancialAccounts($params, 'changedAmount');
}
}
$itemAmount = $params['trxnParams']['total_amount'];
}
elseif ($context == 'changePaymentInstrument') {
- if ($params['prevContribution']->payment_instrument_id != null
- && $params['prevContribution']->contribution_status_id == array_search('Pending', $contributionStatus)
- && $params['contribution']->contribution_status_id == array_search('Pending', $contributionStatus)) {
- $relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
- $params['trxnParams']['from_financial_account_id'] = CRM_Contribute_PseudoConstant::financialAccountType($params['financial_type_id'], $relationTypeId);
- }
- elseif ($params['prevContribution']->payment_instrument_id != null) {
- $params['trxnParams']['from_financial_account_id'] =
- CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount(
- $params['prevContribution']->payment_instrument_id);
+ if ($params['trxnParams']['total_amount'] < 0) {
+ $lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($params['prevContribution']->id, 'DESC');
+ if (CRM_Utils_Array::value('financialTrxnId', $lastFinancialTrxnId)) {
+ $params['trxnParams']['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $lastFinancialTrxnId['financialTrxnId'], 'to_financial_account_id');
+ $params['trxnParams']['payment_instrument_id'] = $params['prevContribution']->payment_instrument_id;
+ }
}
else {
- $params['trxnParams']['from_financial_account_id'] = CRM_Core_DAO::singleValueQuery(
- "SELECT id FROM civicrm_financial_account WHERE is_default = 1");
+ $params['trxnParams']['to_financial_account_id'] = $params['to_financial_account_id'];
+ $params['trxnParams']['payment_instrument_id'] = $params['contribution']->payment_instrument_id;
}
}
-
$trxn = CRM_Core_BAO_FinancialTrxn::create($params['trxnParams']);
$params['entity_id'] = $trxn->id;
$dao = new CRM_Contribute_DAO_ContributionPage();
$dao->copyValues($params);
$dao->save();
- if ($financialTypeId && CRM_Utils_Array::value('financial_type_id', $params)
+ if ($financialTypeId && CRM_Utils_Array::value('financial_type_id', $params)
&& $financialTypeId != $params['financial_type_id']) {
CRM_Price_BAO_PriceFieldValue::updateFinancialType($params['id'], 'civicrm_contribution_page', $params['financial_type_id']);
}
'toName' => $displayName,
'toEmail' => $email,
);
-
+ //CRM-13811
+ if ($pageID) {
+ $templatesParams['cc'] = CRM_Utils_Array::value('cc_receipt', $value[$pageID]);
+ $templatesParams['bcc'] = CRM_Utils_Array::value('bcc_receipt', $value[$pageID]);
+ }
if ($recur->id) {
// in some cases its just recurringNotify() thats called for the first time and these urls don't get set.
// like in PaypalPro, & therefore we set it here additionally.
$query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
return;
- case 'financial_type_id':
- case 'financial_type':
- $cType = $value;
+ case 'financial_type_id':
+ case 'financial_type':
+ // The financial_type_id might be an array (from aggregate contributions custom search)
+ // In this case, we need to change the query.
+ if (is_array($value)) {
+ $val = array();
+ // Rebuild the array to get the data we're interested in as array
+ // values not array keys.
+ foreach ($value as $k => $v) {
+ if ($v) {
+ $val[] = $k;
+ }
+ }
+ if (count($val) > 1) {
+ // Overwrite $value so it works with an IN where statement.
+ $op = 'IN';
+ $value = '(' . implode(',', $val) . ')';
+ }
+ else {
+ // If we somehow have an empty array, just return
+ return;
+ }
+ }
+
$types = CRM_Contribute_PseudoConstant::financialType();
+
+ // Ensure we have a sensible string to display to the user.
+ $names = array();
+ if (isset($val) && is_array($val)) {
+ foreach($val as $id) {
+ $names[] = $types[$id];
+ }
+ }
+ else {
+ $names[] = $types[$value];
+ }
+
$query->_where[$grouping][] = CRM_Contact_BAO_Query::buildClause("civicrm_contribution.financial_type_id",
$op, $value, "Integer"
);
- $query->_qill[$grouping ][] = ts('Financial Type - %1', array(1 => $types[$cType]));
+ $query->_qill[$grouping][] = ts('Financial Type %1', array(1 => $op)) . ' ' . implode(' ' . ts('or') . ' ', $names);
$query->_tables['civicrm_contribution'] = $query->_whereTables['civicrm_contribution'] = 1;
return;
if ($this->_contributionType) {
$defaults['financial_type_id'] = $this->_contributionType;
}
+
+ if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+ $defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
+ }
if (CRM_Utils_Array::value('is_test', $defaults)) {
$this->assign('is_test', TRUE);
$paymentInstrument = $this->add('select', 'payment_instrument_id',
ts('Paid By'),
array('' => ts('- select -')) + CRM_Contribute_PseudoConstant::paymentInstrument(),
- FALSE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);")
+ TRUE, array('onChange' => "return showHideByValue('payment_instrument_id','4','checkNumber','table-row','select',false);")
);
}
return;
}
else if (array_keys($filters) == array('name')) {
- $settingSpec = array($filters['name'] => CRM_Utils_Array::value($filters['name'], $settingSpec));
+ $settingSpec = array($filters['name'] => CRM_Utils_Array::value($filters['name'], $settingSpec, ''));
return;
}
else {
// also cleanup module permissions
$config->cleanupPermissions();
+ // also rebuild word replacement cache
+ CRM_Core_BAO_WordReplacement::rebuild();
+
CRM_Core_BAO_Setting::updateSettingsFromMetaData();
CRM_Core_Resources::singleton()->resetCacheCode();
->condition('permission', array_keys($permissions), 'NOT IN');
$query->execute();
}
+
+ /**
+ * Get all the contact emails for users that have a specific permission
+ *
+ * @param string $permissionName name of the permission we are interested in
+ *
+ * @return string a comma separated list of email addresses
+ */
+ public function permissionEmails($permissionName) {
+ static $_cache = array();
+
+ if (isset($_cache[$permissionName])) {
+ return $_cache[$permissionName];
+ }
+
+ $uids = array();
+ $sql = "
+ SELECT {users}.uid, {role_permission}.permission
+ FROM {users}
+ JOIN {users_roles}
+ ON {users}.uid = {users_roles}.uid
+ JOIN {role_permission}
+ ON {role_permission}.rid = {users_roles}.rid
+ WHERE {role_permission}.permission = '{$permissionName}'
+ AND {users}.status = 1
+ ";
+
+ $result = db_query($sql);
+ foreach ( $result as $record ) {
+ $uids[] = $record->uid;
+ }
+
+ $_cache[$permissionName] = self::getContactEmails($uids);
+ return $_cache[$permissionName];
+ }
}
// Load custom or core css
$config = CRM_Core_Config::singleton();
if (!empty($config->customCSSURL)) {
- $this->addStyleUrl($config->customCSSURL, -99, $region);
+ $this->addStyleUrl($config->customCSSURL, 99, $region);
}
if (!CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'disable_core_css')) {
$this->addStyleFile('civicrm', 'css/civicrm.css', -99, $region);
const CACHE_DAYS = 1;
const BLOG_URL = 'https://civicrm.org/blog/feed';
+ /**
+ * Get the final, usable URL string (after interpolating any variables)
+ *
+ * @return FALSE|string
+ */
+ public function getBlogUrl() {
+ // Note: We use "*default*" as the default (rather than self::BLOG_URL) so that future
+ // developers can change BLOG_URL without needing to update {civicrm_setting}.
+ $url = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'blogUrl', NULL, '*default*');
+ if ($url === '*default*') {
+ $url = self::BLOG_URL;
+ }
+ return CRM_Utils_System::evalUrl($url);
+ }
+
/**
* List blog articles as dashlet
*
$expire = time() - (60 * 60 * 24 * self::CACHE_DAYS);
// Refresh data after CACHE_DAYS
if (strtotime($cache->created_date) < $expire) {
- $new_data = $this->_getFeed();
+ $new_data = $this->_getFeed($this->getBlogUrl());
// If fetching the new rss feed was successful, return it
// Otherwise use the old cached data - it's better than nothing
if ($new_data) {
}
return unserialize($cache->data);
}
- return $this->_getFeed();
+ return $this->_getFeed($this->getBlogUrl());
}
/**
*
* @access public
*/
- public function _getFeed( $url = self::BLOG_URL) {
+ public function _getFeed($url) {
$httpClient = new CRM_Utils_HttpClient(self::CHECK_TIMEOUT);
list ($status, $rawFeed) = $httpClient->get($url);
if ($status !== CRM_Utils_HttpClient::STATUS_OK) {
'conference_sessions' => $sessions,
));
+ // CRM-13890 : NOTE wait list condition need to be given so that
+ // wait list message is shown properly in email i.e. WRT online event registration template
+ if (empty($tplParams['participant_status']) && !CRM_Utils_Array::value('isOnWaitlist', $values['params'])) {
+ $statusId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Participant', $participantId, 'status_id', 'id');
+ $tplParams['participant_status'] = CRM_Event_PseudoConstant::participantStatus($statusId, NULL, 'label');
+ }
+
$sendTemplateParams = array(
'groupName' => 'msg_tpl_workflow_event',
'valueName' => 'event_online_receipt',
//CRM-11601 we should keep the record contribution
//true by default while adding participant
- if ($form->_action == CRM_Core_Action::ADD && !$form->_mode && $form->_isPaidEvent) {
+ if ($form->_action == CRM_Core_Action::ADD && !$form->_mode && $form->_isPaidEvent) {
$defaults[$form->_pId]['record_contribution'] = 1;
}
-
+
+ //CRM-13420
+ if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+ $defaults[$form->_pId]['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
+ }
if ($form->_mode) {
$config = CRM_Core_Config::singleton();
// set default country from config if no country set
if (CRM_Utils_Array::value('event_id', $defaults[$this->_id])) {
$contributionTypeId = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event',
$defaults[$this->_id]['event_id'],
- 'financial_type_id' );
+ 'financial_type_id'
+ );
if ($contributionTypeId) {
- $defaults[$this->_id]['financial_type_id'] = $contributionTypeId;
+ $defaults[$this->_id]['financial_type_id'] = $contributionTypeId;
}
}
CRM_Core_Payment_Form::validateCreditCard($values, $errorMsg);
}
- if (CRM_Utils_Array::value('record_contribution', $values) && !CRM_Utils_Array::value('financial_type_id', $values)) {
- $errorMsg['financial_type_id'] = ts('Please enter the associated Financial Type');
+ if (CRM_Utils_Array::value('record_contribution', $values)) {
+ if (!CRM_Utils_Array::value('financial_type_id', $values)) {
+ $errorMsg['financial_type_id'] = ts('Please enter the associated Financial Type');
+ }
+ if (!CRM_Utils_Array::value('payment_instrument_id', $values)) {
+ $errorMsg['payment_instrument_id'] = ts('Paid By is a required field.');
+ }
}
// validate contribution status for 'Failed'.
* Function to handle import error file creation.
*
*/
- function invoke() {
+ static function invoke() {
$type = CRM_Utils_Request::retrieve('type', 'Positive', CRM_Core_DAO::$_nullObject);
$parserName = CRM_Utils_Request::retrieve('parser', 'String', CRM_Core_DAO::$_nullObject);
if (empty($parserName) || empty($type)) {
CRM_Utils_System::civiExit();
}
- function exportCustom($customSearchClass, $formValues, $order) {
+ static function exportCustom($customSearchClass, $formValues, $order) {
$ext = CRM_Extension_System::singleton()->getMapper();
if (!$ext->isExtensionClass($customSearchClass)) {
require_once (str_replace('_', DIRECTORY_SEPARATOR, $customSearchClass) . '.php');
* or have no street address
*
*/
- function postalMailingFormat($exportTempTable, &$headerRows, &$sqlColumns, $exportParams) {
+ static function postalMailingFormat($exportTempTable, &$headerRows, &$sqlColumns, $exportParams) {
$whereClause = array();
if (array_key_exists('is_deceased', $sqlColumns)) {
$fields = array();
if (!empty($testParams)) {
- $mailing->from_name = ts(
- 'CiviCRM Test Mailer (%1)',
- array(1 => $mailing->from_name)
- );
- $mailing->subject = ts('Test Mailing:') . ' ' . $mailing->subject;
+ $mailing->subject = ts('[CiviMail Draft]') . ' ' . $mailing->subject;
}
CRM_Mailing_BAO_Mailing::tokenReplace($mailing);
$form->add('checkbox', 'mailing_forward', ts('Forwards'));
$form->assign('validCiviMailing', TRUE);
- $form->addFormRule(array('CRM_Mailing_BAO_Query', 'formRule'), $form);
- }
-
- /**
- * global form rule
- *
- * @param array $fields the input form values
- * @param array $files the uploaded files if any
- * @param array $options additional user data
- *
- * @return true if no errors, else array of errors
- * @access public
- * @static
- */
- static function formRule($fields, $files, $self) {
- $errors = array();
- // if an event filter is specified, then a mailing selector must also be specified
- if ((CRM_Utils_Array::value('mailing_delivery_status', $fields) ||
- CRM_Utils_Array::value('mailing_open_status', $fields) ||
- CRM_Utils_Array::value('mailing_click_status', $fields) ||
- CRM_Utils_Array::value('mailing_reply_status', $fields) ||
- CRM_Utils_Array::value('mailing_bounce_types', $fields)
- ) &&
- (!CRM_Utils_Array::value('mailing_id', $fields) &&
- !CRM_Utils_Array::value('mailing_date_low', $fields) &&
- !CRM_Utils_Array::value('mailing_date_high', $fields)
- )
- ) {
- $errors['mailing_id'] = ts('Must specify mailing name or date');
- // Keep search form opened in case of form rule.
- if (is_a($self, 'CRM_Contact_Form_Search_Advanced') && !isset(CRM_Contact_BAO_Query::$_openedPanes['Mailings'])) {
- CRM_Contact_BAO_Query::$_openedPanes['Mailings'] = TRUE;
- $self->assign('openedPanes', CRM_Contact_BAO_Query::$_openedPanes);
- }
- }
- return $errors;
}
static function addShowHide(&$showHide) {
$showHide->addShow('MailingForm_show');
}
- static function searchAction(&$row, $id) {}
+ static function searchAction(&$row, $id) {
+ }
- static function tableNames(&$tables) {}
+ static function tableNames(&$tables) {
+ }
/**
* Filter query results based on which contacts do (not) have a particular mailing event in their history.
$query->_qill[$grouping][] = $fieldTitle . ' - ' . $valueTitles[$value];
}
+ $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;
$query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] = 1;
$query->_tables['civicrm_mailing_event_queue'] = $query->_whereTables['civicrm_mailing_event_queue'] = 1;
$query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1;
$body = $message->get();
$headers = $message->headers();
- PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
- array('CRM_Core_Error', 'nullHandler')
- );
$result = NULL;
if (is_object($mailer)) {
+ CRM_Core_Error::ignoreException();
$result = $mailer->send($recipient, $headers, $body);
CRM_Core_Error::setCallback();
}
$config = CRM_Core_Config::singleton();
$mailer = $config->getMailer();
- PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
- array('CRM_Core_Error', 'nullHandler')
- );
if (is_object($mailer)) {
+ CRM_Core_Error::ignoreException();
$mailer->send($mailing->replyto_email, $h, $b);
CRM_Core_Error::setCallback();
}
CRM_Mailing_BAO_Mailing::addMessageIdHeader($h, 'a', $eq->job_id, queue_id, $eq->hash);
$mailer = $config->getMailer();
- PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
- array('CRM_Core_Error', 'nullHandler')
- );
if (is_object($mailer)) {
+ CRM_Core_Error::ignoreException();
$mailer->send($to, $h, $b);
CRM_Core_Error::setCallback();
}
$mailer = $config->getMailer();
- PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
- array('CRM_Core_Error', 'nullHandler')
- );
if (is_object($mailer)) {
+ CRM_Core_Error::ignoreException();
$mailer->send($eq->email, $h, $b);
CRM_Core_Error::setCallback();
}
);
$mailer = $config->getMailer();
- PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
- array('CRM_Core_Error', 'nullHandler')
- );
if (is_object($mailer)) {
+ CRM_Core_Error::ignoreException();
$mailer->send($email, $h, $b);
CRM_Core_Error::setCallback();
}
$mailer = $config->getMailer();
- PEAR::setErrorHandling(PEAR_ERROR_CALLBACK,
- array('CRM_Core_Error', 'nullHandler')
- );
if (is_object($mailer)) {
+ CRM_Core_Error::ignoreException();
$mailer->send($eq->email, $h, $b);
CRM_Core_Error::setCallback();
}
$backUrlTitle = ts('Back to Mailing');
}
else {
- $backUrl = CRM_Utils_System::url('civicrm/mailing', 'reset=1');
+ $backUrl = CRM_Utils_System::url('civicrm/mailing/report', "reset=1&mid={$mailing_id}");
$backUrlTitle = ts('Back to Report');
}
}
}
}
-
+
if (CRM_Utils_Array::value('record_contribution', $defaults) && !$this->_mode) {
$contributionParams = array('id' => $defaults['record_contribution']);
$contributionIds = array();
$defaults['source'] = $defaults['membership_source'];
}
}
+ //CRM-13420
+ if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+ $defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
+ }
// User must explicitly choose to send a receipt in both add and update mode.
$defaults['send_receipt'] = 0;
if (!$priceSetId && $self->_mode && !CRM_Utils_Array::value('financial_type_id', $params)) {
$errors['financial_type_id'] = ts('Please enter the financial Type.');
}
+
+ if (CRM_Utils_Array::value('record_contribution', $params) && !CRM_Utils_Array::value('payment_instrument_id', $params)) {
+ $errors['payment_instrument_id'] = ts('Paid By is a required field.');
+ }
if (CRM_Utils_Array::value('payment_processor_id', $params)) {
// make sure that credit card number and cvv are valid
}
$defaults['financial_type_id'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_memType, 'financial_type_id');
+
+ //CRM-13420
+ if (!CRM_Utils_Array::value('payment_instrument_id', $defaults)) {
+ $defaults['payment_instrument_id'] = key(CRM_Core_OptionGroup::values('payment_instrument', FALSE, FALSE, FALSE, 'AND is_default = 1'));
+ }
$defaults['total_amount'] = CRM_Utils_Money::format(CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType',
$this->_memType,
if (!$params['total_amount']) {
$errors['total_amount'] = ts('Please enter a Contribution Amount.');
}
+ if (!CRM_Utils_Array::value('payment_instrument_id', $params)) {
+ $errors['payment_instrument_id'] = ts('Paid By is a required field.');
+ }
}
return empty($errors) ? TRUE : $errors;
}
*
*/
function preProcess() {
+
+ //CRM-13901 don't show dashboard to contacts with limited view writes & it does not relect
+ //what they have access to
+ //@todo implement acls on dashboard querys (preferably via api to enhance that at the same time)
+ if(!CRM_Core_Permission::check(array('view all contacts', 'edit all contacts'))) {
+ $this->showMembershipSummary = FALSE;
+ $this->assign('membershipSummary', FALSE);
+ return;
+ }
+ $this->assign('membershipSummary', TRUE);
CRM_Utils_System::setTitle(ts('CiviMember'));
$membershipSummary = array();
$preMonth = date("Y-m-d", mktime(0, 0, 0, date("m") - 1, 01, date("Y")));
return CRM_Core_DAO::singleValueQuery($query);
}
- public function updatePledgeStatus($params) {
+ public static function updatePledgeStatus($params) {
$returnMessages = array();
* @var null
*/
protected $_customGroupExtends = NULL;
+ protected $_customGroupExtendsJoin = array();
protected $_customGroupFilters = TRUE;
protected $_customGroupGroupBy = FALSE;
protected $_customGroupJoin = 'LEFT JOIN';
if (!$this->isFieldSelected($prop)) {
continue;
}
+ $baseJoin = CRM_Utils_Array::value($prop['extends'], $this->_customGroupExtendsJoin, "{$this->_aliases[$extendsTable]}.id");
$customJoin = is_array($this->_customGroupJoin) ? $this->_customGroupJoin[$table] : $this->_customGroupJoin;
$this->_from .= "
-{$customJoin} {$table} {$this->_aliases[$table]} ON {$this->_aliases[$table]}.entity_id = {$this->_aliases[$extendsTable]}.id";
+{$customJoin} {$table} {$this->_aliases[$table]} ON {$this->_aliases[$table]}.entity_id = {$baseJoin}";
// handle for ContactReference
if (array_key_exists('fields', $prop)) {
foreach ($prop['fields'] as $fieldName => $field) {
}
}
+ function statistics(&$rows) {
+ $statistics = parent::statistics($rows);
+
+ $select = "SELECT SUM({$this->_aliases['civicrm_pcp']}.goal_amount) as goal_total, ".
+ "SUM({$this->_aliases['civicrm_contribution_soft']}.amount) as committed_total, ".
+ "COUNT({$this->_aliases['civicrm_contribution_soft']}.id) as donors_total, ".
+ "SUM(IF( contribution_civireport.contribution_status_id > 1, 0, contribution_soft_civireport.amount)) AS received_total ";
+ $sql = "{$select} {$this->_from} {$this->_where}";
+ $dao = CRM_Core_DAO::executeQuery($sql);
+ $dao->fetch();
+ $statistics['counts']['goal_total'] = array(
+ 'title' => ts('Goal Total'),
+ 'value' => $dao->goal_total,
+ 'type' => CRM_Utils_Type::T_MONEY
+ );
+ $statistics['counts']['committed_total'] = array(
+ 'title' => ts('Total Committed'),
+ 'value' => $dao->committed_total,
+ 'type' => CRM_Utils_Type::T_MONEY
+ );
+ $statistics['counts']['received_total'] = array(
+ 'title' => ts('Total Received'),
+ 'value' => $dao->received_total,
+ 'type' => CRM_Utils_Type::T_MONEY
+ );
+ $statistics['counts']['donors_total'] = array(
+ 'title' => ts('Total Donors'),
+ 'value' => $dao->donors_total,
+ 'type' => CRM_Utils_Type::T_INT
+ );
+ return $statistics;
+ }
function alterDisplay(&$rows) {
// custom code to alter rows
$entryFound = FALSE;
";
$dao = CRM_Core_DAO::executeQuery($sql);
- $amount = $average = $amount = $average = array();
+ $amount = $average = $amount2 = $average2 = array();
$count = $count2 = 0;
while ($dao->fetch()) {
if ($dao->amount) {
--- /dev/null
+{php}
+ $dir = SMARTY_DIR . '/../../CRM/Upgrade/4.4.3.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="500" 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>Dear {contact.display_name},</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> for the following:</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="500" 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}
+ <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 $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>
+ <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:$currency}
+ </td>
+ <td>
+ {$line.line_total|crmMoney:$currency}
+ </td>
+ {if $pricesetFieldsCount }<td>{$line.participant_count}</td> {/if}
+ </tr>
+ {/foreach}
+ </table>
+ </td>
+ </tr>
+ {/if}
+ {/foreach}
+ {/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 $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 $contributionTypeName}
+ <tr>
+ <td {$labelStyle}>
+ {ts}Financial Type{/ts}
+ </td>
+ <td {$valueStyle}>
+ {$contributionTypeName}
+ </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}
+{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>
+ </td>
+ </tr>
+ </table>
+</center>
+
+</body>
+</html>
--- /dev/null
+Dear {contact.display_name},
+
+{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} for the following:
+
+{/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}
+
+{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 $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}
+{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"} {$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"} {$line.line_total|crmMoney:$currency|string_format:"%10s"}{$ts_participant_count|string_format:"%10s"}
+{/foreach}
+{/if}
+{/foreach}
+{/if}
+{if $amounts && !$lineItem}
+{foreach from=$amounts item=amnt key=level}{$amnt.amount|crmMoney:$currency} {$amnt.label}
+{/foreach}
+{/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 $contributionTypeName}
+{ts}Financial Type{/ts}: {$contributionTypeName}
+{/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}
+==========================================================={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}
$postUpgradeMessage .= '<br />' . ts("The setting to skip IDS check has been removed. Your site has this configured in civicrm.settings.php but it will no longer work. Instead, use the new permission 'skip IDS check' to bypass the IDS system.");
}
}
+ if ($rev == '4.4.3') {
+ $postUpgradeMessage .= '<br />' . ts('Default versions of the following System Workflow Message Templates have been modified to handle new functionality: <ul><li>Events - Registration Confirmation and Receipt (on-line)</li></ul> If you have modified these templates, please review the new default versions and implement updates as needed to your copies (Administer > Communications > Message Templates > System Workflow Messages).');
+ }
}
function upgrade_4_4_alpha1($rev) {
";
$financialAccountId = CRM_Core_DAO::singleValueQuery($query);
- $accountRelationsips = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount', 'account_relationship');
+ $accountRelationsips = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_EntityFinancialAccount',
+ 'account_relationship', CRM_Core_DAO::$_nullArray, 'validate');
$accountsReceivableAccount = array_search('Accounts Receivable Account is', $accountRelationsips);
$incomeAccountIs = array_search('Income Account is', $accountRelationsips);
$assetAccountIs = array_search('Asset Account is', $accountRelationsips);
$expenseAccountIs = array_search('Expense Account is', $accountRelationsips);
- $financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id');
+ $financialItemStatus = CRM_Core_PseudoConstant::get('CRM_Financial_DAO_FinancialItem', 'status_id',
+ CRM_Core_DAO::$_nullArray, 'validate');
$unpaidStatus = array_search('Unpaid', $financialItemStatus);
$paidStatus = array_search('Paid', $financialItemStatus);
-- CRM-12470
UPDATE civicrm_financial_account
SET is_default = 1
-WHERE name IN ('{ts escape="sql"}Premiums{/ts}', '{ts escape="sql"}Banking Fees{/ts}', '{ts escape="sql"}Accounts Payable{/ts}', '{ts escape="sql"}Donation{/ts}');
+WHERE name IN ('Premiums', 'Banking Fees', 'Accounts Payable', 'Donation');
SELECT @option_group_id_arel := max(id) from civicrm_option_group where name = 'account_relationship';
SELECT @option_group_id_fat := max(id) from civicrm_option_group where name = 'financial_account_type';
INSERT INTO
`civicrm_financial_account` (`name`, `contact_id`, `financial_account_type_id`, `description`, `accounting_code`, `account_type_code`, `is_reserved`, `is_active`, `is_deductible`, `is_default`)
VALUES
- ('{ts escape="sql"}Banking Fees{/ts}' , @domainContactId, @opexp, 'Payment processor fees and manually recorded banking fees', '5200', 'EXP', 0, 1, 0, 0),
- ('{ts escape="sql"}Deposit Bank Account{/ts}' , @domainContactId, @opAsset, 'All manually recorded cash and cheques go to this account', '1100', 'BANK', 0, 1, 0, 1),
- ('{ts escape="sql"}Accounts Receivable{/ts}' , @domainContactId, @opAsset, 'Amounts to be received later (eg pay later event revenues)', '1200', 'AR', 0, 1, 0, 0),
- ('{ts escape="sql"}Accounts Payable{/ts}' , @domainContactId, @opLiability, 'Amounts to be paid out such as grants and refunds', '2200', 'AP', 0, 1, 0, 0),
- ('{ts escape="sql"}Premiums{/ts}' , @domainContactId, @opCost, 'Account to record cost of premiums provided to payors', '5100', 'COGS', 0, 1, 0, 0),
- ('{ts escape="sql"}Premiums Inventory{/ts}' , @domainContactId, @opAsset, 'Account representing value of premiums inventory', '1375', 'OCASSET', 0, 1, 0, 0),
- ('{ts escape="sql"}Discounts{/ts}' , @domainContactId, @opval, 'Contra-revenue account for amounts discounted from sales', '4900', 'INC', 0, 1, 0, 0),
- ('{ts escape="sql"}Payment Processor Account{/ts}', @domainContactId, @opAsset, 'Account to record payments into a payment processor merchant account', '1150', 'BANK', 0, 1, 0, 0);
+ ('Banking Fees' , @domainContactId, @opexp, 'Payment processor fees and manually recorded banking fees', '5200', 'EXP', 0, 1, 0, 0),
+ ('Deposit Bank Account' , @domainContactId, @opAsset, 'All manually recorded cash and cheques go to this account', '1100', 'BANK', 0, 1, 0, 1),
+ ('Accounts Receivable' , @domainContactId, @opAsset, 'Amounts to be received later (eg pay later event revenues)', '1200', 'AR', 0, 1, 0, 0),
+ ('Accounts Payable' , @domainContactId, @opLiability, 'Amounts to be paid out such as grants and refunds', '2200', 'AP', 0, 1, 0, 0),
+ ('Premiums' , @domainContactId, @opCost, 'Account to record cost of premiums provided to payors', '5100', 'COGS', 0, 1, 0, 0),
+ ('Premiums Inventory' , @domainContactId, @opAsset, 'Account representing value of premiums inventory', '1375', 'OCASSET', 0, 1, 0, 0),
+ ('Discounts' , @domainContactId, @opval, 'Contra-revenue account for amounts discounted from sales', '4900', 'INC', 0, 1, 0, 0),
+ ('Payment Processor Account', @domainContactId, @opAsset, 'Account to record payments into a payment processor merchant account', '1150', 'BANK', 0, 1, 0, 0);
-- CRM-10926
SELECT @option_value_rel_id_exp := value FROM `civicrm_option_value` WHERE `option_group_id` = @option_group_id_arel AND `name` = 'Expense Account is';
{* file to handle db changes in 4.4.3 during upgrade *}
+{include file='../CRM/Upgrade/4.4.3.msg_template/civicrm_msg_template.tpl'}
+
+-- CRM-13420
+UPDATE civicrm_option_value
+INNER JOIN civicrm_option_group ON civicrm_option_value.option_group_id = civicrm_option_group.id
+SET civicrm_option_value.is_default = 1
+WHERE civicrm_option_group.name = 'payment_instrument' AND civicrm_option_value.name = 'Check';
\ No newline at end of file
// TODO: Split up; this was copied verbatim from CiviCRM 4.0's multi-UF theming function
// but the parts should be copied into cleaner subclass implementations
- if (function_exists('theme') && !$print) {
+ $config = CRM_Core_Config::singleton();
+ if (
+ $config->userSystem->is_drupal &&
+ function_exists('theme') &&
+ !$print
+ ) {
if ($maintenance) {
drupal_set_breadcrumb('');
drupal_maintenance_theme();
$out = $content;
$config = &CRM_Core_Config::singleton();
- if (!$print &&
+ if (
+ !$print &&
$config->userFramework == 'WordPress'
) {
if (is_admin()) {
}
}
+
/**
* Get timezone from CMS
* @return boolean|string
*/
+ /**
+ * Get timezone from Drupal
+ * @return boolean|string
+ */
function getTimeZoneOffset(){
+ $timezone = $this->getTimeZoneString();
+ if($timezone){
+ $tzObj = new DateTimeZone($timezone);
+ $dateTime = new DateTime("now", $tzObj);
+ $tz = $tzObj->getOffset($dateTime);
+
+ if(empty($tz)){
+ return false;
+ }
+
+ $timeZoneOffset = sprintf("%02d:%02d", $tz / 3600, ($tz/60)%60 );
+
+ if($timeZoneOffset > 0){
+ $timeZoneOffset = '+' . $timeZoneOffset;
+ }
+ return $timeZoneOffset;
+ }
+ }
+
+ /**
+ * Over-ridable function to get timezone as a string eg.
+ * @return string Timezone e.g. 'America/Los_Angeles'
+ */
+ function getTimeZoneString() {
+ return NULL;
}
}
}
require_once ($cmsRootPath . DIRECTORY_SEPARATOR . 'wp-load.php');
+ $wpUserTimezone = get_option('timezone_string');
+ if ($wpUserTimezone) {
+ date_default_timezone_set($wpUserTimezone);
+ CRM_Core_Config::singleton()->userSystem->setMySQLTimeZone();
+ }
return true;
}
return 'Unknown';
}
}
+
+ /**
+ * get timezone as a string
+ * @return string Timezone e.g. 'America/Los_Angeles'
+ */
+ function getTimeZoneString() {
+ return get_option('timezone_string');
+ }
}
* {@getfields action_schedule_create}
*/
function civicrm_api3_action_schedule_create($params) {
+ if (!CRM_Utils_Array::value('id', $params)) {
+ // an update does not require any mandatory parameters
+ civicrm_api3_verify_one_mandatory($params,
+ NULL,
+ array(
+ 'title','mapping_id', 'entity_status', 'entity_value',
+ )
+ );
+ }
+
$ids = array();
if (isset($params['id']) && !CRM_Utils_Rule::integer($params['id'])) {
return civicrm_api3_create_error('Invalid value for ID');
*/
function civicrm_api3_action_schedule_delete($params) {
return _civicrm_api3_basic_delete(_civicrm_api3_get_BAO(__FUNCTION__), $params);
-}
\ No newline at end of file
+}
+
+
}
if (CRM_Utils_Array::value('contact_sub_type', $params)) {
- $where .= " AND cc.contact_sub_type = \"{$params['contact_sub_type']}\" ";
+ $contactSubType = CRM_Utils_Type::escape($params['contact_sub_type'], 'String');
+ $where .= " AND cc.contact_sub_type = '{$contactSubType}'";
}
//set default for current_employer or return contact with particular id
'contact_id' => '1',
'financial_type_id' => '1',
'contribution_page_id' => '1',
- 'payment_instrument_id' => '',
+ 'payment_instrument_id' => '4',
'receive_date' => '20120511000000',
'non_deductible_amount' => '',
'total_amount' => '100',
if (is_null($bao)) {
return civicrm_api3_create_error('Entity not created (' . $fct_name . ')');
}
+ elseif (is_a($bao, 'CRM_Core_Error')) {
+ //some wierd circular thing means the error takes itself as an argument
+ $msg = $bao->getMessages($bao);
+ // the api deals with entities on a one-by-one basis. However, the contribution bao pushes entities
+ // onto the error object - presumably because the contribution import is not handling multiple errors correctly
+ // so we need to reset the error object here to avoid getting concatenated errors
+ //@todo - the mulitple error handling should be moved out of the contribution object to the import / multiple entity processes
+ CRM_Core_Error::singleton()->reset();
+ throw new API_Exception($msg);
+ }
else {
$values = array();
_civicrm_api3_object_to_array($bao, $values[$bao->id]);
if (!$this->errors) {
global $installType, $installURLPath;
+ $registerSiteURL = "http://civicrm.org/civicrm/profile/create?reset=1&gid=15";
+ $commonOutputMessage = "
+ <li> Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to <a href='$registerSiteURL' target='_blank'>fill out the site registration form</a>. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).</li>
+ <li>We have integrated KCFinder with CKEditor and TinyMCE. This allows a user to upload images. All uploaded images are public.</li>
+";
+
$output = NULL;
if (
$installType == 'drupal' &&
$drupalURL = civicrm_cms_base();
$drupalPermissionsURL = "{$drupalURL}index.php?q=admin/people/permissions";
$drupalURL .= "index.php?q=civicrm/admin/configtask&reset=1";
- $registerSiteURL = "http://civicrm.org/civicrm/profile/create?reset=1&gid=15";
$output .= "<li>Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you <a target='_blank' href={$drupalPermissionsURL}>review these permissions</a> to ensure that they are appropriate for your requirements (<a target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'>learn more...</a>)</li>
<li>Use the <a target='_blank' href=\"$drupalURL\">Configuration Checklist</a> to review and configure settings for your new site</li>
- <li> Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to <a href='$registerSiteURL' target='_blank'>fill out the site registration form</a>. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).</li>
- <li>We have integrated KCFinder with CKEditor and TinyMCE, which enables user to upload images. Note that all the images uploaded using KCFinder will be public.</li>";
+ {$commonOutputMessage}";
// automatically enable CiviCRM module once it is installed successfully.
// so we need to Bootstrap Drupal, so that we can call drupal hooks.
$drupalURL = civicrm_cms_base();
$drupalPermissionsURL = "{$drupalURL}index.php?q=admin/user/permissions";
$drupalURL .= "index.php?q=civicrm/admin/configtask&reset=1";
- $registerSiteURL = "http://civicrm.org/civicrm/profile/create?reset=1&gid=15";
$output .= "<li>Drupal user permissions have been automatically set - giving anonymous and authenticated users access to public CiviCRM forms and features. We recommend that you <a target='_blank' href={$drupalPermissionsURL}>review these permissions</a> to ensure that they are appropriate for your requirements (<a target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'>learn more...</a>)</li>
<li>Use the <a target='_blank' href=\"$drupalURL\">Configuration Checklist</a> to review and configure settings for your new site</li>
- <li> Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to <a href='$registerSiteURL' target='_blank'>fill out the site registration form</a>. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).</li>
- <li>We have integrated KCFinder with CKEditor and TinyMCE, which enables user to upload images. Note that all the images uploaded using KCFinder will be public.</li>";
+ {$commonOutputMessage}";
// explicitly setting error reporting, since we cannot handle drupal related notices
error_reporting(1);
$cmsURL = civicrm_cms_base();
$cmsURL .= "wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/configtask&reset=1";
- $registerSiteURL = "http://civicrm.org/civicrm/profile/create?reset=1&gid=15";
-
- echo "<li>Use the <a target='_blank' href=\"$cmsURL\">Configuration Checklist</a> to review and configure settings for your new site</li>
- <li> Have you registered this site at CiviCRM.org? If not, please help strengthen the CiviCRM ecosystem by taking a few minutes to <a href='$registerSiteURL' target='_blank'>fill out the site registration form</a>. The information collected will help us prioritize improvements, target our communications and build the community. If you have a technical role for this site, be sure to check Keep in Touch to receive technical updates (a low volume mailing list).</li>
- <li>We have integrated KCFinder with CKEditor and TinyMCE, which enables user to upload images. Note that all the images uploaded using KCFinder will be public.</li>";
- echo '</ul>';
- echo '</div>';
- }
- }
+ $wpPermissionsURL = "wp-admin/admin.php?page=CiviCRM&q=civicrm/admin/access/wp-permissions&reset=1";
+
+ $output .= "
+ <li>WordPress user permissions have been automatically set - giving Anonymous and Subscribers access to public CiviCRM forms and features. We recommend that you <a target='_blank' href={$wpPermissionsURL}>review these permissions</a> to ensure that they are appropriate for your requirements (<a target='_blank' href='http://wiki.civicrm.org/confluence/display/CRMDOC/Default+Permissions+and+Roles'>learn more...</a>)</li>
+ <li>Use the <a target='_blank' href=\"$cmsURL\">Configuration Checklist</a> to review and configure settings for your new site</li>
+ {$commonOutputMessage}
+";
+
+ echo '</ul>';
+ echo '</div>';
+ }
+ }
return $this->errors;
}
'description' => null,
'help_text' => null,
),
+ 'blogUrl' => array(
+ 'group_name' => 'CiviCRM Preferences',
+ 'group' => 'core',
+ 'name' => 'blogUrl',
+ 'prefetch' => 0,
+ 'config_only'=> 0,
+ 'type' => 'String',
+ 'quick_form_type' => 'Element',
+ 'html_type' => 'text',
+ 'html_attributes' => array(
+ 'size' => 64,
+ 'maxlength' => 128,
+ ),
+ 'html_type' => 'Text',
+ 'default' => '*default*',
+ 'add' => '4.3',
+ 'title' => 'Blog Feed URL',
+ 'is_domain' => 1,
+ 'is_contact' => 0,
+ 'description' => 'Blog feed URL used by the blog dashlet',
+ 'help_text' => 'Use "*default*" for the system default or override with a custom URL',
+ ),
'communityMessagesUrl' => array(
'group_name' => 'CiviCRM Preferences',
'group' => 'core',
{literal}
<script type='text/javascript'>
+ cj(function($) {
+ $().crmAccordions();
+ });
var entityMapping = eval({/literal}{$entityMapping}{literal});
var recipientMapping = eval({/literal}{$recipientMapping}{literal});
</tr>
<tr class="crm-contribution-form-block-payment_instrument_id">
<td class="label">{$form.payment_instrument_id.label}</td>
- <td {$valueStyle}>{$form.payment_instrument_id.html}<br />
- <span class="description">{ts}Leave blank for non-monetary contributions.{/ts}</span>
+ <td {$valueStyle}>{$form.payment_instrument_id.html} {help id="payment_instrument_id"}</td>
</td>
</tr>
{if $showCheckNumber || !$isOnline}
{ts}Select the appropriate financial type for this transaction.{/ts}
{/htxt}
+{htxt id="payment_instrument_id-title"}
+ {ts}Payment Instrument{/ts}
+{/htxt}
+{htxt id="payment_instrument_id"}
+ <p>
+ {ts}Choose the method by which this transaction was paid.{/ts}
+ </p><p>
+ {ts}Note: if the correct payment instrument is not listed here (e.g. for in-kind donations) ask your administrator to add a new option to this list.{/ts}
+ </p>
+
+{/htxt}
+
{htxt id="id-trans_id-title"}
{ts}Transaction ID{/ts}
{/htxt}
<td class="label" >{$form.receive_date.label}</td>
<td>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}</td>
</tr>
- <tr class="crm-event-eventfees-form-block-payment_instrument_id"><td class="label">{$form.payment_instrument_id.label}</td><td>{$form.payment_instrument_id.html}</td></tr>
+ <tr class="crm-event-eventfees-form-block-payment_instrument_id"><td class="label">{$form.payment_instrument_id.label}<span class="marker"> *</span></td><td>{$form.payment_instrument_id.html} {help id="payment_instrument_id" file="CRM/Contribute/Page/Tab.hlp"}</td></tr>
<tr id="checkNumber" class="crm-event-eventfees-form-block-check_number"><td class="label">{$form.check_number.label}</td><td>{$form.check_number.html|crmAddClass:six}</td></tr>
{if $showTransactionId }
<tr class="crm-event-eventfees-form-block-trxn_id"><td class="label">{$form.trxn_id.label}</td><td>{$form.trxn_id.html}</td></tr>
<td>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}</td>
</tr>
<tr class="crm-membership-form-block-payment_instrument_id">
- <td class="label">{$form.payment_instrument_id.label}</td>
- <td>{$form.payment_instrument_id.html}</td>
+ <td class="label">{$form.payment_instrument_id.label}<span class="marker"> *</span></td>
+ <td>{$form.payment_instrument_id.html} {help id="payment_instrument_id" file="CRM/Contribute/Page/Tab.hlp"}</td>
</tr>
<tr id="checkNumber" class="crm-membership-form-block-check_number">
<td class="label">{$form.check_number.label}</td>
<td>{include file="CRM/common/jcalendar.tpl" elementName=receive_date}</td>
</tr>
<tr class="crm-member-membershiprenew-form-block-payment_instrument_id">
- <td class="label">{$form.payment_instrument_id.label}</td>
- <td>{$form.payment_instrument_id.html}</td>
+ <td class="label">{$form.payment_instrument_id.label}<span class='marker'>*</span></td>
+ <td>{$form.payment_instrument_id.html} {help id="payment_instrument_id" file="CRM/Contribute/Page/Tab.hlp"}</td>
</tr>
<tr id="checkNumber" class="crm-member-membershiprenew-form-block-check_number">
<td class="label">{$form.check_number.label}</td>
+--------------------------------------------------------------------+
*}
{* CiviMember DashBoard (launch page) *}
-<h3>{ts}Membership Summary{/ts} {help id="id-member-intro"}</h3>
-<table class="report">
+{if $membershipSummary}
+ <h3>{ts}Membership Summary{/ts} {help id="id-member-intro"}</h3>
+ <table class="report">
<tr class="columnheader-dark">
<th scope="col" rowspan="2">{ts}Members by Type{/ts}</th>
{if $preMonth}
{$year} {ts 1=$month}through %1{/ts}
{/if}
</th>
- <th scope="col" rowspan="2">
- {if $isCurrent}
- {ts}Current #{/ts}
- {else}
- {ts 1=$month 2=$year}Members as of %1 %2{/ts}
- {/if}
- </th>
+ <th scope="col" rowspan="2">
+ {if $isCurrent}
+ {ts}Current #{/ts}
+ {else}
+ {ts 1=$month 2=$year}Members as of %1 %2{/ts}
+ {/if}
+ </th>
</tr>
<tr class="columnheader-dark">
<a href="{$row.premonth.total.url}" title="view details">{$row.premonth.total.count}</a>
{else}
{$row.premonth.total.count}
- {/if} [
+ {/if} [
{if $row.premonth_owner.premonth_owner.url}
<a href="{$row.premonth_owner.premonth_owner.url}" title="view details">{$row.premonth_owner.premonth_owner.count}</a>
{else}
<a href="{$row.month.total.url}" title="view details">{$row.month.total.count}</a>
{else}
{$row.month.total.count}
- {/if} [
+ {/if} [
{if $row.month_owner.month_owner.url}
<a href="{$row.month_owner.month_owner.url}" title="view details">{$row.month_owner.month_owner.count}</a>
{else}
<a href="{$row.year.total.url}" title="view details">{$row.year.total.count}</a>
{else}
{$row.year.total.count}
- {/if} [
+ {/if} [
{if $row.year_owner.year_owner.url}
<a href="{$row.year_owner.year_owner.url}" title="view details">{$row.year_owner.year_owner.count}</a>
{else}
<a href="{$totalCount.premonth.total.url}" title="view details">{$totalCount.premonth.total.count}</a>
{else}
{$totalCount.premonth.total.count}
- {/if} [
+ {/if} [
{if $totalCount.premonth_owner.premonth_owner.url}
<a href="{$totalCount.premonth_owner.premonth_owner.url}" title="view details">{$totalCount.premonth_owner.premonth_owner.count}</a>
{else}
<a href="{$totalCount.month.total.url}" title="view details">{$totalCount.month.total.count}</a>
{else}
{$totalCount.month.total.count}
- {/if} [
+ {/if} [
{if $totalCount.month_owner.month_owner.url}
<a href="{$totalCount.month_owner.month_owner.url}" title="view details">{$totalCount.month_owner.month_owner.count}</a>
{else}
<a href="{$totalCount.year.total.url}" title="view details">{$totalCount.year.total.count}</a>
{else}
{$totalCount.year.total.count}
- {/if} [
+ {/if} [
{if $totalCount.year_owner.year_owner.url}
<a href="{$totalCount.year_owner.year_owner.url}" title="view details">{$totalCount.year_owner.year_owner.count}</a>
{else}
<tr><td colspan='11'>
Primary member counts (those who "own" the membership rather than receiving via relationship) are in [brackets].
</td></tr>
-</table>
-
+ </table>
+{/if}
<div class="spacer"></div>
{if $rows}
{* if $pager->_totalItems *}
- <h3>{ts}Recent Memberships{/ts}</h3>
- <div class="form-item">
- { include file="CRM/Member/Form/Selector.tpl" context="dashboard" }
- </div>
+ <h3>{ts}Recent Memberships{/ts}</h3>
+ <div class="form-item">
+ { include file="CRM/Member/Form/Selector.tpl" context="dashboard" }
+ </div>
{* /if *}
{/if}
protected $_apiversion = 3;
public $_eNoticeCompliant = TRUE;
+
/**
* Test setup for every test
*
}
- function testActionScheduleCreate() {
-
+ function testSimpleActionScheduleCreate() {
$oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
+ $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
+ $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
+ $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
+ $scheduledStatus = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
+ $mappingId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value');
+ $activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', "Meeting", 'name');
+ $title = "simpleActionSchedule".substr(sha1(rand()), 0, 7);
$params = array(
- 'title' => 'simpleAction',
- 'entity_value' => '46',
+ 'title' => $title,
+ 'recipient' => $assigneeID,
+ 'limit_to' => 1,
+ 'entity_value' => $activityTypeId,
+ 'entity_status' => $scheduledStatus,
+ 'is_active' => 1,
+ 'record_activity' => 1,
+ 'mapping_id' => $mappingId,
);
-
$actionSchedule = $this->callAPISuccess('action_schedule', 'create', $params);
$this->assertTrue(is_numeric($actionSchedule['id']), "In line " . __LINE__);
$this->assertTrue($actionSchedule['id'] > 0, "In line " . __LINE__);
$newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
$this->assertEquals($oldCount+1, $newCount);
-
}
-
+
+ /**
+ * check if required fields are not passed
+ */
+ function testActionScheduleCreateWithoutRequired() {
+ $params = array(
+ 'subject' => 'this case should fail',
+ 'scheduled_date_time' => date('Ymd'),
+ );
+ $result = $this->callAPIFailure('activity', 'create', $params);
+ }
+
+ function testActionScheduleWithScheduledDatesCreate() {
+ $oldCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
+ $activityContacts = CRM_Core_OptionGroup::values('activity_contacts', FALSE, FALSE, FALSE, NULL, 'name');
+ $assigneeID = CRM_Utils_Array::key('Activity Assignees', $activityContacts);
+ $targetID = CRM_Utils_Array::key('Activity Targets', $activityContacts);
+ $scheduledStatus = CRM_Core_OptionGroup::getValue('activity_status', 'Scheduled', 'name');
+ $mappingId = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_ActionMapping', 'activity_type', 'id', 'entity_value');
+ $activityTypeId = CRM_Core_OptionGroup::getValue('activity_type', "Meeting", 'name');
+ $title = "simpleActionSchedule".substr(sha1(rand()), 0, 7);
+ $params = array(
+ 'title' => $title,
+ 'recipient' => $assigneeID,
+ 'limit_to' => 1,
+ 'entity_value' => $activityTypeId,
+ 'entity_status' => $scheduledStatus,
+ 'is_active' => 1,
+ 'record_activity' => 1,
+ 'mapping_id' => $mappingId,
+ 'start_action_offset' => 3,
+ 'start_action_unit' => 'day',
+ 'start_action_condition' => 'before',
+ 'start_action_date' => 'activity_date_time',
+ 'is_repeat' => 1,
+ 'repetition_frequency_unit'=> 'day',
+ 'repetition_frequency_interval' => 3,
+ 'end_frequency_unit' => 'hour',
+ 'end_frequency_interval' => 0,
+ 'end_action' => 'before',
+ 'end_date' => 'activity_date_time',
+ 'body_html' => 'Test description',
+ 'subject' => 'Test subject'
+ );
+ $actionSchedule = $this->callAPISuccess('action_schedule', 'create', $params);
+ $this->assertTrue(is_numeric($actionSchedule['id']), "In line " . __LINE__);
+ $this->assertTrue($actionSchedule['id'] > 0, "In line " . __LINE__);
+ $this->assertEquals($actionSchedule['values'][$actionSchedule['id']]['start_action_offset'][0], $params['start_action_offset']);
+ $newCount = CRM_Core_DAO::singleValueQuery('select count(*) from civicrm_action_schedule');
+ $this->assertEquals($oldCount+1, $newCount);
+
+ }
}
$this->assertAPISuccess($result);
$contributionId = $result['id'];
$expectedResult = contribution_create_expectedresult();
- $this->checkArrayEquals($result, $expectedResult);
+ $this->checkArrayEquals($expectedResult, $result);
$this->contributionDelete($contributionId);
}
);
$contribution = $this->callAPISuccess('contribution', 'update', $newParams);
$this->assertAPISuccess($contribution);
- $this->_checkFinancialTrxn($contribution, 'paymentInstrument');
+ $this->_checkFinancialTrxn($contribution, 'paymentInstrument', $instrumentId);
}
/*
}
}
- function _checkFinancialTrxn($contribution, $context) {
+ function _checkFinancialTrxn($contribution, $context, $instrumentId = NULL) {
$trxnParams = array(
'entity_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
'from_financial_account_id' => CRM_Contribute_PseudoConstant::financialAccountType($contribution['financial_type_id'], $relationTypeId),
);
}
- elseif ($context == 'paymentInstrument') {
- $compareParams = array(
- 'from_financial_account_id' => 6,
- 'to_financial_account_id' => 7,
- );
- }
elseif ($context == 'refund') {
$compareParams = array(
'to_financial_account_id' => 6,
'status_id' => 3,
);
}
- elseif ($context == 'changeFinancial') {
+ elseif ($context == 'changeFinancial' || $context == 'paymentInstrument') {
$entityParams = array(
'entity_id' => $contribution['id'],
'entity_table' => 'civicrm_contribution',
'id' => $trxn['financial_trxn_id'],
);
$compareParams = array(
- 'to_financial_account_id' => 12,
'total_amount' => -100,
'status_id' => 1,
);
+ if ($context == 'paymentInstrument') {
+ $compareParams += array(
+ 'to_financial_account_id' => CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount(4),
+ 'payment_instrument_id' => 4,
+ );
+ }
+ else {
+ $compareParams['to_financial_account_id'] = 12;
+ }
$this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $trxnParams1, $compareParams);
- $compareParams = array(
- 'to_financial_account_id' => 12,
- 'total_amount' => 100,
- 'status_id' => 1,
- );
+ $compareParams['total_amount'] = 100;
+ if ($context == 'paymentInstrument') {
+ $compareParams['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($instrumentId);
+ $compareParams['payment_instrument_id'] = $instrumentId;
+ }
+ else {
+ $compareParams['to_financial_account_id'] = 12;
+ }
}
$this->assertDBCompareValues('CRM_Financial_DAO_FinancialTrxn', $params, $compareParams);
</primaryKey>
<field>
<name>title</name>
+ <title>Contribution Page Title</title>
<type>varchar</type>
<length>255</length>
<localizable>true</localizable>
</field>
<field>
<name>intro_text</name>
+ <title>Contribution Page Introduction Text</title>
<type>text</type>
<htmlType>textarea</htmlType>
<rows>6</rows>
</field>
<field>
<name>honor_block_title</name>
+ <title>Contribution Page Honor Block Title</title>
<type>varchar</type>
<length>255</length>
<localizable>true</localizable>
</field>
<field>
<name>honor_block_text</name>
+ <title>Contribution Page Honor Block Text</title>
<type>text</type>
<htmlType>textarea</htmlType>
<rows>2</rows>
</field>
<field>
<name>created_id</name>
+ <title>Contribution Page Created By</title>
<type>int unsigned</type>
<comment>FK to civicrm_contact, who created this contribution page</comment>
<add>3.0</add>
</field>
<field>
<name>currency</name>
+ <title>Contribution Page Currency</title>
<type>varchar</type>
<length>3</length>
<default>NULL</default>
</field>
<field>
<name>campaign_id</name>
+ <title>Contribution Page Campaign ID</title>
<type>int unsigned</type>
<comment>The campaign for which we are collecting contributions with this page.</comment>
<add>3.4</add>
</foreignKey>
<field>
<name>is_share</name>
+ <title>Is Contribution Page Shared?</title>
<type>boolean</type>
<default>1</default>
<comment>Can people share the contribution page through social media?</comment>
<default>1</default>
<import>true</import>
<add>1.6</add>
+ <pseudoconstant>
+ <optionGroupName>contribution_status</optionGroupName>
+ </pseudoconstant>
</field>
<index>
<name>index_contribution_status</name>
<type>int unsigned</type>
<comment>FK to Financial Type</comment>
<add>4.3</add>
+ <pseudoconstant>
+ <table>civicrm_financial_type</table>
+ <keyColumn>id</keyColumn>
+ <labelColumn>name</labelColumn>
+ </pseudoconstant>
</field>
<foreignKey>
<name>financial_type_id</name>
(@option_group_id_acc, 'Amex' , 3, 'Amex' , NULL, 0, NULL, 3, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_acc, 'Discover' , 4, 'Discover' , NULL, 0, NULL, 4, NULL, 0, 0, 1, NULL, NULL),
- (@option_group_id_pi, '{ts escape="sql"}Credit Card{/ts}', 1, 'Credit Card', NULL, 0, NULL, 1, NULL, 0, 1, 1, NULL, NULL),
- (@option_group_id_pi, '{ts escape="sql"}Debit Card{/ts}', 2, 'Debit Card', NULL, 0, NULL, 2, NULL, 0, 1, 1, NULL, NULL),
- (@option_group_id_pi, '{ts escape="sql"}Cash{/ts}', 3, 'Cash', NULL, 0, NULL, 3, NULL, 0, 0, 1, NULL, NULL),
- (@option_group_id_pi, '{ts escape="sql"}Check{/ts}', 4, 'Check', NULL, 0, NULL, 4, NULL, 0, 1, 1, NULL, NULL),
- (@option_group_id_pi, '{ts escape="sql"}EFT{/ts}', 5, 'EFT', NULL, 0, NULL, 5, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_pi, '{ts escape="sql"}Credit Card{/ts}', 1, 'Credit Card', NULL, 0, 0, 1, NULL, 0, 1, 1, NULL, NULL),
+ (@option_group_id_pi, '{ts escape="sql"}Debit Card{/ts}', 2, 'Debit Card', NULL, 0, 0, 2, NULL, 0, 1, 1, NULL, NULL),
+ (@option_group_id_pi, '{ts escape="sql"}Cash{/ts}', 3, 'Cash', NULL, 0, 0, 3, NULL, 0, 0, 1, NULL, NULL),
+ (@option_group_id_pi, '{ts escape="sql"}Check{/ts}', 4, 'Check', NULL, 0, 1, 4, NULL, 0, 1, 1, NULL, NULL),
+ (@option_group_id_pi, '{ts escape="sql"}EFT{/ts}', 5, 'EFT', NULL, 0, 0, 5, NULL, 0, 0, 1, NULL, NULL),
(@option_group_id_cs, '{ts escape="sql"}Completed{/ts}' , 1, 'Completed' , NULL, 0, NULL, 1, NULL, 0, 1, 1, NULL, NULL),
(@option_group_id_cs, '{ts escape="sql"}Pending{/ts}' , 2, 'Pending' , NULL, 0, NULL, 2, NULL, 0, 1, 1, NULL, NULL),
<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 $isOnWaitlist}waitlisted{else}registered{/if}</strong> for the following:</p>
+ <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> for the following:</p>
{/if}
{$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} for the following:
+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} for the following:
{/if}