*
* Generated from xml/schema/CRM/ACL/ACL.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:fa7ab50bdcacf98f9b1b043f912fed47)
+ * (GenCodeChecksum:b4b1db29de0700887b7875f82d079c10)
*/
/**
*
* Generated from xml/schema/CRM/ACL/ACLCache.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4776199edbbb83ae58a37f1b056bf86a)
+ * (GenCodeChecksum:9676dd799030fb9b56b490595dd3a847)
*/
/**
*
* Generated from xml/schema/CRM/ACL/EntityRole.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:53e459e0bbdca49556b59c10aee21862)
+ * (GenCodeChecksum:ec91adfcc1d76814541811d4b97e45b2)
*/
/**
*
* Generated from xml/schema/CRM/Activity/Activity.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4291bcd82f8d55861172be9d2a8243de)
+ * (GenCodeChecksum:cabeb52f5da37045929bb3e0b7748992)
*/
/**
*
* Generated from xml/schema/CRM/Activity/ActivityContact.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4b08cccd27b433486baf2b9eea79f97e)
+ * (GenCodeChecksum:3f147b2507b1e11a7df971be191161d1)
*/
/**
/**
* Mapping from tokenName to api return field
- * Use lists since we might need multiple fields
+ * Using arrays allows more complex tokens to be handled that require more than one API field.
+ * For example, an address token might want ['street_address', 'city', 'postal_code']
*
* @var array
*/
// Get ActivityID either from actionSearchResult (for scheduled reminders) if exists
$activityId = $row->context['actionSearchResult']->entityID ?? $row->context[$this->getEntityContextSchema()];
- $activity = (object) $prefetch['activity'][$activityId];
+ $activity = $prefetch['activity'][$activityId];
if (in_array($field, ['activity_date_time', 'created_date', 'modified_date'])) {
- $row->tokens($entity, $field, \CRM_Utils_Date::customFormat($activity->$field));
+ $row->tokens($entity, $field, \CRM_Utils_Date::customFormat($activity[$field]));
}
- elseif (isset($mapping[$field]) and (isset($activity->{$mapping[$field]}))) {
- $row->tokens($entity, $field, $activity->{$mapping[$field]});
+ elseif (isset($mapping[$field]) and (isset($activity[$mapping[$field]]))) {
+ $row->tokens($entity, $field, $activity[$mapping[$field]]);
}
elseif (in_array($field, ['activity_type'])) {
- $row->tokens($entity, $field, $this->activityTypes[$activity->activity_type_id]);
+ $row->tokens($entity, $field, $this->activityTypes[$activity['activity_type_id']]);
}
elseif (in_array($field, ['status'])) {
- $row->tokens($entity, $field, $this->activityStatuses[$activity->status_id]);
+ $row->tokens($entity, $field, $this->activityStatuses[$activity['status_id']]);
}
elseif (in_array($field, ['campaign'])) {
- $row->tokens($entity, $field, $this->campaigns[$activity->campaign_id]);
+ $row->tokens($entity, $field, $this->campaigns[$activity['campaign_id']]);
}
elseif (in_array($field, ['case_id'])) {
// An activity can be linked to multiple cases so case_id is always an array.
// We just return the first case ID for the token.
- $row->tokens($entity, $field, is_array($activity->case_id) ? reset($activity->case_id) : $activity->case_id);
+ $row->tokens($entity, $field, is_array($activity['case_id']) ? reset($activity['case_id']) : $activity['case_id']);
}
elseif (array_key_exists($field, $this->customFieldTokens)) {
$row->tokens($entity, $field,
- isset($activity->$field)
- ? \CRM_Core_BAO_CustomField::displayValue($activity->$field, $field)
+ isset($activity[$field])
+ ? \CRM_Core_BAO_CustomField::displayValue($activity[$field], $field)
: ''
);
}
- elseif (isset($activity->$field)) {
- $row->tokens($entity, $field, $activity->$field);
+ elseif (isset($activity[$field])) {
+ $row->tokens($entity, $field, $activity[$field]);
}
}
$this->deleteMessage = ts('Deleting this Payment Processor may result in some transaction pages being rendered inactive.') . ' ' . ts('Do you want to continue?');
}
+ /**
+ * Preprocess the form.
+ *
+ * @throws \CRM_Core_Exception
+ */
public function preProcess() {
parent::preProcess();
- if ($this->_id) {
- $this->_paymentProcessorType = CRM_Utils_Request::retrieve('pp', 'String', $this, FALSE, NULL);
- if (!$this->_paymentProcessorType) {
- $this->_paymentProcessorType = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor',
- $this->_id,
- 'payment_processor_type_id'
- );
- }
- $this->set('pp', $this->_paymentProcessorType);
- }
- else {
- $this->_paymentProcessorType = CRM_Utils_Request::retrieve('pp', 'String', $this, TRUE, NULL);
- }
-
+ $this->setPaymentProcessorTypeID();
+ $this->setPaymentProcessor();
$this->assign('ppType', $this->_paymentProcessorType);
- $ppTypeName = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessorType',
- $this->_paymentProcessorType,
- 'name'
- );
- $this->assign('ppTypeName', $ppTypeName);
-
- $this->_paymentProcessorDAO = new CRM_Financial_DAO_PaymentProcessorType();
- $this->_paymentProcessorDAO->id = $this->_paymentProcessorType;
-
- $this->_paymentProcessorDAO->find(TRUE);
+ $this->assign('ppTypeName', $this->_paymentProcessorDAO->name);
if ($this->_id) {
$refreshURL = CRM_Utils_System::url('civicrm/admin/paymentProcessor',
*
* @return bool
*/
- public static function checkSection(&$fields, &$errors, $section = NULL) {
+ public static function checkSection(&$fields, &$errors, $section = NULL): bool {
$names = ['user_name'];
$present = FALSE;
civicrm_api3('PaymentProcessor', 'create', $params);
}
+ /**
+ * Set the payment processor type id as a form property
+ *
+ * @throws \CRM_Core_Exception
+ */
+ protected function setPaymentProcessorTypeID(): void {
+ if ($this->_id) {
+ $this->_paymentProcessorType = CRM_Utils_Request::retrieve('pp', 'String', $this, FALSE, NULL);
+ if (!$this->_paymentProcessorType) {
+ $this->_paymentProcessorType = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_PaymentProcessor',
+ $this->_id,
+ 'payment_processor_type_id'
+ );
+ }
+ $this->set('pp', $this->_paymentProcessorType);
+ }
+ else {
+ $this->_paymentProcessorType = CRM_Utils_Request::retrieve('pp', 'String', $this, TRUE, NULL);
+ }
+ }
+
+ /**
+ * Get the relevant payment processor type id.
+ *
+ * @return int
+ */
+ protected function getPaymentProcessorTypeID(): int {
+ return (int) $this->_paymentProcessorType;
+ }
+
+ /**
+ * Set the payment processor as a form property.
+ */
+ protected function setPaymentProcessor(): void {
+ $this->_paymentProcessorDAO = new CRM_Financial_DAO_PaymentProcessorType();
+ $this->_paymentProcessorDAO->id = $this->getPaymentProcessorTypeID();
+ $this->_paymentProcessorDAO->find(TRUE);
+ }
+
}
'countryLimit' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME,
'customTranslateFunction' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME,
'defaultContactCountry' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME,
+ 'pinnedContactCountries' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME,
'defaultContactStateProvince' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME,
'defaultCurrency' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME,
'fieldSeparator' => CRM_Core_BAO_Setting::LOCALIZATION_PREFERENCES_NAME,
// build list of available downloads
$remoteExtensionRows = [];
$compat = CRM_Extension_System::getCompatibilityInfo();
+ $mapper = CRM_Extension_System::singleton()->getMapper();
foreach ($remoteExtensions as $info) {
if (!empty($compat[$info->key]['obsolete'])) {
if (isset($localExtensionRows[$info->key])) {
if (array_key_exists('version', $localExtensionRows[$info->key])) {
if (version_compare($localExtensionRows[$info->key]['version'], $info->version, '<')) {
- $row['is_upgradeable'] = TRUE;
+ $row['upgradelink'] = $mapper->getUpgradeLink($remoteExtensions[$info->key], $localExtensionRows[$info->key]);
}
}
}
$this->assign('canEditSystemTemplates', CRM_Core_Permission::check('edit system workflow message templates'));
$this->assign('canEditMessageTemplates', CRM_Core_Permission::check('edit message templates'));
$this->assign('canEditUserDrivenMessageTemplates', CRM_Core_Permission::check('edit user-driven message templates'));
+ Civi::resources()
+ ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
+ ->addSetting([
+ 'tabSettings' => ['active' => $_GET['selectedChild'] ?? NULL],
+ ]);
}
}
*/
public static function deleteBatch($batchId) {
// delete entry from batch table
- CRM_Utils_Hook::pre('delete', 'Batch', $batchId, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Batch', $batchId);
$batch = new CRM_Batch_DAO_Batch();
$batch->id = $batchId;
$batch->delete();
*
* Generated from xml/schema/CRM/Batch/Batch.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f37d12b3bc0d6b5efc4768f210a45a3c)
+ * (GenCodeChecksum:717006044703500afc7d4f45f63194df)
*/
/**
*
* Generated from xml/schema/CRM/Batch/EntityBatch.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:bbeab14232892d3ec8069ef3a499efdd)
+ * (GenCodeChecksum:61cb70a15ffc587cc8476204cb16353f)
*/
/**
return FALSE;
}
- CRM_Utils_Hook::pre('delete', 'Campaign', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Campaign', $id);
$dao = new CRM_Campaign_DAO_Campaign();
$dao->id = $id;
*
* Generated from xml/schema/CRM/Campaign/Campaign.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:8bafee489dc4969a456393ed48544880)
+ * (GenCodeChecksum:c86618236efd91af786b98c3f359e321)
*/
/**
class CRM_Campaign_DAO_Campaign extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '3.3';
+ const COMPONENT = 'CiviCampaign';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Campaign/CampaignGroup.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:210636d218ebf8e84f862c48bbe9edf9)
+ * (GenCodeChecksum:9e8df6e6e1df93fb351b51bcda21c176)
*/
/**
class CRM_Campaign_DAO_CampaignGroup extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '3.3';
+ const COMPONENT = 'CiviCampaign';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Campaign/Survey.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:6f3dd03a11c679278374affba3d2bd76)
+ * (GenCodeChecksum:b324203328e0c8d3dc10a4346a4db6f3)
*/
/**
class CRM_Campaign_DAO_Survey extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '3.2';
+ const COMPONENT = 'CiviCampaign';
/**
* Static instance to hold the table name.
private static $_surveyActionLinks;
private static $_petitionActionLinks;
+ public $_tabs;
+
/**
* Get the action links for this page.
*
];
$subPageType = CRM_Utils_Request::retrieve('type', 'String', $this);
+ // Load the data for a specific tab
if ($subPageType) {
if (!isset($this->_tabs[$subPageType])) {
CRM_Utils_System::permissionDenied();
$this->{'browse' . ucfirst($subPageType)}();
$this->assign('subPageType', ucfirst($subPageType));
}
+ // Initialize tabs
else {
- //build the tabs.
$this->buildTabs();
}
- CRM_Core_Resources::singleton()
- ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
- ->addSetting([
- 'tabSettings' => [
- 'active' => strtolower(CRM_Utils_Array::value('subPage', $_GET, 'campaign')),
- ],
- ]);
}
/**
}
$allTabs['campaign']['class'] = 'livePage';
$this->assign('tabHeader', $allTabs);
+ CRM_Core_Resources::singleton()
+ ->addScriptFile('civicrm', 'templates/CRM/common/TabHeader.js', 1, 'html-header')
+ ->addSetting([
+ 'tabSettings' => [
+ 'active' => strtolower(CRM_Utils_Array::value('subPage', $_GET, 'campaign')),
+ ],
+ ]);
}
}
* is successful
*/
public static function deleteCase($caseId, $moveToTrash = FALSE) {
- CRM_Utils_Hook::pre('delete', 'Case', $caseId, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Case', $caseId);
//delete activities
$activities = self::getCaseActivityDates($caseId);
*
* Generated from xml/schema/CRM/Case/Case.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:bc33a854daf3f695bd92c4bca41ad5b3)
+ * (GenCodeChecksum:8b354d7c2a0e40d82d27cbfd08776c15)
*/
/**
class CRM_Case_DAO_Case extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.8';
+ const COMPONENT = 'CiviCase';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Case/CaseActivity.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:3f39cbc8d1438b9a0cdee0382638bcae)
+ * (GenCodeChecksum:5fc2509491a88a1bd2d8ce808f99a00e)
*/
/**
class CRM_Case_DAO_CaseActivity extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.8';
+ const COMPONENT = 'CiviCase';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Case/CaseContact.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f9da4680a9dc863f5dc6675f5e2fdc0b)
+ * (GenCodeChecksum:8ccb7c478dfa4eb1b3b022eeabc71b79)
*/
/**
class CRM_Case_DAO_CaseContact extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '2.1';
+ const COMPONENT = 'CiviCase';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Case/CaseType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b138422db3438224fef3d477a9e1648a)
+ * (GenCodeChecksum:9151b8db1ff873f31d574b5cdec128ac)
*/
/**
class CRM_Case_DAO_CaseType extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '4.5';
+ const COMPONENT = 'CiviCase';
/**
* Static instance to hold the table name.
}
// finally get menu item for -more- action widget.
+ while (!empty($contextMenu['moreActions'][$values['weight']])) {
+ // Quick & dirty way of handling 2 items with the same weight
+ // without clobbering one.
+ $values['weight']++;
+ }
$contextMenu['moreActions'][$values['weight']] = [
'title' => $values['title'],
'ref' => $values['ref'],
}
// finally get menu item for -more- action widget.
+ while (!empty($contextMenu['otherActions'][$value['weight']])) {
+ // Quick & dirty way of handling 2 items with the same weight
+ // without clobbering one.
+ $value['weight']++;
+ }
$contextMenu['otherActions'][$value['weight']] = [
'title' => $value['title'],
'ref' => $value['ref'],
$obj = new $daoName();
$obj->id = $id;
$obj->find();
- $hookParams = [];
+
if ($obj->fetch()) {
- CRM_Utils_Hook::pre('delete', $type, $id, $hookParams);
+ CRM_Utils_Hook::pre('delete', $type, $id);
$contactId = $obj->contact_id;
$obj->delete();
}
if (!$id || !is_numeric($id)) {
throw new CRM_Core_Exception('Invalid group request attempted');
}
- CRM_Utils_Hook::pre('delete', 'Group', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Group', $id);
$transaction = new CRM_Core_Transaction();
if (CRM_Core_Permission::check('access deleted contacts')) {
if (!$onlyDeleted) {
- $this->_permissionWhereClause = str_replace('( 1 )', '(contact_a.is_deleted = 0)', $this->_permissionWhereClause);
+ $this->_permissionWhereClause .= ' AND (contact_a.is_deleted = 0)';
}
else {
- if ($this->_permissionWhereClause === '( 1 )') {
- $this->_permissionWhereClause = str_replace('( 1 )', '(contact_a.is_deleted)', $this->_permissionWhereClause);
- }
- else {
- $this->_permissionWhereClause .= " AND (contact_a.is_deleted) ";
- }
+ $this->_permissionWhereClause .= " AND (contact_a.is_deleted) ";
}
}
*/
public static function del($id) {
// delete from relationship table
- CRM_Utils_Hook::pre('delete', 'Relationship', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Relationship', $id);
$relationship = self::clearCurrentEmployer($id, CRM_Core_Action::DELETE);
$relationship->delete();
*
* Generated from xml/schema/CRM/Contact/ACLContactCache.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0d21895a5f58ee81f21ae524c86a165c)
+ * (GenCodeChecksum:26fea9c61af7afdc2f3401213e0eab2b)
*/
/**
*
* Generated from xml/schema/CRM/Contact/Contact.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:28e3f64d22175c9d2efea3d1c49196fa)
+ * (GenCodeChecksum:c8000203c94da02a4b215ad1a8f7ed89)
*/
/**
*
* Generated from xml/schema/CRM/Contact/ContactType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ee06613c82c85ea8773dcc16105d2b9b)
+ * (GenCodeChecksum:dfe2f3758a8cf1ad9bd23dfb9e2de671)
*/
/**
*
* Generated from xml/schema/CRM/Contact/DashboardContact.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a5629fa4472b5745ec13703142a66f3f)
+ * (GenCodeChecksum:d65c9f2feca6cd296a047c2f4e2a862c)
*/
/**
*
* Generated from xml/schema/CRM/Contact/Group.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:abbdc0ad43c008e444512d444c537ebf)
+ * (GenCodeChecksum:3648ad60c504d25253ecc5655c629d72)
*/
/**
*
* Generated from xml/schema/CRM/Contact/GroupContact.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ea7c012e774a203b869e0fadec080cab)
+ * (GenCodeChecksum:5c26ac19a56e589da1399e755469229b)
*/
/**
*
* Generated from xml/schema/CRM/Contact/GroupContactCache.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:efae8178ae6bc7c26423501ffb2ba751)
+ * (GenCodeChecksum:db2873674d73776ad753a88082ea072a)
*/
/**
*
* Generated from xml/schema/CRM/Contact/GroupNesting.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:65fe8a838c3cad53df4a76d3f117d99b)
+ * (GenCodeChecksum:0e7931bbaab17bdf66a41f8b912f92f6)
*/
/**
*
* Generated from xml/schema/CRM/Contact/GroupOrganization.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:d70fc21adc9befb2edc9c26f9fbe4457)
+ * (GenCodeChecksum:a16da367f856704d5432044055ed5d16)
*/
/**
*
* Generated from xml/schema/CRM/Contact/Relationship.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:6bff7ab95b9b2b5faa9d547ce5219b92)
+ * (GenCodeChecksum:2046fac3c61cd88a17bf21dfe3e6f970)
*/
/**
*
* Generated from xml/schema/CRM/Contact/RelationshipCache.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:3b42f72f3268d49d99353a8816d9889b)
+ * (GenCodeChecksum:3bee16c8388728d3e391e9dd7c17abb8)
*/
/**
*
* Generated from xml/schema/CRM/Contact/RelationshipType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:376ec7436375e3ccc2ec6687a3d5b526)
+ * (GenCodeChecksum:a3e3c18c34421b3dbcffb17bd313aa17)
*/
/**
*
* Generated from xml/schema/CRM/Contact/SavedSearch.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:64396e21031229c36c11423bb4b92fc5)
+ * (GenCodeChecksum:73251f9c4af0127e2e9fc2770f21869d)
*/
/**
*
* Generated from xml/schema/CRM/Contact/SubscriptionHistory.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:2fc83b2d730e10fe0508fa088b241365)
+ * (GenCodeChecksum:3557b2bfd9b5364ea356c17a7237fd5e)
*/
/**
//relationship contact insert
foreach ($params as $key => $field) {
- list($id, $first, $second) = CRM_Utils_System::explode('_', $key, 3);
+ [$id, $first, $second] = CRM_Utils_System::explode('_', $key, 3);
if (!($first == 'a' && $second == 'b') && !($first == 'b' && $second == 'a')) {
continue;
}
$code = NULL;
if (($code = CRM_Utils_Array::value('code', $newContact['error_message'])) && ($code == CRM_Core_Error::DUPLICATE_CONTACT)) {
- $urls = [];
- // need to fix at some stage and decide if the error will return an
- // array or string, crude hack for now
- if (is_array($newContact['error_message']['params'][0])) {
- $cids = $newContact['error_message']['params'][0];
- }
- else {
- $cids = explode(',', $newContact['error_message']['params'][0]);
- }
-
- foreach ($cids as $cid) {
- $urls[] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $cid, TRUE);
- }
-
- $url_string = implode("\n", $urls);
-
- // If we duplicate more than one record, skip no matter what
- if (count($cids) > 1) {
- $errorMessage = ts('Record duplicates multiple contacts');
- $importRecordParams = [
- $statusFieldName => 'ERROR',
- "${statusFieldName}Msg" => $errorMessage,
- ];
-
- //combine error msg to avoid mismatch between error file columns.
- $errorMessage .= "\n" . $url_string;
- array_unshift($values, $errorMessage);
- $this->updateImportRecord($values[count($values) - 1], $importRecordParams);
- return CRM_Import_Parser::ERROR;
- }
-
- // Params only had one id, so shift it out
- $contactId = array_shift($cids);
- $cid = NULL;
-
- $vals = ['contact_id' => $contactId];
-
- if ($onDuplicate == CRM_Import_Parser::DUPLICATE_REPLACE) {
- civicrm_api('contact', 'delete', $vals);
- $cid = CRM_Contact_BAO_Contact::createProfileContact($formatted, $contactFields, $contactId, NULL, NULL, $formatted['contact_type']);
- }
- elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) {
- $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId);
- }
- elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) {
- $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId);
- }
- // else skip does nothing and just returns an error code.
- if ($cid) {
- $contact = [
- 'contact_id' => $cid,
- ];
- $defaults = [];
- $newContact = CRM_Contact_BAO_Contact::retrieve($contact, $defaults);
- }
-
- if (civicrm_error($newContact)) {
- if (empty($newContact['error_message']['params'])) {
- // different kind of error other than DUPLICATE
- $errorMessage = $newContact['error_message'];
- array_unshift($values, $errorMessage);
- $importRecordParams = [
- $statusFieldName => 'ERROR',
- "${statusFieldName}Msg" => $errorMessage,
- ];
- $this->updateImportRecord($values[count($values) - 1], $importRecordParams);
- return CRM_Import_Parser::ERROR;
- }
-
- $contactID = $newContact['error_message']['params'][0];
- if (is_array($contactID)) {
- $contactID = array_pop($contactID);
- }
- if (!in_array($contactID, $this->_newContacts)) {
- $this->_newContacts[] = $contactID;
- }
- }
- //CRM-262 No Duplicate Checking
- if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) {
- array_unshift($values, $url_string);
- $importRecordParams = [
- $statusFieldName => 'DUPLICATE',
- "${statusFieldName}Msg" => "Skipping duplicate record",
- ];
- $this->updateImportRecord($values[count($values) - 1], $importRecordParams);
- return CRM_Import_Parser::DUPLICATE;
- }
-
- $importRecordParams = [
- $statusFieldName => 'IMPORTED',
- ];
- $this->updateImportRecord($values[count($values) - 1], $importRecordParams);
- //return warning if street address is not parsed, CRM-5886
- return $this->processMessage($values, $statusFieldName, CRM_Import_Parser::VALID);
+ return $this->handleDuplicateError($newContact, $statusFieldName, $values, $onDuplicate, $formatted, $contactFields);
}
else {
// Not a dupe, so we had an error
if ((is_null($error)) && (civicrm_error(_civicrm_api3_deprecated_validate_formatted_contact($formatted)))) {
$error = _civicrm_api3_deprecated_validate_formatted_contact($formatted);
}
+ if (!is_null($error)) {
+ return $error;
+ }
- $newContact = $error;
+ if ($contactId) {
+ $this->formatParams($formatted, $onDuplicate, (int) $contactId);
+ }
+
+ // Resetting and rebuilding cache could be expensive.
+ CRM_Core_Config::setPermitCacheFlushMode(FALSE);
+
+ // If a user has logged in, or accessed via a checksum
+ // Then deliberately 'blanking' a value in the profile should remove it from their record
+ // @todo this should either be TRUE or FALSE in the context of import - once
+ // we figure out which we can remove all the rest.
+ // Also note the meaning of this parameter is less than it used to
+ // be following block cleanup.
+ $formatted['updateBlankLocInfo'] = TRUE;
+ if ((CRM_Core_Session::singleton()->get('authSrc') & (CRM_Core_Permission::AUTH_SRC_CHECKSUM + CRM_Core_Permission::AUTH_SRC_LOGIN)) == 0) {
+ $formatted['updateBlankLocInfo'] = FALSE;
+ }
- if (is_null($error)) {
- if ($contactId) {
- $this->formatParams($formatted, $onDuplicate, (int) $contactId);
+ list($data, $contactDetails) = CRM_Contact_BAO_Contact::formatProfileContactParams($formatted, $contactFields, $contactId, NULL, $formatted['contact_type']);
+
+ // manage is_opt_out
+ if (array_key_exists('is_opt_out', $contactFields) && array_key_exists('is_opt_out', $formatted)) {
+ $wasOptOut = $contactDetails['is_opt_out'] ?? FALSE;
+ $isOptOut = $formatted['is_opt_out'];
+ $data['is_opt_out'] = $isOptOut;
+ // on change, create new civicrm_subscription_history entry
+ if (($wasOptOut != $isOptOut) && !empty($contactDetails['contact_id'])) {
+ $shParams = [
+ 'contact_id' => $contactDetails['contact_id'],
+ 'status' => $isOptOut ? 'Removed' : 'Added',
+ 'method' => 'Web',
+ ];
+ CRM_Contact_BAO_SubscriptionHistory::create($shParams);
}
+ }
- // Resetting and rebuilding cache could be expensive.
- CRM_Core_Config::setPermitCacheFlushMode(FALSE);
- $cid = CRM_Contact_BAO_Contact::createProfileContact($formatted, $contactFields, $contactId, NULL, NULL, $formatted['contact_type']);
- CRM_Core_Config::setPermitCacheFlushMode(TRUE);
+ $contact = CRM_Contact_BAO_Contact::create($data);
+ $cid = $contact->id;
- $contact = [
- 'contact_id' => $cid,
- ];
+ // Process group and tag
+ if (isset($formatted['group'])) {
+ $method = 'Admin';
+ CRM_Contact_BAO_GroupContact::create($formatted['group'], $cid, FALSE, $method);
+ }
- $defaults = [];
- $newContact = CRM_Contact_BAO_Contact::retrieve($contact, $defaults);
+ if (!empty($fields['tag']) && array_key_exists('tag', $formatted)) {
+ // Convert comma separated form values from select2 v3
+ $tags = is_array($formatted['tag']) ? $formatted['tag'] : array_fill_keys(array_filter(explode(',', $formatted['tag'])), 1);
+ CRM_Core_BAO_EntityTag::create($tags, 'civicrm_contact', $cid);
}
+ CRM_Core_Config::setPermitCacheFlushMode(TRUE);
+
+ $contact = [
+ 'contact_id' => $cid,
+ ];
+
+ $defaults = [];
+ $newContact = CRM_Contact_BAO_Contact::retrieve($contact, $defaults);
+
//get the id of the contact whose street address is not parsable, CRM-5886
if ($this->_parseStreetAddress && is_object($newContact) && property_exists($newContact, 'address') && $newContact->address) {
foreach ($newContact->address as $address) {
$this->_relationships = $this->getRelationships();
}
+ /**
+ * @param array $newContact
+ * @param $statusFieldName
+ * @param array $values
+ * @param int $onDuplicate
+ * @param array $formatted
+ * @param array $contactFields
+ *
+ * @return int
+ *
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
+ * @throws \Civi\API\Exception\UnauthorizedException
+ */
+ protected function handleDuplicateError(array $newContact, $statusFieldName, array $values, int $onDuplicate, array $formatted, array $contactFields): int {
+ $urls = [];
+ // need to fix at some stage and decide if the error will return an
+ // array or string, crude hack for now
+ if (is_array($newContact['error_message']['params'][0])) {
+ $cids = $newContact['error_message']['params'][0];
+ }
+ else {
+ $cids = explode(',', $newContact['error_message']['params'][0]);
+ }
+
+ foreach ($cids as $cid) {
+ $urls[] = CRM_Utils_System::url('civicrm/contact/view', 'reset=1&cid=' . $cid, TRUE);
+ }
+
+ $url_string = implode("\n", $urls);
+
+ // If we duplicate more than one record, skip no matter what
+ if (count($cids) > 1) {
+ $errorMessage = ts('Record duplicates multiple contacts');
+ $importRecordParams = [
+ $statusFieldName => 'ERROR',
+ "${statusFieldName}Msg" => $errorMessage,
+ ];
+
+ //combine error msg to avoid mismatch between error file columns.
+ $errorMessage .= "\n" . $url_string;
+ array_unshift($values, $errorMessage);
+ $this->updateImportRecord($values[count($values) - 1], $importRecordParams);
+ return CRM_Import_Parser::ERROR;
+ }
+
+ // Params only had one id, so shift it out
+ $contactId = array_shift($cids);
+ $cid = NULL;
+
+ $vals = ['contact_id' => $contactId];
+
+ if ($onDuplicate == CRM_Import_Parser::DUPLICATE_REPLACE) {
+ civicrm_api('contact', 'delete', $vals);
+ $cid = CRM_Contact_BAO_Contact::createProfileContact($formatted, $contactFields, $contactId, NULL, NULL, $formatted['contact_type']);
+ }
+ elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_UPDATE) {
+ $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId);
+ }
+ elseif ($onDuplicate == CRM_Import_Parser::DUPLICATE_FILL) {
+ $newContact = $this->createContact($formatted, $contactFields, $onDuplicate, $contactId);
+ }
+ // else skip does nothing and just returns an error code.
+ if ($cid) {
+ $contact = [
+ 'contact_id' => $cid,
+ ];
+ $defaults = [];
+ $newContact = CRM_Contact_BAO_Contact::retrieve($contact, $defaults);
+ }
+
+ if (civicrm_error($newContact)) {
+ if (empty($newContact['error_message']['params'])) {
+ // different kind of error other than DUPLICATE
+ $errorMessage = $newContact['error_message'];
+ array_unshift($values, $errorMessage);
+ $importRecordParams = [
+ $statusFieldName => 'ERROR',
+ "${statusFieldName}Msg" => $errorMessage,
+ ];
+ $this->updateImportRecord($values[count($values) - 1], $importRecordParams);
+ return CRM_Import_Parser::ERROR;
+ }
+
+ $contactID = $newContact['error_message']['params'][0];
+ if (is_array($contactID)) {
+ $contactID = array_pop($contactID);
+ }
+ if (!in_array($contactID, $this->_newContacts)) {
+ $this->_newContacts[] = $contactID;
+ }
+ }
+ //CRM-262 No Duplicate Checking
+ if ($onDuplicate == CRM_Import_Parser::DUPLICATE_SKIP) {
+ array_unshift($values, $url_string);
+ $importRecordParams = [
+ $statusFieldName => 'DUPLICATE',
+ "${statusFieldName}Msg" => "Skipping duplicate record",
+ ];
+ $this->updateImportRecord($values[count($values) - 1], $importRecordParams);
+ return CRM_Import_Parser::DUPLICATE;
+ }
+
+ $importRecordParams = [
+ $statusFieldName => 'IMPORTED',
+ ];
+ $this->updateImportRecord($values[count($values) - 1], $importRecordParams);
+ //return warning if street address is not parsed, CRM-5886
+ return $this->processMessage($values, $statusFieldName, CRM_Import_Parser::VALID);
+ }
+
}
protected static function cancel($memberships, $contributionId, $membershipStatuses, $participant, $oldStatus, $pledgePayment, $pledgeID, $pledgePaymentIDs, $contributionStatusId) {
// @fixme https://lab.civicrm.org/dev/core/issues/927 Cancelling membership etc is not desirable for all use-cases and we should be able to disable it
$participantStatuses = CRM_Event_PseudoConstant::participantStatus();
- if (is_array($memberships)) {
- foreach ($memberships as $membership) {
- $update = TRUE;
- //Update Membership status if there is no other completed contribution associated with the membership.
- $relatedContributions = CRM_Member_BAO_Membership::getMembershipContributionId($membership->id, TRUE);
- foreach ($relatedContributions as $contriId) {
- if ($contriId == $contributionId) {
- continue;
- }
- $statusId = CRM_Core_DAO::getFieldValue('CRM_Contribute_BAO_Contribution', $contriId, 'contribution_status_id');
- if (CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'contribution_status_id', $statusId) === 'Completed') {
- $update = FALSE;
- }
- }
- if ($membership && $update) {
- $newStatus = array_search('Cancelled', $membershipStatuses);
-
- // Create activity
- $allStatus = CRM_Member_BAO_Membership::buildOptions('status_id', 'get');
- $activityParam = [
- 'subject' => "Status changed from {$allStatus[$membership->status_id]} to {$allStatus[$newStatus]}",
- 'source_contact_id' => CRM_Core_Session::singleton()->get('userID'),
- 'target_contact_id' => $membership->contact_id,
- 'source_record_id' => $membership->id,
- 'activity_type_id' => 'Change Membership Status',
- 'status_id' => 'Completed',
- 'priority_id' => 'Normal',
- 'activity_date_time' => 'now',
- ];
-
- $membership->status_id = $newStatus;
- $membership->is_override = TRUE;
- $membership->status_override_end_date = 'null';
- $membership->save();
- civicrm_api3('activity', 'create', $activityParam);
- }
- }
- }
-
if ($participant) {
$updatedStatusId = array_search('Cancelled', $participantStatuses);
CRM_Event_BAO_Participant::updateParticipantStatus($participant->id, $oldStatus, $updatedStatusId, TRUE);
* $results no of deleted Contribution on success, false otherwise
*/
public static function deleteContribution($id) {
- CRM_Utils_Hook::pre('delete', 'Contribution', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Contribution', $id);
$transaction = new CRM_Core_Transaction();
*
* Generated from xml/schema/CRM/Contribute/Contribution.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:6681702174b0431d22a1bc98c71bd747)
+ * (GenCodeChecksum:a24c14ae34bb8c68b8f0348b946c18b9)
*/
/**
class CRM_Contribute_DAO_Contribution extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.3';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Contribute/ContributionPage.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:1a64443b99f8c5f11333e600e3cb47a3)
+ * (GenCodeChecksum:1fc0665cc8320aec4576a39e1491d57a)
*/
/**
class CRM_Contribute_DAO_ContributionPage extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.3';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Contribute/ContributionProduct.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:45dff2998f47d5bd918d767c018eeac4)
+ * (GenCodeChecksum:f1269124a9b0ee2a9482aea7d0ee221c)
*/
/**
class CRM_Contribute_DAO_ContributionProduct extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.4';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Contribute/ContributionRecur.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f8fcfe64d80dea9fe9f1f8eb86246f73)
+ * (GenCodeChecksum:c080fbdfdb5b780a36f5a48e5a88eaae)
*/
/**
class CRM_Contribute_DAO_ContributionRecur extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.6';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Contribute/ContributionSoft.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f790cd9c491079f788527103d96230f9)
+ * (GenCodeChecksum:3bbe2837f1b310d77d79614a4fd5a9af)
*/
/**
class CRM_Contribute_DAO_ContributionSoft extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '2.2';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Contribute/Premium.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:30736c3404f66636b59373f2e81f5d2e)
+ * (GenCodeChecksum:44100b596ee94445f953e783f37cdfba)
*/
/**
class CRM_Contribute_DAO_Premium extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.4';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Contribute/PremiumsProduct.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:490466ed1df27a5a6157a87f0dd6eb30)
+ * (GenCodeChecksum:09f3e3060480299738b12caf7121662d)
*/
/**
class CRM_Contribute_DAO_PremiumsProduct extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.4';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Contribute/Product.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:6f4d4d48a0c392a2a72b268a9815006b)
+ * (GenCodeChecksum:45a3c80396259fbc6da8cbecc0ba652d)
*/
/**
class CRM_Contribute_DAO_Product extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.4';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Contribute/Widget.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f1346769d093ec9021994764d62dedfe)
+ * (GenCodeChecksum:b98e1da73e0723e617a9dae64a8e8dad)
*/
/**
class CRM_Contribute_DAO_Widget extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '2.0';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
$isEmpty = array_keys(array_flip($submittedValues['soft_credit_contact_id']));
if ($this->_id && count($isEmpty) == 1 && key($isEmpty) == NULL) {
- civicrm_api3('ContributionSoft', 'get', ['contribution_id' => $this->_id, 'pcp_id' => NULL, 'api.ContributionSoft.delete' => 1]);
+ civicrm_api3('ContributionSoft', 'get', ['contribution_id' => $this->_id, 'pcp_id' => ['IS NULL' => 1], 'api.ContributionSoft.delete' => 1]);
}
// set the contact, when contact is selected
class CRM_Contribute_Form_ManagePremiums extends CRM_Contribute_Form {
/**
- * Pre process the form.
+ * Classes extending CRM_Core_Form should implement this method.
+ *
+ * @return string
*/
- public function preProcess() {
- parent::preProcess();
+ public function getDefaultEntity() {
+ return 'Product';
}
/**
/**
* Build the form object.
+ *
+ * @throws \CiviCRM_API3_Exception
*/
public function buildQuickForm() {
parent::buildQuickForm();
$this->add('text', 'fixed_period_start_day', ts('Fixed Period Start Day'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'fixed_period_start_day'));
- $this->add('Select', 'duration_unit', ts('Duration Unit'), CRM_Core_SelectValues::getPremiumUnits(), FALSE, ['placeholder' => ts('- select period -')]);
-
+ $this->addField('duration_unit', ['placeholder' => ts('- select period -')], FALSE);
$this->add('text', 'duration_interval', ts('Duration'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'duration_interval'));
-
- $this->add('Select', 'frequency_unit', ts('Frequency Unit'), CRM_Core_SelectValues::getPremiumUnits(), FALSE, ['placeholder' => ts('- select period -')]);
-
+ $this->addField('frequency_unit', ['placeholder' => ts('- select period -')], FALSE);
$this->add('text', 'frequency_interval', ts('Frequency'), CRM_Core_DAO::getAttribute('CRM_Contribute_DAO_Product', 'frequency_interval'));
//Financial Type CRM-11106
return $cachedContactCountry;
}
+ /**
+ * Provide list of Pinned countries.
+ *
+ * @param $availableCountries
+ * @return array
+ */
+ public static function pinnedContactCountries($availableCountries) {
+ if (!isset(Civi::$statics[__CLASS__]['cachedPinnedContactCountries'])) {
+ $pinnedContactCountries = Civi::settings()->get('pinnedContactCountries');
+ $pinnedCountries = [];
+ if (!empty($pinnedContactCountries)) {
+ foreach ($pinnedContactCountries as $pinnedContactCountry) {
+ // pinned country must exist in available country list.
+ if (array_key_exists($pinnedContactCountry, $availableCountries)) {
+ $pinnedCountries[$pinnedContactCountry] = $availableCountries[$pinnedContactCountry];
+ }
+ }
+ }
+ Civi::$statics[__CLASS__]['cachedPinnedContactCountries'] = $pinnedCountries;
+ }
+
+ return Civi::$statics[__CLASS__]['cachedPinnedContactCountries'];
+ }
+
+ /**
+ * Provide sorted list of countries with default country with first position
+ * then Pinned countries then rest of countries.
+ *
+ * @param $availableCountries
+ * @return array
+ */
+ public static function _defaultContactCountries($availableCountries) {
+ // localise the country names if in an non-en_US locale
+ $tsLocale = CRM_Core_I18n::getLocale();
+ if ($tsLocale != '' and $tsLocale != 'en_US') {
+ $i18n = CRM_Core_I18n::singleton();
+ $i18n->localizeArray($availableCountries, [
+ 'context' => 'country',
+ ]);
+ $availableCountries = CRM_Utils_Array::asort($availableCountries);
+ }
+ $pinnedContactCountries = CRM_Core_BAO_Country::pinnedContactCountries($availableCountries);
+ // if default country is set, percolate it to the top, then pinned countries and then remaining available countries.
+ if ($defaultContactCountry = Civi::settings()->get('defaultContactCountry')) {
+ $default = [$defaultContactCountry => $availableCountries[$defaultContactCountry] ?? NULL];
+ $availableCountries = $default + $pinnedContactCountries + $availableCountries;
+ }
+ elseif (!empty($pinnedContactCountries)) {
+ // if default country is missing then use only pinned countries at the top then rest of the countries.
+ $availableCountries = $pinnedContactCountries + $availableCountries;
+ }
+
+ return $availableCountries;
+ }
+
/**
* Provide cached default country name.
*
* @return CRM_Core_DAO_CustomField
*/
public static function create($params) {
+ $changeSerialize = self::getChangeSerialize($params);
$customField = self::createCustomFieldRecord($params);
+ // When deserializing a field, the update needs to run before the schema change
+ if ($changeSerialize === 0) {
+ CRM_Core_DAO::singleValueQuery(self::getAlterSerializeSQL($customField));
+ }
$op = empty($params['id']) ? 'add' : 'modify';
self::createField($customField, $op);
+ // When serializing a field, the update needs to run after the schema change
+ if ($changeSerialize === 1) {
+ CRM_Core_DAO::singleValueQuery(self::getAlterSerializeSQL($customField));
+ }
CRM_Utils_Hook::post(($op === 'add' ? 'create' : 'edit'), 'CustomField', $customField->id, $customField);
* @throws \CiviCRM_API3_Exception
*/
public static function bulkSave($bulkParams, $defaults = []) {
- $addedColumns = $sql = $customFields = [];
+ $addedColumns = $sql = $customFields = $pre = $post = [];
foreach ($bulkParams as $index => $fieldParams) {
$params = array_merge($defaults, $fieldParams);
+ $changeSerialize = self::getChangeSerialize($params);
$customField = self::createCustomFieldRecord($params);
+ // Serialize/deserialize sql must run after/before the table is altered
+ if ($changeSerialize === 0) {
+ $pre[] = self::getAlterSerializeSQL($customField);
+ }
+ if ($changeSerialize === 1) {
+ $post[] = self::getAlterSerializeSQL($customField);
+ }
$fieldSQL = self::getAlterFieldSQL($customField, empty($params['id']) ? 'add' : 'modify');
if (!isset($params['custom_group_id'])) {
$params['custom_group_id'] = civicrm_api3('CustomField', 'getvalue', ['id' => $customField->id, 'return' => 'custom_group_id']);
$customFields[$index] = $customField;
}
+ foreach ($pre as $query) {
+ CRM_Core_DAO::executeQuery($query);
+ }
+
foreach ($sql as $tableName => $statements) {
// CRM-7007: do not i18n-rewrite this query
CRM_Core_DAO::executeQuery("ALTER TABLE $tableName " . implode(', ', $statements), [], TRUE, NULL, FALSE, FALSE);
Civi::service('sql_triggers')->rebuild($tableName, TRUE);
}
+
+ foreach ($post as $query) {
+ CRM_Core_DAO::executeQuery($query);
+ }
+
CRM_Utils_System::flushCache();
foreach ($customFields as $index => $customField) {
CRM_Utils_Hook::post(empty($bulkParams[$index]['id']) ? 'create' : 'edit', 'CustomField', $customField->id, $customField);
* @return bool
*/
public static function getAlterFieldSQL($field, $operation) {
- $indexExist = $operation === 'add' ? FALSE : CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $field->id, 'is_searchable');
$params = self::prepareCreateParams($field, $operation);
// Let's suppress the required flag, since that can cause an sql issue... for unknown reasons since we are calling
// a function only used by Custom Field creation...
$params['required'] = FALSE;
- return CRM_Core_BAO_SchemaHandler::getFieldAlterSQL($params, $indexExist);
+ return CRM_Core_BAO_SchemaHandler::getFieldAlterSQL($params);
}
/**
- * Reformat existing values for a field when changing its serialize attribute
+ * Get query to reformat existing values for a field when changing its serialize attribute
*
* @param CRM_Core_DAO_CustomField $field
- * @throws CRM_Core_Exception
+ * @return string
*/
- private static function alterSerialize($field) {
+ private static function getAlterSerializeSQL($field) {
$table = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomGroup', $field->custom_group_id, 'table_name');
$col = $field->column_name;
$sp = CRM_Core_DAO::VALUE_SEPARATOR;
if ($field->serialize) {
- $sql = "UPDATE `$table` SET `$col` = CONCAT('$sp', `$col`, '$sp') WHERE `$col` IS NOT NULL AND `$col` NOT LIKE '$sp%' AND `$col` != ''";
+ return "UPDATE `$table` SET `$col` = CONCAT('$sp', `$col`, '$sp') WHERE `$col` IS NOT NULL AND `$col` NOT LIKE '$sp%' AND `$col` != ''";
}
else {
- $sql = "UPDATE `$table` SET `$col` = SUBSTRING_INDEX(SUBSTRING(`$col`, 2), '$sp', 1) WHERE `$col` LIKE '$sp%'";
+ return "UPDATE `$table` SET `$col` = SUBSTRING_INDEX(SUBSTRING(`$col`, 2), '$sp', 1) WHERE `$col` LIKE '$sp%'";
}
- CRM_Core_DAO::executeQuery($sql);
}
/**
$transaction = new CRM_Core_Transaction();
$params = self::prepareCreate($params);
- $alterSerialize = isset($params['serialize']) && !empty($params['id'])
- && ($params['serialize'] != CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $params['id'], 'serialize'));
-
$customField = new CRM_Core_DAO_CustomField();
$customField->copyValues($params);
$customField->save();
// make sure all values are present in the object for further processing
$customField->find(TRUE);
- if ($alterSerialize) {
- self::alterSerialize($customField);
- }
-
return $customField;
}
+ /**
+ * @param $params
+ * @return int|null
+ */
+ protected static function getChangeSerialize($params) {
+ if (isset($params['serialize']) && !empty($params['id'])) {
+ if ($params['serialize'] != CRM_Core_DAO::getFieldValue('CRM_Core_DAO_CustomField', $params['id'], 'serialize')) {
+ return (int) $params['serialize'];
+ }
+ }
+ return NULL;
+ }
+
/**
* Move custom data from one contact to another.
*
'searchable' => $field->is_searchable,
];
- if ($operation == 'delete') {
- $fkName = "{$tableName}_{$field->column_name}";
- if (strlen($fkName) >= 48) {
- $fkName = substr($fkName, 0, 32) . '_' . substr(md5($fkName), 0, 16);
- }
- $params['fkName'] = $fkName;
- }
+ // For adding/dropping FK constraints
+ $params['fkName'] = CRM_Core_BAO_SchemaHandler::getIndexName($tableName, $field->column_name);
+
if ($field->data_type == 'Country' && !self::isSerialized($field)) {
$params['fk_table_name'] = 'civicrm_country';
$params['fk_field_name'] = 'id';
$sql .= self::buildPrimaryKeySQL($field, $separator, $prefix);
}
foreach ($params['fields'] as $field) {
- $sql .= self::buildSearchIndexSQL($field, $separator, $prefix);
+ $sql .= self::buildSearchIndexSQL($field, $separator);
}
if (isset($params['indexes'])) {
foreach ($params['indexes'] as $index) {
/**
* @param array $params
- * @param $separator
- * @param $prefix
- * @param bool $indexExist
+ * @param string $separator
+ * @param string $prefix
+ * @param string|NULL $existingIndex
*
* @return NULL|string
*/
- public static function buildSearchIndexSQL($params, $separator, $prefix, $indexExist = FALSE) {
+ public static function buildSearchIndexSQL($params, $separator, $prefix = '', $existingIndex = NULL) {
$sql = NULL;
// dont index blob
return $sql;
}
- //create index only for searchable fields during ADD,
- //create index only if field is become searchable during MODIFY,
- //drop index only if field is no longer searchable and it does not reference
- //a forgein key (and indexExist is true)
- if (!empty($params['searchable']) && !$indexExist) {
+ // Add index if field is searchable if it does not reference a foreign key
+ // (skip indexing FK fields because it would be redundant to have 2 indexes)
+ if (!empty($params['searchable']) && empty($params['fk_table_name']) && substr($existingIndex, 0, 5) !== 'INDEX') {
$sql .= $separator;
$sql .= str_repeat(' ', 8);
$sql .= $prefix;
$sql .= "INDEX_{$params['name']} ( {$params['name']} )";
}
- elseif (empty($params['searchable']) && empty($params['fk_table_name']) && $indexExist) {
+ // Drop search index if field is no longer searchable
+ elseif (empty($params['searchable']) && substr($existingIndex, 0, 5) === 'INDEX') {
$sql .= $separator;
$sql .= str_repeat(' ', 8);
- $sql .= "DROP INDEX INDEX_{$params['name']}";
+ $sql .= "DROP INDEX $existingIndex";
}
return $sql;
}
$sql .= $separator;
$sql .= str_repeat(' ', 8);
$sql .= $prefix;
- $fkName = "{$tableName}_{$params['name']}";
- if (strlen($fkName) >= 48) {
- $fkName = substr($fkName, 0, 32) . "_" . substr(md5($fkName), 0, 16);
- }
+ $fkName = $params['fkName'] ?? self::getIndexName($tableName, $params['name']);
$sql .= "CONSTRAINT FK_$fkName FOREIGN KEY ( `{$params['name']}` ) REFERENCES {$params['fk_table_name']} ( {$params['fk_field_name']} ) ";
- $sql .= CRM_Utils_Array::value('fk_attributes', $params);
+ $sql .= $params['fk_attributes'] ?? '';
}
return $sql;
}
* Build the sql to alter the field.
*
* @param array $params
- * @param bool $indexExist
*
* @return string
*/
- public static function buildFieldChangeSql($params, $indexExist) {
+ public static function buildFieldChangeSql($params) {
$sql = str_repeat(' ', 8);
$sql .= "ALTER TABLE {$params['table_name']}";
- return $sql . self::getFieldAlterSQL($params, $indexExist);
+ return $sql . self::getFieldAlterSQL($params);
}
/**
* by individual field we can do one or many.
*
* @param array $params
- * @param bool $indexExist
*
* @return string
*/
- public static function getFieldAlterSQL($params, $indexExist) {
+ public static function getFieldAlterSQL($params) {
$sql = '';
switch ($params['operation']) {
case 'add':
case 'modify':
$separator = "\n";
+ $existingIndex = NULL;
+ $dao = CRM_Core_DAO::executeQuery("SHOW INDEX FROM `{$params['table_name']}` WHERE Column_name = '{$params['name']}'");
+ if ($dao->fetch()) {
+ $existingIndex = $dao->Key_name;
+ }
+ $fkSql = self::buildForeignKeySQL($params, ",\n", "ADD ", $params['table_name']);
+ if (substr($existingIndex, 0, 2) === 'FK' && !$fkSql) {
+ $sql .= "$separator DROP FOREIGN KEY {$existingIndex},\nDROP INDEX {$existingIndex}";
+ $separator = ",\n";
+ }
$sql .= self::buildFieldSQL($params, $separator, "MODIFY ");
$separator = ",\n";
- $sql .= self::buildSearchIndexSQL($params, $separator, "ADD INDEX ", $indexExist);
+ $sql .= self::buildSearchIndexSQL($params, $separator, "ADD INDEX ", $existingIndex);
+ if (!$existingIndex && $fkSql) {
+ $sql .= $fkSql;
+ }
break;
case 'delete':
return $sql;
}
+ /**
+ * Turns tableName + columnName into a safe & predictable index name
+ *
+ * @param $tableName
+ * @param $columnName
+ * @return string
+ */
+ public static function getIndexName($tableName, $columnName) {
+ $indexName = "{$tableName}_{$columnName}";
+ if (strlen($indexName) >= 48) {
+ $indexName = substr($indexName, 0, 32) . "_" . substr(md5($indexName), 0, 16);
+ }
+ return $indexName;
+ }
+
/**
* Performs the utf8mb4 migration.
*
*
* @return string
*/
- public static function getInUseCollation() {
+ public static function getInUseCollation(): string {
if (!isset(\Civi::$statics[__CLASS__][__FUNCTION__])) {
$dao = CRM_Core_DAO::executeQuery('SHOW TABLE STATUS LIKE \'civicrm_contact\'');
$dao->fetch();
return \Civi::$statics[__CLASS__][__FUNCTION__];
}
+ /**
+ * Does the database support utf8mb4.
+ *
+ * Utf8mb4 is required to support emojis but older databases may not have it enabled.
+ *
+ * This is aggressively cached despite just being a string function
+ * as it is expected it might be called many times.
+ *
+ * @return bool
+ */
+ public static function databaseSupportsUTF8MB4(): bool {
+ if (!isset(\Civi::$statics[__CLASS__][__FUNCTION__])) {
+ \Civi::$statics[__CLASS__][__FUNCTION__] = stripos(self::getInUseCollation(), 'utf8mb4') === TRUE;
+ }
+ return \Civi::$statics[__CLASS__][__FUNCTION__];
+ }
+
/**
* Get the database collation.
*
*
*/
public static function del($id) {
+ CRM_Utils_Hook::pre('delete', 'UFGroup', $id);
+
//check whether this group contains any profile fields
$profileField = new CRM_Core_DAO_UFField();
$profileField->uf_group_id = $id;
$group = new CRM_Core_DAO_UFGroup();
$group->id = $id;
$group->delete();
+
+ CRM_Utils_Hook::post('delete', 'UFGroup', $id, $group);
return 1;
}
* @param array $params
* Reference array contains the values submitted by the form.
* @param array $ids
- * Reference array contains the id.
+ * Deprecated array.
*
*
* @return object
*/
public static function add(&$params, $ids = []) {
+ if (empty($params['id']) && !empty($ids['ufgroup'])) {
+ $params['id'] = $ids['ufgroup'];
+ Civi::log()->warning('ids parameter is deprecated', ['civi.tag' => 'deprecated']);
+ }
$fields = [
'is_active',
'add_captcha',
'titlePlural' => $tableXML->titlePlural ?? CRM_Utils_String::pluralize($tableXML->title ?? $titleFromClass),
'icon' => $tableXML->icon ?? NULL,
'add' => $tableXML->add ?? NULL,
+ 'component' => $tableXML->component ?? NULL,
'paths' => (array) ($tableXML->paths ?? []),
'labelName' => substr($name, 8),
'className' => $this->classNames[$name],
// renamed.
'debug' => ['setting', 'debug_enabled'],
'defaultContactCountry' => ['setting'],
+ 'pinnedContactCountries' => ['setting'],
'defaultContactStateProvince' => ['setting'],
'defaultCurrency' => ['setting'],
'defaultSearchProfileID' => ['setting'],
*/
public static function createSQLFilter($fieldName, $filter, $type = NULL, $alias = NULL, $returnSanitisedArray = FALSE) {
foreach ($filter as $operator => $criteria) {
+ if (!CRM_Core_BAO_SchemaHandler::databaseSupportsUTF8MB4()) {
+ foreach ((array) $criteria as $criterion) {
+ if (!empty($criterion) && !is_numeric($criterion)
+ // The first 2 criteria are redundant but are added as they
+ // seem like they would
+ // be quicker than this 3rd check.
+ && max(array_map('ord', str_split($criterion))) >= 240) {
+ // String contains unsupported emojis.
+ // We return a clause that resolves to false as an emoji string by definition cannot be saved.
+ // note that if we return just 0 for false if gets lost in empty checks.
+ // https://stackoverflow.com/questions/16496554/can-php-detect-4-byte-encoded-utf8-chars
+ return '0 = 1';
+ }
+ }
+ }
+
if (in_array($operator, self::acceptedSQLOperators(), TRUE)) {
switch ($operator) {
// unary operators
*
* Generated from xml/schema/CRM/Core/ActionLog.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:d1a6159f18c0818e42fb3763f097772d)
+ * (GenCodeChecksum:5e54867f6cec000d7f219c82a1c081d3)
*/
/**
*
* Generated from xml/schema/CRM/Core/ActionMapping.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:c095a458e031091596adf3b9bb46baf5)
+ * (GenCodeChecksum:786c067af45c5d1979519a8326665453)
*/
/**
*
* Generated from xml/schema/CRM/Core/ActionSchedule.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:d2d45ba583a410b375e261a1cf1ce485)
+ * (GenCodeChecksum:674f2b73fdc72758a31b2f023a33526a)
*/
/**
*
* Generated from xml/schema/CRM/Core/Address.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b612c958c68fcd4f5e4b0b244ca6c3b1)
+ * (GenCodeChecksum:44eb25ddfd0e9d87e213e2f80f80233d)
*/
/**
*
* Generated from xml/schema/CRM/Core/AddressFormat.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:090b4784d528f3c465b4daa2cc7bdf1e)
+ * (GenCodeChecksum:47ce2c9d196b195fda0a60eaac02f5d1)
*/
/**
*
* Generated from xml/schema/CRM/Core/Cache.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:637ce0498ba1c4f1f32fbfd16bb7d66d)
+ * (GenCodeChecksum:6b4eec63c83fffde053a8259221d0bfe)
*/
/**
*
* Generated from xml/schema/CRM/Core/Component.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:e8ae3905d2f7dc380ec1e334dad6e198)
+ * (GenCodeChecksum:3b686ef7dde6f66dfe5eb708e667dcc7)
*/
/**
*
* Generated from xml/schema/CRM/Core/Country.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:707ca40a97f702747efb02f28ed710e6)
+ * (GenCodeChecksum:baa7ed7cb183bc7f1ee86a41a001e580)
*/
/**
*
* Generated from xml/schema/CRM/Core/County.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4317f5a9d6526937ac406407ce9a97a1)
+ * (GenCodeChecksum:9e49f92ab040fc02002d5ec5507cf49a)
*/
/**
*
* Generated from xml/schema/CRM/Core/CustomField.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:754b560576d029a21029661e48f3075b)
+ * (GenCodeChecksum:58c67e6b3ec035823fb7553abb962ab9)
*/
/**
*
* Generated from xml/schema/CRM/Core/CustomGroup.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a40273d2f899d4fa280d0c02297b5263)
+ * (GenCodeChecksum:807040c22af3159cb198becb183444bc)
*/
/**
*
* Generated from xml/schema/CRM/Core/Dashboard.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:1f32e4ff906a25d432cc28598e388f60)
+ * (GenCodeChecksum:96e683f4bec8fff387930109c2f5ea41)
*/
/**
*
* Generated from xml/schema/CRM/Core/Discount.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:7f9f8e28c00e7b9c3dbf1631b4ad4391)
+ * (GenCodeChecksum:ccb85ff70ce8a536ac4a941628455d8d)
*/
/**
*
* Generated from xml/schema/CRM/Core/Domain.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4af215dcb8fae4156854344b4dfb3960)
+ * (GenCodeChecksum:6a8de20676ad3eeaca16ea3059958a4e)
*/
/**
*
* Generated from xml/schema/CRM/Core/Email.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:fef14f6148a58eacf0e1695dfd794134)
+ * (GenCodeChecksum:032cf9c0a45f5d15baaf7a9087741569)
*/
/**
*
* Generated from xml/schema/CRM/Core/EntityFile.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:7fa9cd793366f00f34e879ba97791bf5)
+ * (GenCodeChecksum:8d4673d56dc80b50b0acdd5186a19068)
*/
/**
*
* Generated from xml/schema/CRM/Core/EntityTag.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:975426ca9328abeb310b81dd060af25a)
+ * (GenCodeChecksum:f02ad487f101cb549da790954fbaa7a4)
*/
/**
*
* Generated from xml/schema/CRM/Core/Extension.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:dd8b0d8ddff649f7180b28991e578a3f)
+ * (GenCodeChecksum:c85a50145f3c9647e6fb46328034090e)
*/
/**
*
* Generated from xml/schema/CRM/Core/File.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:aa00f0710c5c740b37ff1c7f91df3638)
+ * (GenCodeChecksum:d47b8b85ee8790c3da0216b40c2dc657)
*/
/**
*
* Generated from xml/schema/CRM/Core/IM.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f56fbd26bb48c845527d822e77392881)
+ * (GenCodeChecksum:d44807afb48eb3aa89bdae6db574f89e)
*/
/**
*
* Generated from xml/schema/CRM/Core/Job.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:9b8f984453f85c6a451aff41f267fdc5)
+ * (GenCodeChecksum:434388c3fa5b5f67932dd71f5d64a031)
*/
/**
*
* Generated from xml/schema/CRM/Core/JobLog.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:15b8a4864ded5f1a68773ec432bf620b)
+ * (GenCodeChecksum:03cf51e361b98d8ed31dcbd86eda2722)
*/
/**
*
* Generated from xml/schema/CRM/Core/LocBlock.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:8a50c9ef2129e7b7b0ed8b99a86d13a5)
+ * (GenCodeChecksum:86653150176ca5b8f4bb80b8dc581010)
*/
/**
*
* Generated from xml/schema/CRM/Core/LocationType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a0fb6f020e3685ffe293609a32bcc741)
+ * (GenCodeChecksum:0aac55ebb9932e5ab19fcf2e6eca7dd0)
*/
/**
*
* Generated from xml/schema/CRM/Core/Log.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:d5fdccfff5a70b31fb787ca55f0d589f)
+ * (GenCodeChecksum:816b07245cf23f330f371b32bc278d17)
*/
/**
*
* Generated from xml/schema/CRM/Core/MailSettings.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:685ef3fc528a263bfb0546a1e523c6e5)
+ * (GenCodeChecksum:a362c7cd24732b55a96cd4e526d29102)
*/
/**
*
* Generated from xml/schema/CRM/Core/Managed.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:5e27c0a48637f591ddd474093510e532)
+ * (GenCodeChecksum:a6c528f54d10bee8fbc3b12c1bafd44c)
*/
/**
*
* Generated from xml/schema/CRM/Core/Mapping.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:fed9ff4fb50e9c53d4b17f3015e7dabe)
+ * (GenCodeChecksum:50a6b7f051df6e61bf9e0b9b930dc861)
*/
/**
*
* Generated from xml/schema/CRM/Core/MappingField.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b65ac30d21a5de881f6c7ac422d532b3)
+ * (GenCodeChecksum:b61d71dabcb618c14e3e8d7985b324de)
*/
/**
*
* Generated from xml/schema/CRM/Core/Menu.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f9b7fc0b2a944f399d46f739459f6174)
+ * (GenCodeChecksum:57fa30940edf98c8e957dd1f33df3f51)
*/
/**
*
* Generated from xml/schema/CRM/Core/MessageTemplate.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a85d986e421657c55de1e56dcb475a60)
+ * (GenCodeChecksum:8bdd2857d4229fc76ced7a2153574864)
*/
/**
*
* Generated from xml/schema/CRM/Core/Navigation.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:c8bbc337e1ec2dfac5a6a470131e80d9)
+ * (GenCodeChecksum:ca49dd9232dd72c6e1236488837a30cb)
*/
/**
*
* Generated from xml/schema/CRM/Core/Note.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ac7f4de63097d51ee52cc876ccad55e9)
+ * (GenCodeChecksum:b623a27bc1f57db04764a14ce6a3f113)
*/
/**
*
* Generated from xml/schema/CRM/Core/OpenID.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0dfd6eb0f06f6d29d661fdc2b51d707a)
+ * (GenCodeChecksum:47984d6d7242a00042bf664e5fff0600)
*/
/**
*
* Generated from xml/schema/CRM/Core/OptionGroup.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ce2435eb871ead2e9fe08535da0efdf4)
+ * (GenCodeChecksum:0892af5a47aecaeaa04a82c6f9875348)
*/
/**
*
* Generated from xml/schema/CRM/Core/OptionValue.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:44af5e1daf9325ef98fbd4ec20927635)
+ * (GenCodeChecksum:613a9cc4fed472d40f1d49cf456a9711)
*/
/**
*
* Generated from xml/schema/CRM/Core/Phone.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ab1d2489e34ff90df7146ee39364fb2a)
+ * (GenCodeChecksum:600322e85619a002b34c9faf0f02e5c8)
*/
/**
*
* Generated from xml/schema/CRM/Core/PreferencesDate.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0c9efd56cae3a34bea22b763c67162df)
+ * (GenCodeChecksum:a0d91310a76fe98662806ef3104d8f30)
*/
/**
*
* Generated from xml/schema/CRM/Core/PrevNextCache.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:10cb66e317ece2bfe45642c4004d9b36)
+ * (GenCodeChecksum:eb88786d7c15dbc509450465b4fdd6a2)
*/
/**
*
* Generated from xml/schema/CRM/Core/PrintLabel.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:2505ce7214d5180635182054f5a784b1)
+ * (GenCodeChecksum:39e91965d2ee2599f3eae8ab3b4cc7f8)
*/
/**
*
* Generated from xml/schema/CRM/Core/RecurringEntity.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:50582177a0117aba7d8f7b65f98a9d59)
+ * (GenCodeChecksum:9cb2098de9f52e400a1083f996431878)
*/
/**
*
* Generated from xml/schema/CRM/Core/Setting.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:d50b37651a6a36273110251643e9e633)
+ * (GenCodeChecksum:2eb3a69876a76a1aca598e6bfb7031a4)
*/
/**
*
* Generated from xml/schema/CRM/Core/StateProvince.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:6af37b242446cb229568ae2c0a05d95e)
+ * (GenCodeChecksum:abd329da6e7801c901c3c97c1b09ef59)
*/
/**
*
* Generated from xml/schema/CRM/Core/StatusPreference.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:51374620eeab683f30d11aee9b51a448)
+ * (GenCodeChecksum:bb2fbd63b6758475161446097d35804c)
*/
/**
*
* Generated from xml/schema/CRM/Core/SystemLog.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ca34da7770ea481ca165e648c5b456f0)
+ * (GenCodeChecksum:e302c6097bd6aff575d7067c771eaef0)
*/
/**
*
* Generated from xml/schema/CRM/Core/Tag.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:2ee103855c84fdb6d8487b3a028aca7e)
+ * (GenCodeChecksum:1de963194e3e392448445fac3eac82c8)
*/
/**
*
* Generated from xml/schema/CRM/Core/Timezone.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4d758a9da910a13c54c4fce360cfbb03)
+ * (GenCodeChecksum:1a876a8f56414a6d8094669bb3ce16f8)
*/
/**
*
* Generated from xml/schema/CRM/Core/UFField.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:2c1662232dc0ee7de0f5ffb329a956a0)
+ * (GenCodeChecksum:1c306561fedcaf68fb7d1c78756edf2e)
*/
/**
*
* Generated from xml/schema/CRM/Core/UFGroup.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ca1887e29e1d2daf1318be1cfd5ae8b9)
+ * (GenCodeChecksum:94b47a495b66ddc579bd2c3559e8af7d)
*/
/**
*
* Generated from xml/schema/CRM/Core/UFJoin.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:50c3c6aa59540ad200f1fac488337a75)
+ * (GenCodeChecksum:e5418263459cb127f21a1eafeba89e4c)
*/
/**
*
* Generated from xml/schema/CRM/Core/UFMatch.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:37ebdcccf0be04453b78d536b688e2a9)
+ * (GenCodeChecksum:b10c23e083b100bb39e93f9fd8b1cf86)
*/
/**
*
* Generated from xml/schema/CRM/Core/Website.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:521615f9d64b0fcdc159ca28efaaec31)
+ * (GenCodeChecksum:f5b6bc86206d0baccab8691ee1ae634e)
*/
/**
*
* Generated from xml/schema/CRM/Core/WordReplacement.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:59c9ea0b5ac2faa96c0c40bd1ff519ca)
+ * (GenCodeChecksum:765a5a578d09ff1a4662c313438f7995)
*/
/**
*
* Generated from xml/schema/CRM/Core/Worldregion.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:5da53f7fa56df3c4873bdc36d431b87f)
+ * (GenCodeChecksum:bc0230cdd003ef494022c8d78486656e)
*/
/**
if (!empty($selectedChild)) {
$this->set('selectedChild', $selectedChild);
$this->assign('selectedChild', $selectedChild);
+ Civi::resources()->addSetting(['tabSettings' => ['active' => $selectedChild]]);
}
}
self::populate(self::$country, 'CRM_Core_DAO_Country', TRUE, 'name', 'is_active', $whereClause);
- // if default country is set, percolate it to the top
- if (CRM_Core_BAO_Country::defaultContactCountry()) {
- $countryIsoCodes = self::countryIsoCode();
- $defaultID = array_search(CRM_Core_BAO_Country::defaultContactCountry(), $countryIsoCodes);
- if ($defaultID !== FALSE) {
- $default[$defaultID] = self::$country[$defaultID] ?? NULL;
- self::$country = $default + self::$country;
- }
- }
-
- // localise the country names if in an non-en_US locale
- $tsLocale = CRM_Core_I18n::getLocale();
- if ($tsLocale != '' and $tsLocale != 'en_US') {
- $i18n = CRM_Core_I18n::singleton();
- $i18n->localizeArray(self::$country, [
- 'context' => 'country',
- ]);
- self::$country = CRM_Utils_Array::asort(self::$country);
- }
+ self::$country = CRM_Core_BAO_Country::_defaultContactCountries(self::$country);
}
if ($id) {
if (array_key_exists($id, self::$country)) {
}
// Localize results
if (!empty($params['localize']) || $pseudoconstant['table'] === 'civicrm_country' || $pseudoconstant['table'] === 'civicrm_state_province') {
- $I18nParams = [];
- if ($localizeContext) {
- $I18nParams['context'] = $localizeContext;
+ if ($pseudoconstant['table'] === 'civicrm_country') {
+ $output = CRM_Core_BAO_Country::_defaultContactCountries($output);
+ // avoid further sorting
+ $order = '';
+ }
+ else {
+ $I18nParams = [];
+ if ($localizeContext) {
+ $I18nParams['context'] = $localizeContext;
+ }
+ $i18n = CRM_Core_I18n::singleton();
+ $i18n->localizeArray($output, $I18nParams);
}
- $i18n = CRM_Core_I18n::singleton();
- $i18n->localizeArray($output, $I18nParams);
// Maintain sort by label
if ($order === 'ORDER BY %2') {
$output = CRM_Utils_Array::asort($output);
/**
* Find the fields that we need to get to construct the tokens requested.
- * @param array $tokens list of tokens
+ * @param array $activeTokens list of active tokens
* @return array list of fields needed to generate those tokens
*/
- public function getReturnFields($tokens) {
+ public function getReturnFields($activeTokens) {
// Make sure we always return something
$fields = ['id'];
- foreach (array_intersect($tokens,
+ $tokensInUse = array_intersect(
+ $activeTokens,
array_merge(array_keys(self::getBasicTokens()), array_keys(self::getCustomFieldTokens()))
- ) as $token) {
+ );
+ foreach ($tokensInUse as $token) {
if (isset(self::$fieldMapping[$token])) {
$fields = array_merge($fields, self::$fieldMapping[$token]);
}
*
* Generated from xml/schema/CRM/Cxn/Cxn.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:aae971d0607825ba1b21bc2f11ea3f8a)
+ * (GenCodeChecksum:4c6be1bafb940a9e87e5952364b00fb1)
*/
/**
*
* Generated from xml/schema/CRM/Dedupe/Exception.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0af60fac5e3a7987feaa168009fcc29f)
+ * (GenCodeChecksum:10f530a37c036ee1bd91295ed84e0c6d)
*/
/**
*
* Generated from xml/schema/CRM/Dedupe/Rule.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:32900bb777ad3b4433835fb588ca9e8b)
+ * (GenCodeChecksum:7771f7be0df7716eb9372415720e1622)
*/
/**
*
* Generated from xml/schema/CRM/Dedupe/RuleGroup.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:8cfa2fabe0dc4bd5d8f5668619b1c3bd)
+ * (GenCodeChecksum:521bf67a7ab4ab491ff90780009e759f)
*/
/**
return NULL;
}
- CRM_Utils_Hook::pre('delete', 'Event', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Event', $id);
$extends = ['event'];
$groupTree = CRM_Core_BAO_CustomGroup::getGroupDetail(NULL, NULL, $extends);
if (!$participant->find()) {
return FALSE;
}
- CRM_Utils_Hook::pre('delete', 'Participant', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Participant', $id);
$transaction = new CRM_Core_Transaction();
*
* Generated from xml/schema/CRM/Event/Cart/Cart.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:9ba9d7103a061bdc244d16a6c7252fde)
+ * (GenCodeChecksum:b3bc270f4bdd9b9a8744b2391bcba154)
*/
/**
class CRM_Event_Cart_DAO_Cart extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviEvent';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Event/Cart/EventInCart.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ac722f73c2721247894ec9fff3c7ee3e)
+ * (GenCodeChecksum:f08a1e139f2486ec664ccad97f121e7e)
*/
/**
class CRM_Event_Cart_DAO_EventInCart extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviEvent';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Event/Event.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:d6fecb12a76e0474aa4bfab8a7b012fb)
+ * (GenCodeChecksum:b24aa9a8e4e0f838a71effac403eeeb7)
*/
/**
class CRM_Event_DAO_Event extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.7';
+ const COMPONENT = 'CiviEvent';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Event/Participant.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:89a8003239597da5e935fbce49827aee)
+ * (GenCodeChecksum:25a479f6858f45acff4110a2de47bbae)
*/
/**
class CRM_Event_DAO_Participant extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.7';
+ const COMPONENT = 'CiviEvent';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Event/ParticipantPayment.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4acfc883c7ffc0ac03801022d6620a6c)
+ * (GenCodeChecksum:46b1d29e4240673e67e23252fd2a1e1b)
*/
/**
class CRM_Event_DAO_ParticipantPayment extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.7';
+ const COMPONENT = 'CiviEvent';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Event/ParticipantStatusType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ae55eda6ef9990e6f3c5868545b96c34)
+ * (GenCodeChecksum:05084131b15d6dd7f29ad8d62df1bb82)
*/
/**
class CRM_Event_DAO_ParticipantStatusType extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '3.0';
+ const COMPONENT = 'CiviEvent';
/**
* Static instance to hold the table name.
CRM_Extension_System::singleton()->getClassLoader()->refresh();
}
+ /**
+ * This returns a formatted string containing an extension upgrade link for the UI.
+ * @todo We should improve this to return more appropriate text. eg. when an extension is not installed
+ * it should not say "version xx is installed".
+ *
+ * @param array $remoteExtensionInfo
+ * @param array $localExtensionInfo
+ *
+ * @return string
+ */
+ public function getUpgradeLink($remoteExtensionInfo, $localExtensionInfo) {
+ if (!empty($remoteExtensionInfo) && version_compare($localExtensionInfo['version'], $remoteExtensionInfo->version, '<')) {
+ return ts('Version %1 is installed. <a %2>Upgrade to version %3</a>.', [
+ 1 => $localExtensionInfo['version'],
+ 2 => 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', "action=update&id={$localExtensionInfo['key']}&key={$localExtensionInfo['key']}") . '"',
+ 3 => $remoteExtensionInfo->version,
+ ]);
+ }
+ }
+
}
*
* Generated from xml/schema/CRM/Financial/Currency.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:59d9bdfece27d7a08113a81a83cd36ef)
+ * (GenCodeChecksum:dfa755f71113ba5258a488c28b9a1273)
*/
/**
class CRM_Financial_DAO_Currency extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.7';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Financial/EntityFinancialAccount.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:3e6010351d131140c8cf791e1ec2ee87)
+ * (GenCodeChecksum:4fc4867bfb36e44a31368515e6b9aad3)
*/
/**
class CRM_Financial_DAO_EntityFinancialAccount extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '4.3';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Financial/EntityFinancialTrxn.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:e834c532b7de805d7caf615f7cb1dc89)
+ * (GenCodeChecksum:4f05ac73d1ac6b79d0c9fade6ec4adbd)
*/
/**
class CRM_Financial_DAO_EntityFinancialTrxn extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '3.2';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Financial/FinancialAccount.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0ec6a6cdeba369d17f5fd2502183af58)
+ * (GenCodeChecksum:ecd889135e73d124a753ac96a7dd05bc)
*/
/**
class CRM_Financial_DAO_FinancialAccount extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '3.2';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Financial/FinancialItem.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:07179eb8641f88a9849b268070ba3916)
+ * (GenCodeChecksum:b3bc1270d0d0769da2bd49b49585ac61)
*/
/**
class CRM_Financial_DAO_FinancialItem extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '4.3';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Financial/FinancialTrxn.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:06958233f84eb778009eb5b02002f342)
+ * (GenCodeChecksum:fc046a70dcf53925768a8b28647dd6dc)
*/
/**
class CRM_Financial_DAO_FinancialTrxn extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.3';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Financial/FinancialType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:14e5e79b764d26b8861496c73cacca14)
+ * (GenCodeChecksum:fd432275b49386f3ed17cc5697280dc4)
*/
/**
class CRM_Financial_DAO_FinancialType extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.3';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Financial/PaymentProcessor.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0333db5b51d70297d51351e8e97baec6)
+ * (GenCodeChecksum:ce0ba2d5ffb2cc00c72c3c300db8eadf)
*/
/**
class CRM_Financial_DAO_PaymentProcessor extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.8';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Financial/PaymentProcessorType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:baffa34a0c2ee650a71299ea2df91b57)
+ * (GenCodeChecksum:15dff8fa9ba4df684c09d6fb8c9f0430)
*/
/**
class CRM_Financial_DAO_PaymentProcessorType extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.8';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Financial/PaymentToken.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:ec9e29386ab9e67c4e3256bd47222eda)
+ * (GenCodeChecksum:8ceea9ee5d164fb8b69a178117a7ebb8)
*/
/**
class CRM_Financial_DAO_PaymentToken extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '4.6';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*/
public function setDefaultValues() {
$defaults = $this->_values;
- // Format money fields - localize for display
- $moneyFields = ['total_amount', 'fee_amount', 'net_amount'];
- foreach ($moneyFields as $field) {
- $defaults[$field] = CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency($this->_values[$field]);
- }
+ $defaults['total_amount'] = CRM_Utils_Money::formatLocaleNumericRoundedForDefaultCurrency($this->_values['total_amount']);
return $defaults;
}
$previousFinanciaTrxn['contribution_id'] = $newFinancialTrxn['contribution_id'] = $this->_contributionID;
$newFinancialTrxn['to_financial_account_id'] = CRM_Financial_BAO_FinancialTypeAccount::getInstrumentFinancialAccount($submittedValues['payment_instrument_id']);
- foreach (['total_amount', 'fee_amount', 'net_amount', 'currency', 'is_payment', 'status_id'] as $fieldName) {
+ foreach (['total_amount', 'currency', 'is_payment', 'status_id'] as $fieldName) {
$newFinancialTrxn[$fieldName] = $this->_values[$fieldName];
}
*
* Generated from xml/schema/CRM/Friend/Friend.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:988585422bc3fa558dd2cd8b84867f30)
+ * (GenCodeChecksum:3d5fa2c27a1430537988ce50ac455566)
*/
/**
* @return bool|mixed
*/
public static function del($id) {
- CRM_Utils_Hook::pre('delete', 'Grant', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Grant', $id);
$grant = new CRM_Grant_DAO_Grant();
$grant->id = $id;
*
* Generated from xml/schema/CRM/Grant/Grant.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:1e2a7c1d16518e1bffa40c673976aa28)
+ * (GenCodeChecksum:4ab9a294ffb22e1a8ff42103bc6f9bed)
*/
/**
class CRM_Grant_DAO_Grant extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.8';
+ const COMPONENT = 'CiviGrant';
/**
* Static instance to hold the table name.
throw new CRM_Core_Exception(ts('No id passed to mailing del function'));
}
- CRM_Utils_Hook::pre('delete', 'Mailing', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Mailing', $id);
// delete all file attachments
CRM_Core_BAO_File::deleteEntityFile('civicrm_mailing',
throw new CRM_Core_Exception(ts('No id passed to MailingAB del function'));
}
CRM_Core_Transaction::create()->run(function () use ($id) {
- CRM_Utils_Hook::pre('delete', 'MailingAB', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'MailingAB', $id);
$dao = new CRM_Mailing_DAO_MailingAB();
$dao->id = $id;
* @return mixed
*/
public static function del($id) {
- CRM_Utils_Hook::pre('delete', 'MailingJob', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'MailingJob', $id);
$jobDAO = new CRM_Mailing_BAO_MailingJob();
$jobDAO->id = $id;
*
* Generated from xml/schema/CRM/Mailing/BouncePattern.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:560357c028d9622650b14d00ff4a988b)
+ * (GenCodeChecksum:b6a045ddc0126618d3ee8c08a1c495b0)
*/
/**
class CRM_Mailing_DAO_BouncePattern extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/BounceType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:5bc7e4fa62c93ca85f2be5049c835364)
+ * (GenCodeChecksum:fda474bf7647672115d82925ba255f6d)
*/
/**
class CRM_Mailing_DAO_BounceType extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Mailing.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:99b193c66e023171c288bf12e2548c9d)
+ * (GenCodeChecksum:e64cedbbdd4a36410257c174d92faae4)
*/
/**
class CRM_Mailing_DAO_Mailing extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/MailingAB.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f272ec7c03cec8fc418235f43faee2f0)
+ * (GenCodeChecksum:175573c32fef00a9a00350db020b1696)
*/
/**
class CRM_Mailing_DAO_MailingAB extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/MailingComponent.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:976aaaac1e4b5b4292eed10c4790c815)
+ * (GenCodeChecksum:c7300c29b273a7e479cd5b77bc951be8)
*/
/**
class CRM_Mailing_DAO_MailingComponent extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/MailingGroup.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:01f3eba5240adc62845ac97f6e0a73db)
+ * (GenCodeChecksum:fca3e29764697a459aa7d5000fec50b5)
*/
/**
class CRM_Mailing_DAO_MailingGroup extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/MailingJob.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:65a91689ae410dcce9b9b181269e6b4d)
+ * (GenCodeChecksum:1b9f973abaa13e77251c3082a4fa7363)
*/
/**
class CRM_Mailing_DAO_MailingJob extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Recipients.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:cbb42af0d0519d97437cb92707a169d8)
+ * (GenCodeChecksum:78ccf653fdbb92c65accfe079140cc43)
*/
/**
class CRM_Mailing_DAO_Recipients extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Spool.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4da95477da6dcac11d1f7d8aade85953)
+ * (GenCodeChecksum:20306dd6c4ce1990d47a78f8cd42606a)
*/
/**
class CRM_Mailing_DAO_Spool extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/TrackableURL.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0cf245411bb62afa6c9b8f63a903f1ad)
+ * (GenCodeChecksum:a3235a7f9b19cd9594dab7408265f615)
*/
/**
class CRM_Mailing_DAO_TrackableURL extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Event/Bounce.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:50ce35d916fa3bda6ce5bc04b623918e)
+ * (GenCodeChecksum:c04dd12381de74d127ab1d4263fd5065)
*/
/**
class CRM_Mailing_Event_DAO_Bounce extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Event/Confirm.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f2ed5f47531f144f3850e179fee6c18f)
+ * (GenCodeChecksum:af8836892ba117428350b4de8dc63c2c)
*/
/**
class CRM_Mailing_Event_DAO_Confirm extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Event/Delivered.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:5c10ce5edff5d1ca52c405080756bb69)
+ * (GenCodeChecksum:c04f2a7f3f1389526bc0e4cee49fcd36)
*/
/**
class CRM_Mailing_Event_DAO_Delivered extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Event/Forward.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0e75326c3a49e51e29781f8a0d532553)
+ * (GenCodeChecksum:fbbbf6b96b04c95b027d76cd7c061eae)
*/
/**
class CRM_Mailing_Event_DAO_Forward extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Event/Opened.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:b875f7351dbd80e0b09eb8aa7118a3ab)
+ * (GenCodeChecksum:cef918cb23efd8adcf04dbd0d7a0e029)
*/
/**
class CRM_Mailing_Event_DAO_Opened extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Event/Queue.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:a1a2a9f4685e49e3888669527b7ccfc9)
+ * (GenCodeChecksum:3125dd5147f0e11ca76fae6a9377dc2e)
*/
/**
class CRM_Mailing_Event_DAO_Queue extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Event/Reply.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:09d539a90e11ec1cb333d10900eaba88)
+ * (GenCodeChecksum:2efc7b66635682132414c6724344bf55)
*/
/**
class CRM_Mailing_Event_DAO_Reply extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Event/Subscribe.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:29a50c0404f021195a3102f41a67f3fa)
+ * (GenCodeChecksum:c1a80e519891849628fc022202ebab69)
*/
/**
class CRM_Mailing_Event_DAO_Subscribe extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Event/TrackableURLOpen.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:7e3b22693523f8453eaa28a44a286de9)
+ * (GenCodeChecksum:b72c3391aec97b4f66c2004364f597b3)
*/
/**
class CRM_Mailing_Event_DAO_TrackableURLOpen extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Mailing/Event/Unsubscribe.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:cbe929e71408b28356b7f66c16fd630b)
+ * (GenCodeChecksum:20666a88b096371a3db2f12eb77a1404)
*/
/**
class CRM_Mailing_Event_DAO_Unsubscribe extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '';
+ const COMPONENT = 'CiviMail';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Member/Membership.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:d7667a8f99b6f74f97eb5d167a10588a)
+ * (GenCodeChecksum:c69464029008f62263d9befb37b79391)
*/
/**
class CRM_Member_DAO_Membership extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.5';
+ const COMPONENT = 'CiviMember';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Member/MembershipBlock.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:213063eacc89b54159a5b8a9be83e154)
+ * (GenCodeChecksum:5e9363fa5064faee6dc27f96afcb4cf3)
*/
/**
class CRM_Member_DAO_MembershipBlock extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.5';
+ const COMPONENT = 'CiviMember';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Member/MembershipLog.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:c566d3d521cd6d8c69985dfee3966f32)
+ * (GenCodeChecksum:7374d7db00c9fe6e86a696434b8bba6f)
*/
/**
class CRM_Member_DAO_MembershipLog extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.5';
+ const COMPONENT = 'CiviMember';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Member/MembershipPayment.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:f9f29f55166a77a306e48917878c13eb)
+ * (GenCodeChecksum:19e551db721c6a286c81456c16568bea)
*/
/**
class CRM_Member_DAO_MembershipPayment extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.5';
+ const COMPONENT = 'CiviMember';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Member/MembershipStatus.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:8a9ae3df6a24e73e88c365b49b794939)
+ * (GenCodeChecksum:32d46c01e3eb4143e83820310037df39)
*/
/**
class CRM_Member_DAO_MembershipStatus extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.5';
+ const COMPONENT = 'CiviMember';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Member/MembershipType.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:23a28ee6fccd8f82844eb2bd78968ce1)
+ * (GenCodeChecksum:867428c502b94f8a8ed29082ac7c3845)
*/
/**
class CRM_Member_DAO_MembershipType extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.5';
+ const COMPONENT = 'CiviMember';
/**
* Static instance to hold the table name.
* Campaign page id.
*/
public static function deleteById($id) {
- CRM_Utils_Hook::pre('delete', 'Campaign', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Campaign', $id);
$transaction = new CRM_Core_Transaction();
*
* Generated from xml/schema/CRM/PCP/PCP.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:90c78e7a79e25aedd5c724e39954fce1)
+ * (GenCodeChecksum:6799d7afab4c8caeb518d19653090978)
*/
/**
class CRM_PCP_DAO_PCP extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '2.2';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/PCP/PCPBlock.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:520b1c5953cbbc59f2d8f017a47447ce)
+ * (GenCodeChecksum:4e188de537dbafef837dcc55947ee1b4)
*/
/**
class CRM_PCP_DAO_PCPBlock extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '2.2';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
* @return mixed
*/
public static function deletePledge($id) {
- CRM_Utils_Hook::pre('delete', 'Pledge', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'Pledge', $id);
$transaction = new CRM_Core_Transaction();
* @return mixed|null
*/
public static function deletePledgeBlock($id) {
- CRM_Utils_Hook::pre('delete', 'PledgeBlock', $id, CRM_Core_DAO::$_nullArray);
+ CRM_Utils_Hook::pre('delete', 'PledgeBlock', $id);
$transaction = new CRM_Core_Transaction();
*
* Generated from xml/schema/CRM/Pledge/Pledge.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:90520b21b729953e89642a110732c3a7)
+ * (GenCodeChecksum:186d3064229a2bd8a2de2483b4bb90c6)
*/
/**
class CRM_Pledge_DAO_Pledge extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '2.1';
+ const COMPONENT = 'CiviPledge';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Pledge/PledgeBlock.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:0013d80a4d2323ab5165901d323c642d)
+ * (GenCodeChecksum:044b9e8fedad0a0e71621172f92bddfb)
*/
/**
class CRM_Pledge_DAO_PledgeBlock extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '2.1';
+ const COMPONENT = 'CiviPledge';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Pledge/PledgePayment.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:29c227f26fe3caa851814aaaf7145a07)
+ * (GenCodeChecksum:4daa04efc77569c5e172fb2c92c956b2)
*/
/**
class CRM_Pledge_DAO_PledgePayment extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '2.1';
+ const COMPONENT = 'CiviPledge';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Price/LineItem.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:6a7eb4dd390df7342c9a7d81f308d5e8)
+ * (GenCodeChecksum:eeaf69c8d27acbb7ad4dd4eba0c587d7)
*/
/**
class CRM_Price_DAO_LineItem extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.7';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Price/PriceField.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:d7e79b4e9e95854e162c629324a05004)
+ * (GenCodeChecksum:82c753fc735a0a09af3c426fff7603cf)
*/
/**
class CRM_Price_DAO_PriceField extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.8';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Price/PriceFieldValue.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:fca6ff018517b3def65b2a381f400c69)
+ * (GenCodeChecksum:d01e238a4afcdf6b79cc2dc59987361d)
*/
/**
class CRM_Price_DAO_PriceFieldValue extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '3.3';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Price/PriceSet.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:af23f33ee60d1b06662c4e11187dbcb6)
+ * (GenCodeChecksum:9252b0d8247c5419198250cbf0a2a9d4)
*/
/**
class CRM_Price_DAO_PriceSet extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.8';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Price/PriceSetEntity.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:bbdb5b9c0e6f8df52ab74238ec47883d)
+ * (GenCodeChecksum:b85629f3ae24a3f503327a5d60f4f17f)
*/
/**
class CRM_Price_DAO_PriceSetEntity extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '1.8';
+ const COMPONENT = 'CiviContribute';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/Queue/QueueItem.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:21270fc0075d353032051ac4343095bc)
+ * (GenCodeChecksum:2ec3738d4db4ad5473162176d25f552c)
*/
/**
*
* Generated from xml/schema/CRM/Report/ReportInstance.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:4a333db47b94692a5cbc5395fdfcb899)
+ * (GenCodeChecksum:7c11a51cc566e33761a9f06522c43bbd)
*/
/**
class CRM_Report_DAO_ReportInstance extends CRM_Core_DAO {
const EXT = 'civicrm';
const TABLE_ADDED = '2.2';
+ const COMPONENT = 'CiviReport';
/**
* Static instance to hold the table name.
*
* Generated from xml/schema/CRM/SMS/Provider.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:abd82ad9d4a5b45b82523ec84dcf848a)
+ * (GenCodeChecksum:6501ba50ba1ce7df2d0408cc78bb012c)
*/
/**
}
else {
// get the submitted form values.
- $ids = [];
$params = $this->controller->exportValues($this->_name);
if (!array_key_exists('is_active', $params)) {
}
if ($this->_action & (CRM_Core_Action::UPDATE)) {
- $ids['ufgroup'] = $this->_id;
+ $params['id'] = $this->_id;
// CRM-5284
// lets skip trying to mess around with profile weights and allow the user to do as needed.
}
}
// create uf group
- $ufGroup = CRM_Core_BAO_UFGroup::add($params, $ids);
+ $ufGroup = CRM_Core_BAO_UFGroup::add($params);
if (!empty($params['is_active'])) {
//make entry in uf join table
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ * Upgrade logic for FiveThirtyFour */
+class CRM_Upgrade_Incremental_php_FiveThirtyFour extends CRM_Upgrade_Incremental_Base {
+
+ /**
+ * Compute any messages which should be displayed beforeupgrade.
+ *
+ * Note: This function is called iteratively for each upcoming
+ * revision to the database.
+ *
+ * @param string $preUpgradeMessage
+ * @param string $rev
+ * a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'.
+ * @param null $currentVer
+ */
+ public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL) {
+ // Example: Generate a pre-upgrade message.
+ // if ($rev == '5.12.34') {
+ // $preUpgradeMessage .= '<p>' . ts('A new permission, "%1", has been added. This permission is now used to control access to the Manage Tags screen.', array(1 => ts('manage tags'))) . '</p>';
+ // }
+ }
+
+ /**
+ * Compute any messages which should be displayed after upgrade.
+ *
+ * @param string $postUpgradeMessage
+ * alterable.
+ * @param string $rev
+ * an intermediate version; note that setPostUpgradeMessage is called repeatedly with different $revs.
+ */
+ public function setPostUpgradeMessage(&$postUpgradeMessage, $rev) {
+ // Example: Generate a post-upgrade message.
+ // if ($rev == '5.12.34') {
+ // $postUpgradeMessage .= '<br /><br />' . ts("By default, CiviCRM now disables the ability to import directly from SQL. To use this feature, you must explicitly grant permission 'import SQL datasource'.");
+ // }
+ }
+
+ /*
+ * Important! All upgrade functions MUST add a 'runSql' task.
+ * Uncomment and use the following template for a new upgrade version
+ * (change the x in the function name):
+ */
+
+ // /**
+ // * Upgrade function.
+ // *
+ // * @param string $rev
+ // */
+ // public function upgrade_5_0_x($rev) {
+ // $this->addTask(ts('Upgrade DB to %1: SQL', [1 => $rev]), 'runSql', $rev);
+ // $this->addTask('Do the foo change', 'taskFoo', ...);
+ // // Additional tasks here...
+ // // Note: do not use ts() in the addTask description because it adds unnecessary strings to transifex.
+ // // The above is an exception because 'Upgrade DB to %1: SQL' is generic & reusable.
+ // }
+
+ // public static function taskFoo(CRM_Queue_TaskContext $ctx, ...) {
+ // return TRUE;
+ // }
+
+}
--- /dev/null
+{* file to handle db changes in 5.33.beta1 during upgrade *}
--- /dev/null
+{* file to handle db changes in 5.34.alpha1 during upgrade *}
case CRM_Extension_Manager::STATUS_INSTALLED:
if (!empty($remotes[$key]) && version_compare($row['version'], $remotes[$key]->version, '<')) {
- $updates[] = ts('%1 (%2) version %3 is installed. <a %4>Upgrade to version %5</a>.', [
- 1 => $row['label'] ?? NULL,
- 2 => $key,
- 3 => $row['version'],
- 4 => 'href="' . CRM_Utils_System::url('civicrm/admin/extensions', "action=update&id=$key&key=$key") . '"',
- 5 => $remotes[$key]->version,
- ]);
+ $updates[] = $row['label'] . ': ' . $mapper->getUpgradeLink($remotes[$key], $row);
}
else {
if (empty($row['label'])) {
$okextensions[] = $key;
}
else {
- $okextensions[] = ts('%1 (%2) version %3', [
+ $okextensions[] = ts('%1: Version %2', [
1 => $row['label'],
- 2 => $key,
- 3 => $row['version'],
+ 2 => $row['version'],
]);
}
}
* @return null
* the return value is ignored
*/
- public static function pre($op, $objectName, $id, &$params) {
+ public static function pre($op, $objectName, $id, &$params = []) {
$event = new \Civi\Core\Event\PreEvent($op, $objectName, $id, $params);
\Civi::dispatcher()->dispatch('hook_civicrm_pre', $event);
return $event->getReturnValues();
--- /dev/null
+<?php
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+/**
+ *
+ * @package CiviCRM
+ * @copyright CiviCRM LLC https://civicrm.org/licensing
+ */
+class CRM_Utils_Monaco {
+
+ /**
+ * Get a list of JS variables (`CRM.crmMonaco`) to provide to the browser.
+ *
+ * @return array
+ * @see CRM_Utils_Hook::alterAngular()
+ */
+ public static function getSettings() {
+ return [
+ 'paths' => [
+ 'vs' => Civi::paths()->getUrl('[civicrm.bower]/monaco-editor/min/vs'),
+ ],
+ ];
+ }
+
+}
return ['ufAccessURL' => \Drupal\Core\Url::fromRoute('user.admin_permissions')->toString()];
}
+ /**
+ * Start a new session.
+ */
+ public function sessionStart() {
+ if (\Drupal::hasContainer()) {
+ $session = \Drupal::service('session');
+ if (!$session->isStarted()) {
+ $session->start();
+ }
+ }
+ }
+
}
* Get a normalized version of the wpBasePage.
*/
public static function getBasePage() {
- return rtrim(Civi::settings()->get('wpBasePage'), '/');
+ return strtolower(rtrim(Civi::settings()->get('wpBasePage'), '/'));
}
/**
$angularModules['crmAttachment'] = include "$civicrm_root/ang/crmAttachment.ang.php";
$angularModules['crmAutosave'] = include "$civicrm_root/ang/crmAutosave.ang.php";
$angularModules['crmCxn'] = include "$civicrm_root/ang/crmCxn.ang.php";
+ $angularModules['crmMonaco'] = include "$civicrm_root/ang/crmMonaco.ang.php";
$angularModules['crmResource'] = include "$civicrm_root/ang/crmResource.ang.php";
$angularModules['crmRouteBinder'] = include "$civicrm_root/ang/crmRouteBinder.ang.php";
$angularModules['crmUi'] = include "$civicrm_root/ang/crmUi.ang.php";
*
* Creating a new ACL requires at minimum an entity table, entity ID and object_table.
*
+ * @searchable false
* @see https://docs.civicrm.org/user/en/latest/initial-set-up/permissions-and-access-control
* @package Civi\Api4
*/
/**
* Get the names & docblocks of all APIv4 entities.
*
- * Scans for api entities in core + enabled extensions.
+ * Scans for api entities in core, enabled components & enabled extensions.
*
* Also includes pseudo-entities from multi-record custom groups by default.
*
$locations = array_merge([\Civi::paths()->getPath('[civicrm.root]/Civi.php')],
array_column(\CRM_Extension_System::singleton()->getMapper()->getActiveModuleFiles(), 'filePath')
);
+ $enabledComponents = array_keys(\CRM_Core_Component::getEnabledComponents());
foreach ($locations as $location) {
$dir = \CRM_Utils_File::addTrailingSlash(dirname($location)) . 'Civi/Api4';
if (is_dir($dir)) {
&& is_a($entity, '\Civi\Api4\Generic\AbstractEntity', TRUE)
) {
$info = $entity::getInfo();
- $entities[$info['name']] = $info;
+ // Only include DAO entities from enabled components
+ if (empty($info['dao']) || !defined($info['dao'] . '::COMPONENT') || in_array(constant($info['dao'] . '::COMPONENT'), $enabledComponents)) {
+ $entities[$info['name']] = $info;
+ }
}
}
}
*
* Creating a new ActionSchedule requires at minimum a title, mapping_id and entity_value.
*
+ * @searchable false
* @see https://docs.civicrm.org/user/en/latest/email/scheduled-reminders/
* @package Civi\Api4
*/
* @package Civi\Api4
*/
class ContactType extends Generic\DAOEntity {
+ use Generic\Traits\OptionList;
}
--- /dev/null
+<?php
+
+/*
+ +--------------------------------------------------------------------+
+ | Copyright CiviCRM LLC. All rights reserved. |
+ | |
+ | This work is published under the GNU AGPLv3 license with some |
+ | permitted exceptions and without any warranty. For full license |
+ | and copyright information, see https://civicrm.org/licensing |
+ +--------------------------------------------------------------------+
+ */
+
+namespace Civi\Api4;
+
+/**
+ * ContributionSoft entity.
+ *
+ * @package Civi\Api4
+ */
+class ContributionSoft extends Generic\DAOEntity {
+
+}
* CustomField entity.
*
* @see https://docs.civicrm.org/user/en/latest/organising-your-data/creating-custom-fields/
- *
+ * @searchable false
* @package Civi\Api4
*/
class CustomField extends Generic\DAOEntity {
* CustomGroup entity.
*
* @see https://docs.civicrm.org/user/en/latest/organising-your-data/creating-custom-fields/
- *
+ * @searchable false
* @package Civi\Api4
*/
class CustomGroup extends Generic\DAOEntity {
* Displaying an item to a user is done with the `DashboardContact` entity.
*
* @see \Civi\Api4\DashboardContact
+ * @searchable false
* @package Civi\Api4
*/
class Dashboard extends Generic\DAOEntity {
* This places a dashboard item on a user's home screen.
*
* @see \Civi\Api4\Dashboard
+ * @searchable false
* @package Civi\Api4
*/
class DashboardContact extends Generic\DAOEntity {
* Domains - multisite instances of CiviCRM.
*
* @see https://docs.civicrm.org/sysadmin/en/latest/setup/multisite/
- *
+ * @searchable false
* @package Civi\Api4
*/
class Domain extends Generic\DAOEntity {
'name' => 'dao',
'description' => 'Class name for dao-based entities',
],
+ [
+ 'name' => 'searchable',
+ 'description' => 'Should this entity be selectable in search kit UI',
+ ],
[
'name' => 'paths',
'data_type' => 'Array',
foreach (ReflectionUtils::getTraits(static::class) as $trait) {
$info['type'][] = self::stripNamespace($trait);
}
+ $info['searchable'] = !in_array('OptionList', $info['type']);
$reflection = new \ReflectionClass(static::class);
- $info += ReflectionUtils::getCodeDocs($reflection, NULL, ['entity' => $info['name']]);
+ $info = array_merge($info, ReflectionUtils::getCodeDocs($reflection, NULL, ['entity' => $info['name']]));
unset($info['package'], $info['method']);
return $info;
}
$customTable = CoreUtil::getTableName($this->getEntityName());
$ids = [];
foreach ($items as $item) {
- \CRM_Utils_Hook::pre('delete', $this->getEntityName(), $item['id'], \CRM_Core_DAO::$_nullArray);
+ \CRM_Utils_Hook::pre('delete', $this->getEntityName(), $item['id']);
\CRM_Utils_SQL_Delete::from($customTable)
->where('id = #value')
->param('#value', $item['id'])
* A bridge is a small table that provides an intermediary link between two other tables.
*
* The API can automatically incorporate a Bridge into a join expression.
+ *
+ * Note: at time of writing this trait does nothing except affect the "type" shown in Entity::get() metadata.
*/
trait EntityBridge {
* An optionList is a small entity whose primary purpose is to supply a semi-static list of options to fields in other entities.
*
* The options appear in the field metadata for other entities that reference this one via pseudoconstant.
+ *
+ * Note: At time of writing, this trait does nothing except toggle the searchable flag, (and adds "OptionList" to the "type" in Entity::get() metadata).
+ * @searchable false (FYI annotation isn't functional because this is a trait - workaround in AbstractEntity::getInfo)
*/
trait OptionList {
* GroupNesting entity.
*
* @see \Civi\Api4\Group
- *
+ * @searchable false
* @package Civi\Api4
*/
class GroupNesting extends Generic\DAOEntity {
* @package Civi\Api4
*/
class GroupOrganization extends Generic\DAOEntity {
+ use Generic\Traits\EntityBridge;
}
namespace Civi\Api4;
/**
- * ContributionPage entity.
+ * LocBlock entity.
*
+ * Links addresses, emails & phones to Events.
+ *
+ * @searchable false
* @package Civi\Api4
*/
class LocBlock extends Generic\DAOEntity {
/**
* MailSettings entity.
*
+ * @searchable false
* @package Civi\Api4
*/
class MailSettings extends Generic\DAOEntity {
*
* This is a collection of MappingFields, for reuse in import, export, etc.
*
+ * @searchable false
* @package Civi\Api4
*/
class Mapping extends Generic\DAOEntity {
* This represents one field in a Mapping collection.
*
* @see \Civi\Api4\Mapping
- *
+ * @searchable false
* @package Civi\Api4
*/
class MappingField extends Generic\DAOEntity {
* MsgTemplate entity.
*
* This is a collection of MsgTemplate, for reuse in import, export, etc.
- *
+ * @searchable false
* @package Civi\Api4
*/
class MessageTemplate extends Generic\DAOEntity {
/**
* Navigation entity.
*
+ * @searchable false
* @package Civi\Api4
*/
class Navigation extends Generic\DAOEntity {
* @package Civi\Api4
*/
class OptionGroup extends Generic\DAOEntity {
+ use Generic\Traits\OptionList;
}
* @package Civi\Api4
*/
class PaymentProcessor extends Generic\DAOEntity {
+ use Generic\Traits\OptionList;
}
* Relationship entity.
*
* @see https://docs.civicrm.org/user/en/latest/organising-your-data/relationships/
- *
+ * @searchable false
* @package Civi\Api4
*/
class Relationship extends Generic\DAOEntity {
* Note: this is a read-only api as routes are set via xml files and hooks.
*
* @see https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_alterMenu/
- *
+ * @searchable false
* @package Civi\Api4
*/
class Route extends \Civi\Api4\Generic\AbstractEntity {
* Stores search parameters for populating smart groups with live results.
*
* @see https://docs.civicrm.org/user/en/latest/organising-your-data/smart-groups/
+ * @searchable false
* @package Civi\Api4
*/
class SavedSearch extends Generic\DAOEntity {
* Used to read/write persistent setting data from CiviCRM.
*
* @see \Civi\Core\SettingsBag
+ * @searchable false
* @package Civi\Api4
*/
class Setting extends Generic\AbstractEntity {
*
* For setting "hush" preferences for system check alerts.
*
+ * @searchable false
* @package Civi\Api4
*/
class StatusPreference extends Generic\DAOEntity {
* UFField entity - aka profile fields.
*
* @see \Civi\Api4\UFGroup
+ * @searchable false
* @package Civi\Api4
*/
class UFField extends Generic\DAOEntity {
* UFGroup entity - AKA profiles.
*
* @see https://docs.civicrm.org/user/en/latest/organising-your-data/profiles/
+ * @searchable false
* @package Civi\Api4
*/
class UFGroup extends Generic\DAOEntity {
* UFJoin entity - links profiles to the components/extensions they are used for.
*
* @see \Civi\Api4\UFGroup
+ * @searchable false
* @package Civi\Api4
*/
class UFJoin extends Generic\DAOEntity {
/**
* UFMatch entity - links civicrm contacts with users created externally
*
+ * @searchable false
* @package Civi\Api4
*/
class UFMatch extends Generic\DAOEntity {
elseif ($key == 'throws' || $key == 'see') {
$info[$key][] = implode(' ', $words);
}
+ elseif ($key == 'searchable') {
+ $info[$key] = strtolower($words[0]) !== 'false';
+ }
elseif ($key == 'param' && $words) {
$type = $words[0][0] !== '$' ? explode('|', array_shift($words)) : NULL;
$param = rtrim(array_shift($words), '-:()/');
/**
* This function exists to wrap api getValue function & check the result
- * so we can ensure they succeed & throw exceptions without litterering the test with checks
+ * so we can ensure they succeed & throw exceptions without littering the test with checks
* There is a type check in this
*
* @param string $entity
>
<option value="">{{:: ts('Automatic') }}</option>
<option ng-repeat="locType in model.fields.location_type_id.options"
- ng-value="locType.key">{{locType.value}}</option>
+ value="{{ locType.key }}">{{locType.value}}</option>
</select>
</div>
ng-model="model.mailing.email_selection_method"
>
<option ng-repeat="selMet in model.fields.email_selection_method.options"
- ng-value="selMet.key">{{selMet.value}}</option>
+ value="{{ selMet.key }}">{{selMet.value}}</option>
</select>
</div>
ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)"
>
<option value=""></option>
- <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option>
+ <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" value="{{ frm.id }}">{{frm.msg_title}}</option>
</select>
<a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{:: ts('Save As') }}"></a>
</div>
ng-change="loadTemplate(abtest.mailings.a, abtest.mailings.a.msg_template_id)"
>
<option value=""></option>
- <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option>
+ <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" value="{{ frm.id }}">{{frm.msg_title}}</option>
</select>
<a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.a)" class="crm-hover-button" title="{{:: ts('Save As') }}"></a>
</div>
ng-change="loadTemplate(abtest.mailings.b, abtest.mailings.b.msg_template_id)"
>
<option value=""></option>
- <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" ng-value="frm.id">{{frm.msg_title}}</option>
+ <option ng-repeat="frm in crmMsgTemplates.getAll() | orderBy:'msg_title'" value="{{ frm.id }}">{{frm.msg_title}}</option>
</select>
<a crm-icon="fa-floppy-o" ng-click="saveTemplate(abtest.mailings.b)" class="crm-hover-button" title="{{:: ts('Save As') }}"></a>
</div>
<span>
<select crm-ui-select style="width: 10em;" ng-model="filter.status">
<option value="">{{:: ts('- Status -') }}</option>
- <option ng-repeat="o in fields.status.options" ng-value="o.key">{{o.value}}</option>
+ <option ng-repeat="o in fields.status.options" value="{{o.key}}">{{o.value}}</option>
</select>
</span>
<span>
<select crm-ui-select style="width: 20em;" ng-model="filter.testing_criteria">
<option value="">{{:: ts('- Test Type -') }}</option>
- <option ng-repeat="o in fields.testing_criteria.options" ng-value="o.key">{{o.value}}</option>
+ <option ng-repeat="o in fields.testing_criteria.options" value="{{o.key}}">{{o.value}}</option>
</select>
</span>
</form>
--- /dev/null
+<?php
+return array(
+ 'ext' => 'civicrm',
+ 'js' => [
+ 'bower_components/monaco-editor/min/vs/loader.js',
+ 'ang/crmMonaco.js',
+ // 'ang/crmMonaco/*.js',
+ // 'ang/crmMonaco/*/*.js',
+ ],
+ 'css' => ['ang/crmMonaco.css'],
+ // 'partials' => ['ang/crmMonaco'],
+ 'requires' => ['crmUi', 'crmUtil'],
+ 'settingsFactory' => ['CRM_Utils_Monaco', 'getSettings'],
+ 'basePages' => [],
+ 'exports' => [
+ 'crm-monaco' => 'A',
+ ],
+);
--- /dev/null
+/* Add any CSS rules for Angular module "crmMonaco" */
+.crm-monaco-container {
+ border:1px solid grey;
+}
\ No newline at end of file
(function(angular, $, _) {
- angular.module('afMonaco', CRM.angRequires('afMonaco'));
+ angular.module('crmMonaco', CRM.angRequires('crmMonaco'));
- // "afMonaco" is a basic skeletal directive.
- // Example usage: <div af-monaco ng-model="my.content"></div>
- angular.module('afMonaco').directive('afMonaco', function($timeout) {
+ // "crmMonaco" is a basic skeletal directive.
+ // Example usage: <div crm-monaco ng-model="my.content"></div>
+ // Example usage: <div crm-monaco="{readOnly: true}" ng-model="my.content"></div>
+ angular.module('crmMonaco').directive('crmMonaco', function($timeout, $parse) {
return {
restrict: 'AE',
require: 'ngModel',
- template: '<div class="af-monaco-container"></div>',
+ template: '<div class="crm-monaco-container"></div>',
link: function($scope, $el, $attr, ngModel) {
var heightPct = 0.70;
var editor;
- require.config({paths: CRM.afMonaco.paths});
+ require.config({paths: CRM.crmMonaco.paths});
require(['vs/editor/editor.main'], function() {
- var editorEl = $el.find('.af-monaco-container');
- editorEl.css({height: Math.round(heightPct * $(window).height())});
- editor = monaco.editor.create(editorEl[0], {
- value: ngModel.$modelValue,
+ var options = {
+ readOnly: false,
language: 'html',
// theme: 'vs-dark',
- theme: 'vs',
+ theme: 'vs'
+ };
+ if ($attr.crmMonaco) {
+ angular.extend(options, $parse($attr.crmMonaco)($scope));
+ }
+ angular.extend(options, {
+ value: ngModel.$modelValue,
minimap: {
enabled: false
},
}
});
+ var editorEl = $el.find('.crm-monaco-container');
+ editorEl.css({height: Math.round(heightPct * $(window).height())});
+ editor = monaco.editor.create(editorEl[0], options);
+
editor.onDidChangeModelContent(_.debounce(function () {
$scope.$apply(function () {
ngModel.$setViewValue(editor.getValue());
},
"require": {
"php": "~7.1",
- "cache/integration-tests": "~0.16.0",
+ "cache/integration-tests": "~0.17.0",
"dompdf/dompdf" : "~0.8",
"electrolinux/phpquery": "^0.9.6",
"symfony/config": "~3.0 || ~4.4",
},
"monaco-editor": {
"url": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.16.2.tgz",
- "path": "ext/afform/html/bower_components/monaco-editor"
+ "path": "bower_components/monaco-editor"
},
"google-code-prettify": {
"url": "https://github.com/tcollard/google-code-prettify/archive/v1.0.5.zip",
"adrienrn/php-mimetyper": {
"Update gitignore to ensure that sites that manage via git don't miss out on the important db.json file": "https://patch-diff.githubusercontent.com/raw/adrienrn/php-mimetyper/pull/15.patch"
},
- "cache/integration-tests": {
- "Allow adding tests": "https://github.com/php-cache/integration-tests/commit/05f97174c09364dc10c084a38ba0cfd5124f4cec.patch",
- "Support PHPUnit 6+": "https://github.com/php-cache/integration-tests/commit/1ec7362962185df91d3d749bc3fa7e7b99cb9fc7.patch",
- "Add tests for binary data round trip": "https://github.com/php-cache/integration-tests/commit/89cd7068e83aa776774bfc44f6bcba858c085616.patch"
- },
"electrolinux/phpquery": {
"PHP7.4 Fix for array access using {} instead of []": "https://raw.githubusercontent.com/civicrm/civicrm-core/fe45bdfc4f3e3d3deb27e3d853cdbc7f616620a9/tools/scripts/composer/patches/php74_array_access_fix_phpquery.patch"
},
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "0a477e3a819cc7555e2993da4e8e1754",
+ "content-hash": "f32350338fcd33fb89de9bcea7a49125",
"packages": [
{
"name": "adrienrn/php-mimetyper",
},
{
"name": "cache/integration-tests",
- "version": "0.16.0",
+ "version": "0.17.0",
"source": {
"type": "git",
"url": "https://github.com/php-cache/integration-tests.git",
- "reference": "a8d9538a44ed5a70d551f9b87f534c98dfe6b0ee"
+ "reference": "eda2e6b8bc5abcd623c8047e2345cda38dd6479e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-cache/integration-tests/zipball/a8d9538a44ed5a70d551f9b87f534c98dfe6b0ee",
- "reference": "a8d9538a44ed5a70d551f9b87f534c98dfe6b0ee",
+ "url": "https://api.github.com/repos/php-cache/integration-tests/zipball/eda2e6b8bc5abcd623c8047e2345cda38dd6479e",
+ "reference": "eda2e6b8bc5abcd623c8047e2345cda38dd6479e",
"shasum": ""
},
"require": {
"cache/tag-interop": "^1.0",
- "php": "^5.4|^7",
+ "php": ">=5.5.9",
"psr/cache": "~1.0"
},
+ "conflict": {
+ "phpunit/phpunit": "<4.8.35|<5.4.3,>=5.0"
+ },
"require-dev": {
- "cache/cache": "dev-master",
- "illuminate/cache": "^5.0",
- "madewithlove/illuminate-psr-cache-bridge": "^1.0",
- "phpunit/phpunit": "^4.0|^5.0",
- "symfony/cache": "^3.1",
- "tedivm/stash": "dev-master"
+ "cache/cache": "^1.0",
+ "illuminate/cache": "^5.4|^5.5|^5.6",
+ "mockery/mockery": "^1.0",
+ "symfony/cache": "^3.4.31|^4.3.4|^5.0",
+ "symfony/phpunit-bridge": "^5.1",
+ "tedivm/stash": "^0.14"
},
"type": "library",
- "extra": {
- "patches_applied": {
- "Allow adding tests": "https://github.com/php-cache/integration-tests/commit/05f97174c09364dc10c084a38ba0cfd5124f4cec.patch",
- "Support PHPUnit 6+": "https://github.com/php-cache/integration-tests/commit/1ec7362962185df91d3d749bc3fa7e7b99cb9fc7.patch",
- "Add tests for binary data round trip": "https://github.com/php-cache/integration-tests/commit/89cd7068e83aa776774bfc44f6bcba858c085616.patch"
- }
- },
"autoload": {
"psr-4": {
"Cache\\IntegrationTests\\": "src/"
{
"name": "Tobias Nyholm",
"email": "tobias.nyholm@gmail.com",
- "homepage": "https://github.com/Nyholm"
+ "homepage": "https://github.com/nyholm"
}
],
"description": "Integration tests for PSR-6 and PSR-16 cache implementations",
"psr6",
"test"
],
- "time": "2017-02-02T14:29:50+00:00"
+ "time": "2020-11-03T12:52:23+00:00"
},
{
"name": "cache/tag-interop",
--- /dev/null
+<?php
+
+namespace Civi\Api4\Action\Afform;
+
+use Civi\Api4\Generic\AbstractAction;
+use Civi\Api4\Generic\Result;
+
+/**
+ * Convert afform layouts between different representations, e.g. from
+ * a deep array to HTML.
+ *
+ * @method setLayout(mixed $layout)
+ * @method getLayout(): mixed
+ * @method setFrom(string $layoutFormat)
+ * @method getFrom(): string
+ * @method setTo(string $layoutFormat)
+ * @method getTo(): string
+ * @method setFormatWhitespace(string $layoutFormat)
+ * @method getFormatWhitespace(): string
+ *
+ * @package Civi\Api4\Action\Afform
+ */
+class Convert extends AbstractAction {
+
+ /**
+ * @var string|array
+ */
+ protected $layout;
+
+ /**
+ * How is the input `$layout` formatted?
+ *
+ * @var string
+ * @options html,shallow,deep
+ */
+ protected $from = NULL;
+
+ /**
+ * How should the `$layout` be returned?
+ *
+ * @var string
+ * @options html,shallow,deep
+ */
+ protected $to = NULL;
+
+ /**
+ * Normalize whitespace?
+ *
+ * @var bool
+ */
+ protected $formatWhitespace = FALSE;
+
+ public function _run(Result $result) {
+ // Normalize to HTML
+ if ($this->from === 'html') {
+ $interimHtml = $this->layout;
+ }
+ else {
+ $converter = new \CRM_Afform_ArrayHtml($this->from !== 'shallow', $this->formatWhitespace);
+ $interimHtml = $converter->convertTreeToHtml($this->layout);
+ }
+
+ // And go to preferred format
+ if ($this->to === 'html') {
+ $final = $interimHtml;
+ }
+ else {
+ $converter = new \CRM_Afform_ArrayHtml($this->to !== 'shallow', $this->formatWhitespace);
+ $final = $converter->convertHtmlToArray($interimHtml);
+ }
+
+ $result[] = [
+ 'layout' => $final,
+ ];
+ }
+
+}
* The `prefill` and `submit` actions are used for preparing forms and processing submissions.
*
* @see https://lab.civicrm.org/extensions/afform
+ * @searchable false
* @package Civi\Api4
*/
class Afform extends Generic\AbstractEntity {
->setCheckPermissions($checkPermissions);
}
+ /**
+ * @param bool $checkPermissions
+ * @return Action\Afform\Convert
+ */
+ public static function convert($checkPermissions = TRUE) {
+ return (new Action\Afform\Convert('Afform', __FUNCTION__))
+ ->setCheckPermissions($checkPermissions);
+ }
+
/**
* @param bool $checkPermissions
* @return Action\Afform\Prefill
/**
* Class AfformPalette
+ * @searchable false
* @package Civi\Api4
*/
class AfformPalette extends Generic\AbstractEntity {
/**
* Class AfformTag
+ * @searchable false
* @package Civi\Api4
*/
class AfformTag extends Generic\AbstractEntity {
$params['values'] = ['contact_type' => $entityType];
$entityType = 'Contact';
}
- $getFields = civicrm_api4($entityType, 'getFields', $params);
- // Merge field definition data with whatever's already in the markup
+ // Merge field definition data with whatever's already in the markup.
+ // If the admin has chosen to include this field on the form, then it's OK for us to get metadata about the field - regardless of user's other permissions.
+ $getFields = civicrm_api4($entityType, 'getFields', $params + ['checkPermissions' => FALSE]);
$deep = ['input_attrs'];
foreach ($getFields as $fieldInfo) {
$existingFieldDefn = trim(pq($afField)->attr('defn') ?: '');
],
'css' => ['ang/afGuiEditor.css'],
'partials' => ['ang/afGuiEditor'],
- 'requires' => ['crmUi', 'crmUtil', 'dialogService', 'api4'],
+ 'requires' => ['crmUi', 'crmUtil', 'dialogService', 'api4', 'crmMonaco'],
'settings' => [],
'basePages' => [],
'exports' => [
width: 300px;
}
-#afGuiEditor-canvas .panel-heading .btn-group {
- position: relative;
- top: -8px;
-}
-
#afGuiEditor .af-gui-button {
padding-left: 15px;
}
alert('Error: unknown form "' + $scope.afGuiEditor.name + '"');
}
}
+ $scope.canvasTab = 'layout';
+ $scope.layoutHtml = '';
$scope.layout = findRecursive($scope.afform.layout, {'#tag': 'af-form'})[0];
$scope.entities = findRecursive($scope.layout['#children'], {'#tag': 'af-entity'}, 'name');
}, true);
}
+ $scope.updateLayoutHtml = function() {
+ $scope.layoutHtml = '...Loading...';
+ crmApi4('Afform', 'convert', {layout: [$scope.layout], from: 'deep', to: 'html', formatWhitespace: true})
+ .then(function(r){
+ $scope.layoutHtml = r[0].layout || '(Error)';
+ })
+ .catch(function(r){
+ $scope.layoutHtml = '(Error)';
+ });
+ };
+
this.addEntity = function(type) {
var meta = editor.meta.entities[type],
num = 1;
<div class="panel panel-default">
<div class="panel-heading">
- <form class="form-inline">
- <div class="btn-group btn-group-md pull-right">
- <button type="submit" class="btn" ng-class="{'btn-primary': !changesSaved && !saving, 'btn-warning': saving, 'btn-success': changesSaved}" ng-disabled="changesSaved || saving || !afform.title" ng-click="save()">
- <i class="crm-i" ng-class="{'fa-check': !saving, 'fa-spin fa-spinner': saving}"></i>
- <span ng-if="changesSaved && !saving">{{ ts('Saved') }}</span>
- <span ng-if="!changesSaved && !saving">{{ ts('Save') }}</span>
- <span ng-if="saving">{{ ts('Saving...') }}</span>
- </button>
- </div>
- <div>{{ ts('Form Layout') }}</div>
- </form>
+
+ <div class="btn-group btn-group-md pull-right">
+ <button type="submit" class="btn" ng-class="{'btn-primary': !changesSaved && !saving, 'btn-warning': saving, 'btn-success': changesSaved}" ng-disabled="changesSaved || saving || !afform.title" ng-click="save()">
+ <i class="crm-i" ng-class="{'fa-check': !saving, 'fa-spin fa-spinner': saving}"></i>
+ <span ng-if="changesSaved && !saving">{{ ts('Saved') }}</span>
+ <span ng-if="!changesSaved && !saving">{{ ts('Save') }}</span>
+ <span ng-if="saving">{{ ts('Saving...') }}</span>
+ </button>
+ </div>
+
+ <ul class="nav nav-tabs">
+ <li role="presentation" ng-class="{active: canvasTab === 'layout'}">
+ <a ng-click="canvasTab = 'layout'">
+ <span>{{ ts('Form Layout') }}</span>
+ </a>
+ </li>
+ <li role="presentation" ng-class="{active: canvasTab === 'markup'}">
+ <a ng-click="canvasTab = 'markup'; updateLayoutHtml()">
+ <span>{{ ts('Markup') }}</span>
+ </a>
+ </li>
+ </ul>
+
</div>
- <div id="afGuiEditor-canvas-body" class="panel-body">
+ <div id="afGuiEditor-canvas-body" class="panel-body" ng-if="canvasTab === 'layout'">
<div ng-if="layout" af-gui-container="layout" entity-name="" />
</div>
+ <div class="panel-body" ng-if="canvasTab === 'markup'">
+ <p class="help-block">{{ts('This is a read-only preview of the auto-generated markup.')}}</p>
+ <!-- Wiring up edit mode wouldn't be super-hard in itself, but it's not worthwhile until we have validation to ensure that GUI+raw content are exchangeable -->
+ <div crm-monaco="{readOnly: true}" ng-model="layoutHtml"></div>
+ </div>
+
</div>
{{ ts('Description:') }}
</label>
<textarea ng-model="afform.description" class="form-control" id="af_config_form_description"></textarea>
+ <p class="help-block">{{ts('Semi-private description about the form\'s purpose.')}}</p>
+ <!-- "Semi-private": not generally public, but not audited for secrecy -->
</div>
<div class="form-group">
<label for="af_config_form_server_route">
- {{ ts('URL:') }}
+ {{ ts('Path:') }}
</label>
<input ng-model="afform.server_route" class="form-control" id="af_config_form_server_route" />
+ <p class="help-block">{{ts('Expose the form as a standalone page on the web site. (Example: "civicrm/my-form")')}}</p>
</div>
-<div class="form-group">
- <label for="af_config_form_permission">
- {{ ts('Permission:') }}
+<div class="form-group" ng-if="!!afform.server_route">
+ <label for="af_config_form_is_public">
+ <input type="checkbox" id="af_config_form_is_public" ng-model="afform.is_public">
+ {{ ts('Enable frontend styling') }}
</label>
- <input ng-model="afform.permission" class="form-control" id="af_config_form_permission" crm-ui-select="{data: editor.meta.permissions, placeholder: ts('Open access')}" />
+ <p class="help-block">{{ts('The general look/feel should match the frontend')}}</p>
</div>
<div class="form-group">
<input type="checkbox" id="af_config_form_is_dashlet" ng-model="afform.is_dashlet">
{{ ts('Enable dashlet') }}
</label>
+ <p class="help-block">{{ts('Allow backend users to embed the form on the dashboard.')}}</p>
+</div>
+
+<div class="form-group">
+ <label for="af_config_form_permission">
+ {{ ts('Permission:') }}
+ </label>
+ <input ng-model="afform.permission" class="form-control" id="af_config_form_permission" crm-ui-select="{data: editor.meta.permissions, placeholder: ts('Open access')}" />
+ <p class="help-block">{{ts('What permission is required to use this form?')}}</p>
</div>
</ng-form>
function afform_html_civicrm_themes(&$themes) {
_afform_html_civix_civicrm_themes($themes);
}
-
-/**
- * Implements hook_civicrm_check().
- */
-function afform_html_civicrm_check(&$messages) {
- $dir = E::path(AFFORM_HTML_MONACO);
- if (!file_exists($dir)) {
- $messages[] = new CRM_Utils_Check_Message(
- 'afform_html_monaco',
- ts('Afform HTML is missing its "bower_components" folder. Please consult the README.md for current installation instructions.'),
- ts('Afform HTML: Packages are missing'),
- \Psr\Log\LogLevel::CRITICAL,
- 'fa-chain-broken'
- );
- }
-}
-<div ng-if="!routeParams.name">
- <div af-html-list=""></div>
-</div>
+<div class="bootstrap-theme">
+ <div ng-if="!routeParams.name">
+ <div af-html-list=""></div>
+ </div>
-<div ng-if="routeParams.name">
- <div af-html-editor="{name: routeParams.name}"></div>
+ <div ng-if="routeParams.name">
+ <div af-html-editor="{name: routeParams.name}"></div>
+ </div>
</div>
{{ts('Failed to find requested form.')}}
</div>
- <div ng-repeat="resultForm in apiData.result" ng-if="apiData.result.length > 0">
- <div crm-ui-debug="resultForm"></div>
-
- <div>
- <a ng-href="#!/">{{ts('Back')}}</a>
- |
- <a af-api4-action="['Afform', 'update', {layoutFormat: 'html', where: [['name', '=', resultForm.name]], values:resultForm}]">{{ts('Save')}}</a>
- <span ng-if="resultForm.server_route">
- | <a target="_blank" ng-href="{{crmUrl(resultForm.server_route)}}">Open</a>
- </span>
- </div>
+ <div ng-repeat="resultForm in apiData.result" ng-if="apiData.result.length > 0" class="container-fluid">
+
+ <div class="row">
+
+ <div class="col-sm-12 col-md-4">
+ <div class="panel panel-default">
+ <div class="panel-heading">{{ts('Properties')}}</div>
+ <div class="panel-body">
+
+ <div crm-ui-debug="resultForm"></div>
+
+ <div class="form-group">
+ <label class="control-label">{{ts('Name')}}</label>
+ <p class="form-control-static">{{resultForm.name}}</p>
+ </div>
+ <div class="form-group">
+ <label class="control-label">{{ts('Title')}}</label>
+ <input ng-model="resultForm.title" type="text" class="form-control" />
+ </div>
+ <div class="form-group">
+ <label class="control-label">{{ts('Description')}}</label>
+ <textarea class="form-control" ng-model="resultForm.description"></textarea>
+ <p class="help-block">{{ts('Semi-private description about the form\'s purpose.')}}</p>
+ <!-- "Semi-private": not generally public, but not audited for secrecy -->
+ </div>
+ <div class="form-group">
+ <label class="control-label">{{ts('Path')}}</label>
+ <input ng-model="resultForm.server_route" type="text" class="form-control" />
+ <p class="help-block">{{ts('Expose the form as a standalone page on the web site. (Example: "civicrm/my-form")')}}</p>
+ </div>
+ <div class="form-group" ng-if="!!resultForm.server_route">
+ <label for="af_config_form_is_public">
+ <input type="checkbox" id="af_config_form_is_public" ng-model="resultForm.is_public">
+ {{ ts('Enable frontend styling') }}
+ </label>
+ <p class="help-block">{{ts('The general look/feel should match the frontend')}}</p>
+ </div>
+ <div class="form-group">
+ <label for="af_config_form_is_dashlet">
+ <input type="checkbox" id="af_config_form_is_dashlet" ng-model="resultForm.is_dashlet">
+ {{ ts('Enable dashlet') }}
+ </label>
+ <p class="help-block">{{ts('Allow backend users to embed the form on the dashboard.')}}</p>
+ </div>
+ <div class="form-group">
+ <label class="control-label">{{ts('Permission')}}</label>
+ <input ng-model="resultForm.permission" type="text" class="form-control" />
+ <p class="help-block">{{ts('What permission is required to use this form?')}}</p>
+ </div>
+ </div>
+ </div>
- <fieldset>
- <legend>{{ts('Properties')}}</legend>
- <div><label>{{ts('Name')}}:</label> {{resultForm.name}}</div>
- <div><label>{{ts('Title')}}:</label> <input ng-model="resultForm.title" type="text" /></div>
- <div><label>{{ts('Server Route')}}:</label> <input ng-model="resultForm.server_route" type="text" /></div>
- <div><label>{{ts('Permission')}}:</label> <input ng-model="resultForm.permission" type="text" /></div>
- <div><label>{{ts('Description')}}:</label> <textarea ng-model="resultForm.description"></textarea></div>
- </fieldset>
+ <div class="clearfix"></div>
+ </div>
- <fieldset>
- <legend>{{ts('Layout')}}</legend>
- <div af-monaco ng-model="resultForm.layout"></div>
- </fieldset>
+ <div class="col-sm-12 col-md-8">
+ <div class="panel panel-default">
+ <div class="panel-heading">
+ <div class="btn-group btn-group-xs pull-right" role="group" aria-label="{{ts('Actions')}}">
+ <a class="btn btn-default" target="_blank" ng-href="{{crmUrl(resultForm.server_route)}}" ng-if="resultForm.server_route">
+ <i class="crm-i fa-location-arrow"></i>
+ {{ts('Open')}}
+ </a>
+
+ <a class="btn btn-default"
+ af-api4-action="['Afform', 'update', {layoutFormat: 'html', where: [['name', '=', resultForm.name]], values:resultForm}]">
+ <i class="crm-i fa-floppy-o"></i>
+ {{ts('Save')}}
+ </a>
+
+ </div>
+
+ {{ts('Markup')}}
+ </div>
+ <div class="panel-body">
+ <div crm-monaco ng-model="resultForm.layout"></div>
+ </div>
+ </div>
+ </div>
+
+ </div>
</div>
</div>
+++ /dev/null
-<?php
-// This file declares an Angular module which can be autoloaded
-return array(
- 'js' => [
- AFFORM_HTML_MONACO . '/loader.js',
- 'ang/afMonaco.js',
- // 'ang/afMonaco/*.js',
- // 'ang/afMonaco/*/*.js',
- ],
- 'css' => ['ang/afMonaco.css'],
- // 'partials' => ['ang/afMonaco'],
- 'requires' => ['crmUi', 'crmUtil'],
- 'settings' => [
- 'paths' => [
- 'vs' => CRM_AfformHtml_ExtensionUtil::url(AFFORM_HTML_MONACO),
- ],
- ],
- 'basePages' => [],
- 'exports' => [
- 'af-monaco' => 'A',
- ],
-);
+++ /dev/null
-/* Add any CSS rules for Angular module "afMonaco" */
-.af-monaco-container {
- border:1px solid grey;
-}
\ No newline at end of file
return $ex;
}
+ /**
+ * In this test, we receive a layout
+ *
+ * @param string $formName
+ * The symbolic name of the form.
+ * @param string $updateFormat
+ * The format with which to write the data.
+ * 'html' or 'array'
+ * @param mixed $updateLayout
+ * The new value to set
+ * @param string $readFormat
+ * The format with which to read the data.
+ * 'html' or 'array'
+ * @param mixed $readLayout
+ * The value that we expect to read.
+ * @param string $exampleName
+ * (For debug messages) A symbolic name of the example data-set being tested.
+ * @dataProvider getFormatExamples
+ */
+ public function testBasicConvert($formName, $updateFormat, $updateLayout, $readFormat, $readLayout, $exampleName) {
+ $actual = Civi\Api4\Afform::convert()->setLayout($updateLayout)
+ ->setFrom($updateFormat)
+ ->setTo($readFormat)
+ ->execute();
+
+ $cb = function($m) {
+ return '<' . rtrim($m[1]) . '/>';
+ };
+ $norm = function($layout) use ($cb, &$norm) {
+ if (is_string($layout)) {
+ return preg_replace_callback(';<((br|img)[^>]*)/>;', $cb, $layout);
+ }
+ elseif (is_array($layout)) {
+ foreach ($layout as &$item) {
+ $item = $norm($item);
+ }
+ }
+ };
+
+ $this->assertEquals($norm($readLayout), $norm($actual->single()['layout']), "Based on \"$exampleName\", writing content as \"$updateFormat\" and reading back as \"$readFormat\".");
+ }
+
/**
* In this test, we update the layout and in one format and then read it back
* in another format.
return;
}
foreach ($connectedMemberships as $membershipID) {
- civicrm_api3('Membership', 'create', ['status_id' => 'Cancelled', 'id' => $membershipID, 'is_override' => 1]);
+ civicrm_api3('Membership', 'create', ['status_id' => 'Cancelled', 'id' => $membershipID, 'is_override' => 1, 'status_override_end_date' => 'null']);
}
}
<?php
+use Civi\Api4\Activity;
+use Civi\Api4\Contribution;
use Civi\Test\Api3TestTrait;
use Civi\Test\CiviEnvBuilder;
use Civi\Test\HeadlessInterface;
use Civi\Api4\PriceField;
use Civi\Api4\Participant;
use PHPUnit\Framework\TestCase;
+use Civi\Test\ContactTestTrait;
/**
* FIXME - Add test description.
class CancelTest extends TestCase implements HeadlessInterface, HookInterface, TransactionalInterface {
use Api3TestTrait;
+ use ContactTestTrait;
/**
* Created ids.
$this->assertEquals('', $afterPledge['pledge_total_paid']);
}
+ /**
+ * Test cancelling a contribution with a membership on the contribution edit
+ * form.
+ *
+ * @throws \API_Exception
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
+ */
+ public function testCancelFromContributionForm(): void {
+ $this->createContact();
+ $this->createMembershipType();
+ $this->createMembershipOrder();
+ $this->createLoggedInUser();
+ $formValues = [
+ 'id' => $this->ids['Contribution'][0],
+ 'contact_id' => $this->ids['contact'][0],
+ 'contribution_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Cancelled'),
+ ];
+ $form = new CRM_Contribute_Form_Contribution();
+ $_SERVER['REQUEST_METHOD'] = 'GET';
+ $form->controller = new CRM_Core_Controller();
+ $form->controller->setStateMachine(new CRM_Core_StateMachine($form->controller));
+ $form->testSubmit($formValues, CRM_Core_Action::UPDATE);
+
+ $contribution = Contribution::get()
+ ->addWhere('id', '=', $this->ids['Contribution'][0])
+ ->addSelect('contribution_status_id:name')
+ ->execute()->first();
+ $this->assertEquals('Cancelled', $contribution['contribution_status_id:name']);
+ $membership = $this->callAPISuccessGetSingle('Membership', []);
+ $this->assertEquals('Cancelled', CRM_Core_PseudoConstant::getName('CRM_Member_BAO_Membership', 'status_id', $membership['status_id']));
+ $activity = Activity::get()
+ ->addSelect('subject', 'source_record_id', 'status_id')
+ ->addWhere('activity_type_id:name', '=', 'Change Membership Status')
+ ->execute();
+ $this->assertCount(1, $activity);
+ $this->assertEquals('Status changed from Pending to Cancelled', $activity->first()['subject']);
+ }
+
/**
* Create an event and an order for a participant in that event.
*
*
* Provided by the Search Kit extension.
*
+ * @searchable false
* @package Civi\Api4
*/
class SearchDisplay extends Generic\DAOEntity {
$schema = [];
$entities = \Civi\Api4\Entity::get()
->addSelect('name', 'title', 'type', 'title_plural', 'description', 'icon', 'paths')
- ->addWhere('name', '!=', 'Entity')
+ ->addWhere('searchable', '=', TRUE)
->addOrderBy('title_plural')
->setChain([
'get' => ['$name', 'getActions', ['where' => [['name', '=', 'get']]], ['params']],
};
$.fn.crmtooltip = function () {
+ var TOOLTIP_HIDE_DELAY = 300;
+
$(document)
.on('mouseover', 'a.crm-summary-link:not(.crm-processed)', function (e) {
$(this).addClass('crm-processed crm-tooltip-active');
.load(this.href);
}
})
- .on('mouseout', 'a.crm-summary-link', function () {
- $(this).removeClass('crm-processed crm-tooltip-active crm-tooltip-down');
+ .on('mouseleave', 'a.crm-summary-link', function () {
+ var tooltipLink = $(this);
+ setTimeout(function () {
+ if (tooltipLink.filter(':hover').length === 0) {
+ tooltipLink.removeClass('crm-processed crm-tooltip-active crm-tooltip-down');
+ }
+ }, TOOLTIP_HIDE_DELAY);
})
.on('click', 'a.crm-summary-link', false);
};
Preliminary cleanup of code to move towards making search actions available
from search builder.
-- **Lotsa new features for the Search Kit extension
+- **Search Kit: Lotsa new features
([18876](https://github.com/civicrm/civicrm-core/pull/18876))**
Integrates Search Kit/Afform. Adds a standalone page for viewing search kit
displays. Adds first search kit display type "table". Adds search kit display
entity and UI. Adds CRUD form for managing saved search kit searches.
-- **Search ext: Add links to search admin and improve links in displays
+- **Search Kit: Add links to search admin and improve links in displays
([18909](https://github.com/civicrm/civicrm-core/pull/18909))**
Improves links in search kit results.
+- **Search Kit: Bind parameters to URL
+ ([#18976](https://github.com/civicrm/civicrm-core/pull/18976))**
+
+- **Search Kit: Add "List" display. Fix other bugs.
+ ([#18999](https://github.com/civicrm/civicrm-core/pull/18999))**
+
+- **Search Kit: Improve options in "List" search display
+ ([19031](https://github.com/civicrm/civicrm-core/pull/19031/files))**
+
- **SavedSearch - Add name and label columns
([18809](https://github.com/civicrm/civicrm-core/pull/18809))**
### CiviMail
-- **OAuth2 administration (email focus) (Work Towards
- [dev/core#2141](https://lab.civicrm.org/dev/core/-/issues/2141):
+- **OAuth2 Client ([dev/core#2141](https://lab.civicrm.org/dev/core/-/issues/2141):
[18902](https://github.com/civicrm/civicrm-core/pull/18902),
[18914](https://github.com/civicrm/civicrm-core/pull/18914),
- [18885](https://github.com/civicrm/civicrm-core/pull/18885) and
- [18908](https://github.com/civicrm/civicrm-core/pull/18908))**
+ [18885](https://github.com/civicrm/civicrm-core/pull/18885),
+ [18908](https://github.com/civicrm/civicrm-core/pull/18908),
+ [18943](https://github.com/civicrm/civicrm-core/pull/18943),
+ [18955](https://github.com/civicrm/civicrm-core/pull/18955),
+ [18951](https://github.com/civicrm/civicrm-core/pull/18951), and
+ [19001](https://github.com/civicrm/civicrm-core/pull/19001))**
Adds a new hook `hook_civicrm_alterMailStore` which can be used to add or
modify a driver. Adds a hidden `oauth-client` extension for connecting to
- **Rationalise date formatting
([18805](https://github.com/civicrm/civicrm-core/pull/18805))**
+- **Fix filter for users who have permission "view deleted contacts"
+ ([19088](https://github.com/civicrm/civicrm-core/pull/19088))**
+
+
### CiviCampaign
- **Fix campaign_id handling for batch entry
([dev/core#2152](https://lab.civicrm.org/dev/core/-/issues/2152):
[18884](https://github.com/civicrm/civicrm-core/pull/18884))**
+- **Fix deprecation notice
+ ([dev/core#2205](https://lab.civicrm.org/dev/core/-/issues/2205): [#19018](https://github.com/civicrm/civicrm-core/pull/19018))**
+
### CiviContribute
- **finish 'this round' of completeOrder cleanup
- **PCP 'Your Message' should use WYSIWYG
([18411](https://github.com/civicrm/civicrm-core/pull/18411))**
+- **Fix fatal error on "Edit Contribution" form
+ ([19091](https://github.com/civicrm/civicrm-core/pull/19091))**
+
+- **Fix product form such that it is possible to unselec duration unit, frequency unit
+ ([dev/drupal#148](https://lab.civicrm.org/dev/drupal/-/issues/148): [19084](https://github.com/civicrm/civicrm-core/pull/19084))**
+
+
### CiviEvent
- **.ical files not populating correctly for sites with ACL's configured for
- **crmMailing - Only load Angular settings if they're needed
([18749](https://github.com/civicrm/civicrm-core/pull/18749))**
+- **Error when changing "Location Type"
+ ([dev/core#2228](https://lab.civicrm.org/dev/core/-/issues/2228): [19092](https://github.com/civicrm/civicrm-core/pull/19092))**
+
### CiviSMS
- **Error in the selected phone to send an SMS when the Mobile type label is
## <a name="misc"></a>Miscellany
+- **_Composer Patches_: Update to v1.7.0. Support Composer v2. ([#18940](https://github.com/civicrm/civicrm-core/pull/18940))**
+
- **Schema handler fixes
([18932](https://github.com/civicrm/civicrm-core/pull/18932))**
- **Hack away at false negative test fails
([18892](https://github.com/civicrm/civicrm-core/pull/18892))**
+- **Search Kit - Fix search action button
+ ([19055](https://github.com/civicrm/civicrm-core/pull/19055))**
+
+- **Release Notes: Add 5.32.0
+ ([#18958](https://github.com/civicrm/civicrm-core/pull/18958), [#18945](https://github.com/civicrm/civicrm-core/pull/18945))**
+
+- **Release Notes: Add 5.31.1
+ ([#19029](https://github.com/civicrm/civicrm-core/pull/19029))**
+
- **Remove always-true IF
([18803](https://github.com/civicrm/civicrm-core/pull/18803))**
- **unit test for #18306 - order create api test for contribution
([18785](https://github.com/civicrm/civicrm-core/pull/18785))**
+- **(NFC) Update cache/integration-tests
+ ([19076](https://github.com/civicrm/civicrm-core/pull/19076))**
+
- **(NFC) Fix typo in Money valueFormat depretation warning
([18886](https://github.com/civicrm/civicrm-core/pull/18886))**
'help_text' => 'If a contact is created with no language this setting will determine the language data (if any) to save.'
. 'You may or may not wish to make an assumption here about whether it matches the site language',
],
+ 'pinnedContactCountries' => [
+ 'group_name' => 'Localization Preferences',
+ 'group' => 'localization',
+ 'name' => 'pinnedContactCountries',
+ 'type' => 'Array',
+ 'quick_form_type' => 'Element',
+ 'html_type' => 'advmultiselect',
+ 'html_attributes' => [
+ 'size' => 5,
+ 'style' => 'width:150px',
+ 'class' => 'advmultiselect',
+ ],
+ 'default' => [],
+ 'add' => '5.33',
+ 'title' => ts('Pinned Countries'),
+ 'is_domain' => 1,
+ 'is_contact' => 0,
+ 'description' => ts('Appear in Top section of select list'),
+ 'help_text' => ts('Selected countries will appear in top section of country list'),
+ 'pseudoconstant' => [
+ 'callback' => 'CRM_Admin_Form_Setting_Localization::getAvailableCountries',
+ ],
+ ],
];
LOCK TABLES `civicrm_domain` WRITE;
/*!40000 ALTER TABLE `civicrm_domain` DISABLE KEYS */;
-INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,'5.33.alpha1',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
+INSERT INTO `civicrm_domain` (`id`, `name`, `description`, `version`, `contact_id`, `locales`, `locale_custom_strings`) VALUES (1,'Default Domain Name',NULL,'5.34.alpha1',1,NULL,'a:1:{s:5:\"en_US\";a:0:{}}');
/*!40000 ALTER TABLE `civicrm_domain` ENABLE KEYS */;
UNLOCK TABLES;
VALUES
( @domainID, CONCAT('civicrm/report/instance/', @instanceID,'&reset=1'), 'Mailing Detail Report', 'Mailing Detail Report', 'administer CiviMail', 'OR', @reportlastID, '1', NULL, @instanceID+2 );
UPDATE civicrm_report_instance SET navigation_id = LAST_INSERT_ID() WHERE id = @instanceID;
-UPDATE civicrm_domain SET version = '5.33.alpha1';
+UPDATE civicrm_domain SET version = '5.34.alpha1';
{ts}State/province listings are populated dynamically based on the selected Country for all standard contact address editing forms, as well as for <strong>Profile forms which include both a Country and a State/Province field</strong>. This setting controls which countries' states and/or provinces are available in the State/Province selection field <strong>for Custom Fields</strong> or for Profile forms which do NOT include a Country field.{/ts}
</p>
{/htxt}
+{htxt id="pinnedContactCountries"}
+ <p>
+ {ts}Selected countries will appear in top section of country list.{/ts}
+ </p>
+{/htxt}
<td class="label">{$form.defaultContactCountry.label} {help id='defaultContactCountry' title=$form.defaultContactCountry.label}</td>
<td>{$form.defaultContactCountry.html}</td>
</tr>
+ <tr class="crm-localization-form-block-pinnedContactCountries">
+ <td class="label">{$form.pinnedContactCountries.label} {help id='pinnedContactCountries' title=$form.pinnedContactCountries.label}</td>
+ <td>{$form.pinnedContactCountries.html}</td>
+ </tr>
<tr class="crm-localization-form-block-defaultContactStateProvince">
<td class="label">{$form.defaultContactStateProvince.label} {help id='defaultContactCountry' title=$form.defaultContactStateProvince.label}</td>
<td>{$form.defaultContactStateProvince.html}</td>
<tr id="extension-{$row.file}" class="crm-entity crm-extension-{$row.file}{if $row.status eq 'disabled'} disabled{/if}{if $row.status eq 'installed-missing' or $row.status eq 'disabled-missing'} extension-missing{/if}{if $row.upgradable} extension-upgradable{elseif $row.status eq 'installed'} extension-installed{/if}">
<td class="crm-extensions-label">
<a class="collapsed" href="#"></a> <strong>{$row.label}</strong><br/>{$row.description}
- {if $extAddNewEnabled && $remoteExtensionRows[$extKey] && $remoteExtensionRows[$extKey].is_upgradeable}
- {capture assign='upgradeURL'}{crmURL p='civicrm/admin/extensions' q="action=update&id=$extKey&key=$extKey"}{/capture}
- <div class="crm-extensions-upgrade">{ts 1=$upgradeURL}Version {$remoteExtensionRows[$extKey].version} is available. <a href="%1">Upgrade</a>{/ts}</div>
+ {if $extAddNewEnabled && $remoteExtensionRows[$extKey] && $remoteExtensionRows[$extKey].upgradelink}
+ <div class="crm-extensions-upgrade">{$remoteExtensionRows[$extKey].upgradelink}</div>
{/if}
</td>
<td class="crm-extensions-label">{$row.statusLabel} {if $row.upgradable}<br/>({ts}Outdated{/ts}){/if}</td>
{/foreach}
</div>
</div>
-{include file="CRM/common/TabHeader.tpl"}
{elseif $action ne 1 and $action ne 2 and $action ne 4 and $action ne 8}
<div class="messages status no-popup">
// https://civicrm.org/licensing
-/**
- * By default this simply loads tabs via ajax CRM.loadPage method
- * Tabs with class 'ajaxForm' will use CRM.loadForm instead, suitable for most forms
- * Tabs with class 'livePage' will get popup action links, suitable for crud tables
- */
-CRM.$(function($) {
- var tabSettings = CRM.tabSettings || {};
- tabSettings.active = tabSettings.active ? $('#tab_' + tabSettings.active).prevAll().length : 0;
- $("#mainTabContainer")
- .on('tabsbeforeactivate', function(e, ui) {
- // CRM-14353 - Warn of unsaved changes for all forms except those which have opted out
- if (CRM.utils.initialValueChanged($('form:not([data-warn-changes=false])', ui.oldPanel))) {
- CRM.alert(ts('Your changes in the <em>%1</em> tab have not been saved.', {1: ui.oldTab.text()}), ts('Unsaved Changes'), 'warning');
- }
- })
- .on('tabsbeforeload', function(e, ui) {
- // Use civicrm ajax wrappers rather than the default $.load
- if (!ui.panel.data("civiCrmSnippet")) {
- var method = ui.tab.hasClass('ajaxForm') ? 'loadForm' : 'loadPage';
- var params = {target: ui.panel};
- if (method === 'loadForm') {
- params.autoClose = params.openInline = params.cancelButton = params.refreshAction = false;
- ui.panel.on('crmFormLoad', function() {
- // Hack: "Save and done" and "Cancel" buttons submit without ajax
- $('.cancel.crm-form-submit, button[name$=upload_done]', this).on('click', function(e) {
- $(this).closest('form').ajaxFormUnbind();
- });
- });
+(function($, _) {
+ /**
+ * By default this simply loads tabs via ajax CRM.loadPage method
+ * Tabs with class 'ajaxForm' will use CRM.loadForm instead, suitable for most forms
+ * Tabs with class 'livePage' will get popup action links, suitable for crud tables
+ */
+ $(function($) {
+ // CRM.tabSettings.active is the name of the tab which should open on page load
+ var tabSettings = CRM.tabSettings ? _.cloneDeep(CRM.tabSettings) : {};
+ tabSettings.active = tabSettings.active ? $('#tab_' + tabSettings.active).prevAll().length : 0;
+ $("#mainTabContainer")
+ .on('tabsbeforeactivate', function(e, ui) {
+ // CRM-14353 - Warn of unsaved changes for all forms except those which have opted out
+ if (CRM.utils.initialValueChanged($('form:not([data-warn-changes=false])', ui.oldPanel))) {
+ CRM.alert(ts('Your changes in the <em>%1</em> tab have not been saved.', {1: ui.oldTab.text()}), ts('Unsaved Changes'), 'warning');
}
- if (ui.tab.hasClass('livePage') && CRM.config.ajaxPopupsEnabled) {
+ })
+ .on('tabsbeforeload', function(e, ui) {
+ // Use civicrm ajax wrappers rather than the default $.load
+ if (!ui.panel.data("civiCrmSnippet")) {
+ var method = ui.tab.hasClass('ajaxForm') ? 'loadForm' : 'loadPage';
+ var params = {target: ui.panel};
+ if (method === 'loadForm') {
+ params.autoClose = params.openInline = params.cancelButton = params.refreshAction = false;
+ ui.panel.on('crmFormLoad', function() {
+ // Hack: "Save and done" and "Cancel" buttons submit without ajax
+ $('.cancel.crm-form-submit, button[name$=upload_done]', this).on('click', function(e) {
+ $(this).closest('form').ajaxFormUnbind();
+ });
+ });
+ }
+ if (ui.tab.hasClass('livePage') && CRM.config.ajaxPopupsEnabled) {
+ ui.panel
+ .off('click.crmLivePage')
+ .on('click.crmLivePage', 'a.button, a.action-item', CRM.popup)
+ .on('crmPopupFormSuccess.crmLivePage', 'a.button, a.action-item:not(.crm-enable-disable)', CRM.refreshParent);
+ }
ui.panel
- .off('click.crmLivePage')
- .on('click.crmLivePage', 'a.button, a.action-item', CRM.popup)
- .on('crmPopupFormSuccess.crmLivePage', 'a.button, a.action-item:not(.crm-enable-disable)', CRM.refreshParent);
- }
- ui.panel
- .off('.tabInfo')
- .on('crmLoad.tabInfo crmFormSuccess.tabInfo', function(e, data) {
- if (data) {
- if (typeof(data.tabCount) !== 'undefined') {
- CRM.tabHeader.updateCount(ui.tab, data.tabCount);
+ .off('.tabInfo')
+ .on('crmLoad.tabInfo crmFormSuccess.tabInfo', function(e, data) {
+ if (data) {
+ if (typeof(data.tabCount) !== 'undefined') {
+ CRM.tabHeader.updateCount(ui.tab, data.tabCount);
+ }
+ if (typeof(data.tabValid) !== 'undefined') {
+ var method = data.tabValid ? 'removeClass' : 'addClass';
+ ui.tab[method]('disabled');
+ }
}
- if (typeof(data.tabValid) !== 'undefined') {
- var method = data.tabValid ? 'removeClass' : 'addClass';
- ui.tab[method]('disabled');
- }
- }
- });
- CRM[method]($('a', ui.tab).attr('href'), params);
+ });
+ CRM[method]($('a', ui.tab).attr('href'), params);
+ }
+ e.preventDefault();
+ })
+ .tabs(tabSettings);
+ // Any load/submit event could potentially call for tabs to refresh.
+ $(document).on('crmLoad.tabInfo crmFormSuccess.tabInfo', function(e, data) {
+ if (data && $.isPlainObject(data.updateTabs)) {
+ $.each(data.updateTabs, CRM.tabHeader.updateCount);
+ $.each(data.updateTabs, CRM.tabHeader.resetTab);
}
- e.preventDefault();
- })
- .tabs(tabSettings);
- // Any load/submit event could potentially call for tabs to refresh.
- $(document).on('crmLoad.tabInfo crmFormSuccess.tabInfo', function(e, data) {
- if (data && $.isPlainObject(data.updateTabs)) {
- $.each(data.updateTabs, CRM.tabHeader.updateCount);
- $.each(data.updateTabs, CRM.tabHeader.resetTab);
- }
+ });
});
-});
-(function($) {
+
// Utility functions
CRM.tabHeader = CRM.tabHeader || {};
$panel.crmSnippet('destroy');
}
};
-})(CRM.$);
+})(CRM.$, CRM._);
{/if}
<div class="clear"></div>
</div> {* crm-content-block ends here *}
-{include file="CRM/common/TabSelected.tpl" defaultTab="settings"}
+{* DEPRECATED script, should be refactored out and removed *}
<script type='text/javascript'>
var selectedTab = '{$defaultTab}';
var tabContainer = '#mainTabContainer';
'contact_sub_type' => 1,
'sort_name' => 1,
];
- $expectedSQL = 'SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, civicrm_address.id as address_id, ' . $selectClause . " FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id AND civicrm_address.is_primary = 1 ) WHERE ( ( " . $whereClause . " ) ) AND (contact_a.is_deleted = 0) ORDER BY `contact_a`.`sort_name` ASC, `contact_a`.`id` ";
+ $expectedSQL = 'SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, civicrm_address.id as address_id, ' . $selectClause . " FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id AND civicrm_address.is_primary = 1 ) WHERE ( ( " . $whereClause . " ) ) AND ( 1 ) AND (contact_a.is_deleted = 0) ORDER BY `contact_a`.`sort_name` ASC, `contact_a`.`id` ";
$queryObj = new CRM_Contact_BAO_Query($params, $returnProperties);
try {
$this->assertLike($expectedSQL, $queryObj->getSearchSQL());
* Test that the 'multiple bulk email' setting correctly affects the type of
* field used for the 'email on hold' criteria in Advanced Search.
*/
- public function testAdvancedHSearchObservesMultipleBulkEmailSetting() {
+ public function testAdvancedHSearchObservesMultipleBulkEmailSetting(): void {
// If setting is enabled, criteria should be a select element.
Civi::settings()->set('civimail_multiple_bulk_emails', 1);
*
* In this case the contact has no external identifier.
*
- * @throws \Exception
+ * @throws \CRM_Core_Exception
*/
- public function testImportParserWithUpdateWithoutExternalIdentifier() {
- list($originalValues, $result) = $this->setUpBaseContact();
+ public function testImportParserWithUpdateWithoutExternalIdentifier(): void {
+ [$originalValues, $result] = $this->setUpBaseContact();
$originalValues['nick_name'] = 'Old Bill';
$this->runImport($originalValues, CRM_Import_Parser::DUPLICATE_UPDATE, CRM_Import_Parser::VALID);
$originalValues['id'] = $result['id'];
/**
* CRM-19888 default country should be used if ambigous.
+ *
+ * @throws \CRM_Core_Exception
*/
- public function testImportAmbiguousStateCountry() {
+ public function testImportAmbiguousStateCountry(): void {
$this->callAPISuccess('Setting', 'create', ['defaultContactCountry' => 1228]);
$countries = CRM_Core_PseudoConstant::country(FALSE, FALSE);
$this->callAPISuccess('Setting', 'create', ['countryLimit' => [array_search('United States', $countries), array_search('Guyana', $countries), array_search('Netherlands', $countries)]]);
$this->callAPISuccess('Setting', 'create', ['provinceLimit' => [array_search('United States', $countries), array_search('Guyana', $countries), array_search('Netherlands', $countries)]]);
$mapper = [0 => NULL, 1 => NULL, 2 => 'Primary', 3 => NULL];
- list($contactValues) = $this->setUpBaseContact();
+ [$contactValues] = $this->setUpBaseContact();
$fields = array_keys($contactValues);
$addressValues = [
'street_address' => 'PO Box 2716',
'expected_query' => [
0 => 'default',
1 => 'default',
- 2 => "WHERE ( civicrm_email.email LIKE '%mickey@mouseville.com%' ) AND (contact_a.is_deleted = 0)",
+ 2 => "WHERE ( civicrm_email.email LIKE '%mickey@mouseville.com%' ) AND ( 1 ) AND (contact_a.is_deleted = 0)",
],
],
],
'expected_query' => [
0 => 'default',
1 => 'default',
- 2 => "WHERE ( civicrm_email.email LIKE '%mickey@mouseville.com%' AND ( ( ( contact_a.sort_name LIKE '%Mouse%' ) OR ( civicrm_email.email LIKE '%Mouse%' ) ) ) ) AND (contact_a.is_deleted = 0)",
+ 2 => "WHERE ( civicrm_email.email LIKE '%mickey@mouseville.com%' AND ( ( ( contact_a.sort_name LIKE '%Mouse%' ) OR ( civicrm_email.email LIKE '%Mouse%' ) ) ) ) AND ( 1 ) AND (contact_a.is_deleted = 0)",
],
],
],
'expected_query' => [
0 => 'default',
1 => 'default',
- 2 => "WHERE ( civicrm_email.email LIKE 'mickey@mouseville.com%' AND ( ( ( contact_a.sort_name LIKE 'Mouse%' ) OR ( civicrm_email.email LIKE 'Mouse%' ) ) ) ) AND (contact_a.is_deleted = 0)",
+ 2 => "WHERE ( civicrm_email.email LIKE 'mickey@mouseville.com%' AND ( ( ( contact_a.sort_name LIKE 'Mouse%' ) OR ( civicrm_email.email LIKE 'Mouse%' ) ) ) ) AND ( 1 ) AND (contact_a.is_deleted = 0)",
],
],
],
'expected_query' => [
0 => 'default',
1 => 'default',
- 2 => "WHERE ( civicrm_email.email LIKE 'mickey@mouseville.com%' AND ( ( ( contact_a.sort_name LIKE 'Mouse%' ) OR ( civicrm_email.email LIKE 'Mouse%' ) ) ) ) AND (contact_a.is_deleted)",
+ 2 => "WHERE ( civicrm_email.email LIKE 'mickey@mouseville.com%' AND ( ( ( contact_a.sort_name LIKE 'Mouse%' ) OR ( civicrm_email.email LIKE 'Mouse%' ) ) ) ) AND ( 1 ) AND (contact_a.is_deleted)",
],
],
],
],
],
],
+ [
+ [
+ 'description' => 'Ensure that the Join to the acl contact cache is correct and that if we are not searching in the trash trashed contacts are not returned',
+ 'class' => 'CRM_Contact_Selector',
+ 'settings' => [['name' => 'includeWildCardInName', 'value' => FALSE]],
+ 'form_values' => ['email' => 'mickey@mouseville.com', 'sort_name' => 'Mouse'],
+ 'params' => [],
+ 'return_properties' => NULL,
+ 'context' => 'advanced',
+ 'action' => CRM_Core_Action::ADVANCED,
+ 'includeContactIds' => NULL,
+ 'searchDescendentGroups' => FALSE,
+ 'limitedPermissions' => TRUE,
+ 'expected_query' => [
+ 0 => 'default',
+ 1 => 'FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id AND civicrm_address.is_primary = 1 ) LEFT JOIN civicrm_country ON ( civicrm_address.country_id = civicrm_country.id ) LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1) LEFT JOIN civicrm_phone ON (contact_a.id = civicrm_phone.contact_id AND civicrm_phone.is_primary = 1) LEFT JOIN civicrm_im ON (contact_a.id = civicrm_im.contact_id AND civicrm_im.is_primary = 1) LEFT JOIN civicrm_worldregion ON civicrm_country.region_id = civicrm_worldregion.id INNER JOIN civicrm_acl_contact_cache aclContactCache ON contact_a.id = aclContactCache.contact_id',
+ 2 => "WHERE ( civicrm_email.email LIKE 'mickey@mouseville.com%' AND ( ( ( contact_a.sort_name LIKE 'Mouse%' ) OR ( civicrm_email.email LIKE 'Mouse%' ) ) ) ) AND aclContactCache.user_id = 0 AND (contact_a.is_deleted = 0)",
+ ],
+ ],
+ ],
[
[
'description' => 'Use of quotes for exact string',
'expected_query' => [
0 => 'default',
1 => 'default',
- 2 => "WHERE ( civicrm_email.email = 'mickey@mouseville.com' AND ( ( ( contact_a.sort_name LIKE 'Mouse%' ) OR ( civicrm_email.email LIKE 'Mouse%' ) ) ) ) AND (contact_a.is_deleted = 0)",
+ 2 => "WHERE ( civicrm_email.email = 'mickey@mouseville.com' AND ( ( ( contact_a.sort_name LIKE 'Mouse%' ) OR ( civicrm_email.email LIKE 'Mouse%' ) ) ) ) AND ( 1 ) AND (contact_a.is_deleted = 0)",
],
],
],
'expected_query' => [
0 => 'SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, civicrm_address.id as address_id, civicrm_address.country_id as country_id',
1 => ' FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id AND civicrm_address.is_primary = 1 )',
- 2 => 'WHERE ( contact_a.contact_type IN ("Individual") AND civicrm_address.country_id IS NOT NULL ) AND (contact_a.is_deleted = 0)',
+ 2 => 'WHERE ( contact_a.contact_type IN ("Individual") AND civicrm_address.country_id IS NOT NULL ) AND ( 1 ) AND (contact_a.is_deleted = 0)',
],
],
],
'searchDescendentGroups' => FALSE,
'expected_query' => [
0 => 'SELECT contact_a.id as contact_id, source_contact.id as source_contact_id',
- 2 => 'WHERE ( source_contact.id IS NOT NULL ) AND (contact_a.is_deleted = 0)',
+ 2 => 'WHERE ( source_contact.id IS NOT NULL ) AND ( 1 ) AND (contact_a.is_deleted = 0)',
],
],
],
0 => 'SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, contact_a.display_name as `display_name`, contact_a.do_not_email as `do_not_email`, contact_a.do_not_phone as `do_not_phone`, contact_a.do_not_mail as `do_not_mail`, contact_a.do_not_sms as `do_not_sms`, contact_a.do_not_trade as `do_not_trade`, contact_a.is_opt_out as `is_opt_out`, contact_a.legal_identifier as `legal_identifier`, contact_a.external_identifier as `external_identifier`, contact_a.nick_name as `nick_name`, contact_a.legal_name as `legal_name`, contact_a.image_URL as `image_URL`, contact_a.preferred_communication_method as `preferred_communication_method`, contact_a.preferred_language as `preferred_language`, contact_a.preferred_mail_format as `preferred_mail_format`, contact_a.first_name as `first_name`, contact_a.middle_name as `middle_name`, contact_a.last_name as `last_name`, contact_a.prefix_id as `prefix_id`, contact_a.suffix_id as `suffix_id`, contact_a.formal_title as `formal_title`, contact_a.communication_style_id as `communication_style_id`, contact_a.job_title as `job_title`, contact_a.gender_id as `gender_id`, contact_a.birth_date as `birth_date`, contact_a.is_deceased as `is_deceased`, contact_a.deceased_date as `deceased_date`, contact_a.household_name as `household_name`, IF ( contact_a.contact_type = \'Individual\', NULL, contact_a.organization_name ) as organization_name, contact_a.sic_code as `sic_code`, contact_a.is_deleted as `contact_is_deleted`, IF ( contact_a.contact_type = \'Individual\', contact_a.organization_name, NULL ) as current_employer, civicrm_address.id as address_id, civicrm_address.street_address as `street_address`, civicrm_address.supplemental_address_1 as `supplemental_address_1`, civicrm_address.supplemental_address_2 as `supplemental_address_2`, civicrm_address.supplemental_address_3 as `supplemental_address_3`, civicrm_address.city as `city`, civicrm_address.postal_code_suffix as `postal_code_suffix`, civicrm_address.postal_code as `postal_code`, civicrm_address.geo_code_1 as `geo_code_1`, civicrm_address.geo_code_2 as `geo_code_2`, civicrm_address.state_province_id as state_province_id, civicrm_address.country_id as country_id, civicrm_phone.id as phone_id, civicrm_phone.phone_type_id as phone_type_id, civicrm_phone.phone as `phone`, civicrm_email.id as email_id, civicrm_email.email as `email`, civicrm_email.on_hold as `on_hold`, civicrm_im.id as im_id, civicrm_im.provider_id as provider_id, civicrm_im.name as `im`, civicrm_worldregion.id as worldregion_id, civicrm_worldregion.name as `world_region`',
2 => 'WHERE displayRelType.relationship_type_id = 1
AND displayRelType.is_active = 1
-AND (contact_a.is_deleted = 0)',
+AND ( 1 ) AND (contact_a.is_deleted = 0)',
],
],
],
$expectedQuery = [
0 => "SELECT contact_a.id as contact_id, contact_a.contact_type as `contact_type`, contact_a.contact_sub_type as `contact_sub_type`, contact_a.sort_name as `sort_name`, `Non_ASCII_Location_Type-location_type`.id as `Non_ASCII_Location_Type-location_type_id`, `Non_ASCII_Location_Type-location_type`.name as `Non_ASCII_Location_Type-location_type`, `Non_ASCII_Location_Type-email`.id as `Non_ASCII_Location_Type-email_id`, `Non_ASCII_Location_Type-email`.email as `Non_ASCII_Location_Type-email`",
// @TODO these FROM clause doesn't matches due to extra spaces or special character
- 2 => "WHERE ( ( `Non_ASCII_Location_Type-email`.email IS NOT NULL ) ) AND (contact_a.is_deleted = 0)",
+ 2 => "WHERE ( ( `Non_ASCII_Location_Type-email`.email IS NOT NULL ) ) AND ( 1 ) AND (contact_a.is_deleted = 0)",
];
foreach ($expectedQuery as $index => $queryString) {
$this->assertEquals($this->strWrangle($queryString), $this->strWrangle($sql[$index]));
// The page contents load later by ajax, so there's just the surrounding
// html available now, but we can check at least one thing while we're here.
- $this->assertStringContainsString("selectedTab = 'widget';", $contents);
+ $this->assertContains("mainTabContainer", $contents);
}
}
}
+ /**
+ * Pinned countries with Default country
+ */
+ public function testPinnedCountriesWithDefaultCountry() {
+ // Guyana, Netherlands, United States
+ $pinnedCountries = ['1093', '1152', '1228'];
+
+ // set default country to Netherlands
+ $this->callAPISuccess('Setting', 'create', ['defaultContactCountry' => 1152, 'pinnedContactCountries' => $pinnedCountries]);
+ // get the list of country
+ $availableCountries = CRM_Core_PseudoConstant::country(FALSE, FALSE);
+ // get the order of country id using their keys
+ $availableCountries = array_keys($availableCountries);
+
+ // default country is set, so first country should be Netherlands, then rest from pinned countries.
+
+ // Netherlands
+ $this->assertEquals(1152, $availableCountries[0]);
+ // Guyana
+ $this->assertEquals(1093, $availableCountries[1]);
+ // United States
+ $this->assertEquals(1228, $availableCountries[2]);
+ }
+
+ /**
+ * Pinned countries with out Default country
+ */
+ public function testPinnedCountriesWithOutDefaultCountry() {
+ // Guyana, Netherlands, United States
+ $pinnedCountries = ['1093', '1152', '1228'];
+
+ // unset default country
+ $this->callAPISuccess('Setting', 'create', ['defaultContactCountry' => NULL, 'pinnedContactCountries' => $pinnedCountries]);
+
+ // get the list of country
+ $availableCountries = CRM_Core_PseudoConstant::country(FALSE, FALSE);
+ // get the order of country id using their keys
+ $availableCountries = array_keys($availableCountries);
+
+ // no default country, so sequnece should be present as per pinned countries.
+
+ // Guyana
+ $this->assertEquals(1093, $availableCountries[0]);
+ // Netherlands
+ $this->assertEquals(1152, $availableCountries[1]);
+ // United States
+ $this->assertEquals(1228, $availableCountries[2]);
+ }
+
}
*/
public function testBuildFieldChangeSql() {
$params = [
- 'table_name' => 'big_table',
+ 'table_name' => 'civicrm_contact',
'operation' => 'add',
'name' => 'big_bob',
'type' => 'text',
];
$sql = CRM_Core_BAO_SchemaHandler::buildFieldChangeSql($params, FALSE);
- $this->assertEquals('ALTER TABLE big_table
+ $this->assertEquals('ALTER TABLE civicrm_contact
ADD COLUMN `big_bob` text', trim($sql));
$params['operation'] = 'modify';
$params['comment'] = 'super big';
+ $params['fkName'] = CRM_Core_BAO_SchemaHandler::getIndexName('civicrm_contact', 'big_bob');
$sql = CRM_Core_BAO_SchemaHandler::buildFieldChangeSql($params, FALSE);
- $this->assertEquals("ALTER TABLE big_table
+ $this->assertEquals("ALTER TABLE civicrm_contact
MODIFY `big_bob` text COMMENT 'super big'", trim($sql));
$params['operation'] = 'delete';
$sql = CRM_Core_BAO_SchemaHandler::buildFieldChangeSql($params, FALSE);
- $this->assertEquals('ALTER TABLE big_table DROP COLUMN `big_bob`', trim($sql));
+ $this->assertEquals('ALTER TABLE civicrm_contact DROP COLUMN `big_bob`', trim($sql));
}
}
*/
class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
+ use CRMTraits_Financial_OrderTrait;
+
protected $_individualId;
protected $_contribution;
protected $_financialTypeId = 1;
* @throws \CRM_Core_Exception
* @throws \CiviCRM_API3_Exception
*/
- public function testContributionFormStatusUpdate() {
+ public function testContributionFormStatusUpdate(): void {
- $this->_individualId = $this->createLoggedInUser();
- $membershipId = $this->contactMembershipCreate([
- 'contact_id' => $this->_individualId,
- 'membership_type_id' => $this->membershipTypeAnnualFixedID,
- 'status_id' => 'New',
- ]);
+ $this->_contactID = $this->createLoggedInUser();
+ $this->createContributionAndMembershipOrder();
$params = [
'total_amount' => 50,
'financial_type_id' => 2,
- 'contact_id' => $this->_individualId,
+ 'contact_id' => $this->_contactID,
'payment_instrument_id' => CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'payment_instrument_id', 'Check'),
'contribution_status_id' => CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Cancelled'),
];
- $contriParams = [
- 'membership_id' => $membershipId,
- 'total_amount' => 50,
- 'financial_type_id' => 2,
- 'contact_id' => $this->_individualId,
- ];
- $contribution = CRM_Member_BAO_Membership::recordMembershipContribution($contriParams);
-
//Update Contribution to Cancelled.
$form = new CRM_Contribute_Form_Contribution();
- $form->_id = $params['id'] = $contribution->id;
+ $form->_id = $params['id'] = $this->ids['Contribution'][0];
$form->_mode = NULL;
$form->_contactID = $this->_individualId;
$form->testSubmit($params, CRM_Core_Action::UPDATE);
- $membership = $this->callAPISuccessGetSingle('Membership', ['contact_id' => $this->_individualId]);
+ $membership = $this->callAPISuccessGetSingle('Membership', ['contact_id' => $this->_contactID]);
//Assert membership status overrides when the contribution cancelled.
- $this->assertEquals($membership['is_override'], TRUE);
+ $this->assertEquals(TRUE, $membership['is_override']);
$this->assertEquals($membership['status_id'], $this->callAPISuccessGetValue('MembershipStatus', [
'return' => 'id',
'name' => 'Cancelled',
*
* @throws \CRM_Core_Exception
*/
- protected function createContributionAndMembershipOrder() {
+ protected function createContributionAndMembershipOrder(): void {
$this->ids['membership_type'][0] = $this->membershipTypeCreate();
$orderID = $this->callAPISuccess('Order', 'create', [
'financial_type_id' => 'Donation',
'contact_id' => $this->_contactID,
'membership_type_id' => 'General',
'source' => 'Payment',
+ // This is necessary because Membership_BAO otherwise ignores the
+ // pending status. I do have a fix but it's held up behind other pending-review PRs
+ // so this should be temporary until we get the membership PRs flowing.
+ 'skipStatusCal' => TRUE,
],
'line_item' => $this->getMembershipLineItem(),
],
return $this->callAPISuccessGetSingle('Contact', ['id' => $isReverse ? $this->ids['contact'][1] : $this->ids['contact'][0]]);
}
+ /**
+ * Test a lack of fatal errors when the where contains an emoji.
+ *
+ * By default our DBs are not 🦉 compliant. This test will age
+ * out when we are.
+ *
+ * @throws \API_Exception
+ */
+ public function testEmojiInWhereClause(): void {
+ $schemaNeedsAlter = \CRM_Core_BAO_SchemaHandler::databaseSupportsUTF8MB4();
+ if ($schemaNeedsAlter) {
+ \CRM_Core_DAO::executeQuery("
+ ALTER TABLE civicrm_contact MODIFY COLUMN
+ `first_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'First Name.',
+ CHARSET utf8
+ ");
+ }
+ $this->callAPISuccess('Contact', 'get', [
+ 'debug' => 1,
+ 'first_name' => '🦉Claire',
+ ]);
+ if ($schemaNeedsAlter) {
+ \CRM_Core_DAO::executeQuery("
+ ALTER TABLE civicrm_contact MODIFY COLUMN
+ `first_name` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'First Name.',
+ CHARSET utf8mb4
+ ");
+ }
+ }
+
}
/**
* Test Activity creation on cancellation of membership contribution.
+ *
+ * @throws \CRM_Core_Exception
+ * @throws \CiviCRM_API3_Exception
*/
- public function testActivityForCancelledContribution() {
+ public function testActivityForCancelledContribution(): void {
$contactId = $this->createLoggedInUser();
- $membershipID = $this->contactMembershipCreate($this->_params);
-
- $ContributionCreate = $this->callAPISuccess('Contribution', 'create', [
- 'financial_type_id' => 'Member Dues',
- 'total_amount' => 100,
- 'contact_id' => $this->_params['contact_id'],
- ]);
- $this->callAPISuccess('MembershipPayment', 'create', [
- 'sequential' => 1,
- 'contribution_id' => $ContributionCreate['id'],
- 'membership_id' => $membershipID,
- ]);
+ $this->createContributionAndMembershipOrder();
+ $membershipID = $this->callAPISuccessGetValue('MembershipPayment', ['return' => 'id']);
$form = new CRM_Contribute_Form_Contribution();
- $form->_id = $ContributionCreate['id'];
+ $form->_id = $this->ids['Contribution'][0];
$form->testSubmit([
'total_amount' => 100,
'financial_type_id' => 1,
$this->callAPISuccessGetSingle('Activity', [
'activity_type_id' => 'Membership Signup',
'source_record_id' => $membershipID,
- 'subject' => 'General - Payment - Status: test status',
+ 'subject' => 'General - Payment - Status: Pending',
]);
$this->callAPISuccessGetSingle('Activity', [
'activity_type_id' => 'Change Membership Status',
$this->assertTrue(!empty($limit1->single()['sort_name']));
}
+ /**
+ * Test a lack of fatal errors when the where contains an emoji.
+ *
+ * By default our DBs are not 🦉 compliant. This test will age
+ * out when we are.
+ *
+ * @throws \API_Exception
+ */
+ public function testEmoji(): void {
+ $schemaNeedsAlter = \CRM_Core_BAO_SchemaHandler::databaseSupportsUTF8MB4();
+ if ($schemaNeedsAlter) {
+ \CRM_Core_DAO::executeQuery("
+ ALTER TABLE civicrm_contact MODIFY COLUMN
+ `first_name` VARCHAR(64) CHARACTER SET utf8 COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'First Name.',
+ CHARSET utf8
+ ");
+ }
+ Contact::get()
+ ->setDebug(TRUE)
+ ->addWhere('first_name', '=', '🦉Claire')
+ ->execute();
+ if ($schemaNeedsAlter) {
+ \CRM_Core_DAO::executeQuery("
+ ALTER TABLE civicrm_contact MODIFY COLUMN
+ `first_name` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'First Name.',
+ CHARSET utf8mb4
+ ");
+ }
+ }
+
}
->addValue('label', 'TestText')
->addValue('html_type', 'Text'), 0
)
+ ->addChain('field3', CustomField::create()
+ ->addValue('custom_group_id', '$id')
+ ->addValue('serialize', TRUE)
+ ->addValue('label', 'TestCountry')
+ ->addValue('data_type', 'Country')
+ ->addValue('html_type', 'Select'), 0
+ )
->execute()
->first();
->addRecord(['subject' => 'A1', 'MyFieldsToAlter.TestText' => 'A1', 'MyFieldsToAlter.TestOptions' => '1'])
->addRecord(['subject' => 'A2', 'MyFieldsToAlter.TestText' => 'A2', 'MyFieldsToAlter.TestOptions' => '2'])
->addRecord(['subject' => 'A3', 'MyFieldsToAlter.TestText' => 'A3', 'MyFieldsToAlter.TestOptions' => ''])
- ->addRecord(['subject' => 'A4', 'MyFieldsToAlter.TestText' => 'A4'])
+ ->addRecord(['subject' => 'A4', 'MyFieldsToAlter.TestText' => 'A4', 'MyFieldsToAlter.TestCountry' => [1228, 1039]])
->execute();
$result = Activity::get(FALSE)
$this->assertTrue(empty($result['A3']['MyFieldsToAlter.TestOptions']));
$this->assertTrue(empty($result['A4']['MyFieldsToAlter.TestOptions']));
- // Change field to multiselect
+ // Change options field to multiselect
CustomField::update(FALSE)
->addWhere('id', '=', $customGroup['field1']['id'])
->addValue('serialize', TRUE)
$this->assertEquals('Two', $result['A2']['MyFieldsToAlter.TestOptions:label']);
$this->assertTrue(empty($result['A3']['MyFieldsToAlter.TestOptions']));
$this->assertTrue(empty($result['A4']['MyFieldsToAlter.TestOptions']));
+
+ // Change country field from multiselect to single
+ CustomField::update(FALSE)
+ ->addWhere('id', '=', $customGroup['field3']['id'])
+ ->addValue('serialize', FALSE)
+ ->execute();
+
+ $result = Activity::get(FALSE)
+ ->addWhere('MyFieldsToAlter.TestCountry', 'IS NOT NULL')
+ ->addSelect('custom.*', 'subject')
+ ->execute()->indexBy('subject');
+ $this->assertCount(1, $result);
+ // The two values originally entered will now be one value
+ $this->assertEquals(1228, $result['A4']['MyFieldsToAlter.TestCountry']);
+
+ // Change country field from single to multiselect
+ CustomField::update(FALSE)
+ ->addWhere('id', '=', $customGroup['field3']['id'])
+ ->addValue('serialize', TRUE)
+ ->execute();
+
+ $result = Activity::get(FALSE)
+ ->addWhere('MyFieldsToAlter.TestCountry', 'IS NOT NULL')
+ ->addSelect('custom.*', 'subject')
+ ->execute()->indexBy('subject');
+ $this->assertCount(1, $result);
+ // The two values originally entered will now be one value
+ $this->assertEquals([1228], $result['A4']['MyFieldsToAlter.TestCountry']);
}
}
"activity_type_id:name": "Phone Call",
"source_contact_id": "@ref test_contact_1.id"
}
+ ],
+ "Contribution": [
+ {
+ "total_amount": 999.89,
+ "financial_type_id:name": "Donation",
+ "contact_id": "@ref test_contact_1.id"
+ }
]
}
* @throws \Civi\API\Exception\UnauthorizedException
*/
public function getEntitiesHitech() {
+ // Ensure all components are enabled so their entities show up
+ \CRM_Core_BAO_ConfigSetting::enableComponent('CiviEvent');
+ \CRM_Core_BAO_ConfigSetting::enableComponent('CiviGrant');
+ \CRM_Core_BAO_ConfigSetting::enableComponent('CiviCase');
+ \CRM_Core_BAO_ConfigSetting::enableComponent('CiviContribute');
+ \CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign');
+ \CRM_Core_BAO_ConfigSetting::enableComponent('CiviPledge');
+ \CRM_Core_BAO_ConfigSetting::enableComponent('CiviReport');
return $this->toDataProviderArray(Entity::get(FALSE)->execute()->column('name'));
}
$manual['remove'] = ['CustomValue'];
$scanned = [];
- $srcDir = dirname(dirname(dirname(dirname(dirname(__DIR__)))));
+ $srcDir = dirname(__DIR__, 5);
foreach ((array) glob("$srcDir/Civi/Api4/*.php") as $name) {
$scanned[] = preg_replace('/\.php/', '', basename($name));
}
/**
* @param string $entity
* Ex: 'Contact'
+ *
* @dataProvider getEntitiesLotech
+ *
+ * @throws \API_Exception
*/
- public function testConformance($entity) {
+ public function testConformance($entity): void {
$entityClass = 'Civi\Api4\\' . $entity;
$this->checkEntityInfo($entityClass);
/**
* @param \Civi\Api4\Generic\AbstractEntity|string $entityClass
*/
- protected function checkEntityInfo($entityClass) {
+ protected function checkEntityInfo($entityClass): void {
$info = $entityClass::getInfo();
$this->assertNotEmpty($info['name']);
$this->assertNotEmpty($info['title']);
/**
* @param \Civi\Api4\Generic\AbstractEntity|string $entityClass
* @param string $entity
+ *
+ * @throws \API_Exception
*/
protected function checkFields($entityClass, $entity) {
$fields = $entityClass::getFields(FALSE)
* @param \Civi\Api4\Generic\AbstractEntity|string $entityClass
*
* @return array
+ *
+ * @throws \API_Exception
*/
- protected function checkActions($entityClass) {
+ protected function checkActions($entityClass): array {
$actions = $entityClass::getActions(FALSE)
->execute()
->indexBy('name');
* @param \Civi\Api4\Generic\AbstractEntity|string $entityClass
* @param int $id
*/
- protected function checkUpdateFailsFromCreate($entityClass, $id) {
+ protected function checkUpdateFailsFromCreate($entityClass, $id): void {
$exceptionThrown = '';
try {
$entityClass::create(FALSE)
* @param int $id
* @param string $entity
*/
- protected function checkGetCount($entityClass, $id, $entity) {
+ protected function checkGetCount($entityClass, $id, $entity): void {
$getResult = $entityClass::get(FALSE)
->addWhere('id', '=', $id)
->selectRowCount()
class EntityTest extends UnitTestCase {
public function testEntityGet() {
+ \CRM_Core_BAO_ConfigSetting::enableComponent('CiviEvent');
$result = Entity::get(FALSE)
->execute()
->indexBy('name');
"Entity entity has more than basic actions");
}
+ public function testEntityComponent() {
+ \CRM_Core_BAO_ConfigSetting::disableComponent('CiviEvent');
+ $result = Entity::get(FALSE)
+ ->execute()
+ ->indexBy('name');
+ $this->assertArrayNotHasKey('Participant', $result,
+ "Entity::get should not have Participant when CiviEvent disabled");
+
+ \CRM_Core_BAO_ConfigSetting::enableComponent('CiviEvent');
+ $result = Entity::get(FALSE)
+ ->execute()
+ ->indexBy('name');
+ $this->assertArrayHasKey('Participant', $result,
+ "Entity::get should have Participant when CiviEvent enabled");
+ }
+
}
<comment>Campaign Details.</comment>
<add>3.3</add>
<icon>fa-bullhorn</icon>
+ <component>CiviCampaign</component>
<paths>
<add>civicrm/campaign/add?reset=1</add>
<update>civicrm/campaign/add?reset=1&action=update&id=[id]</update>
<name>civicrm_campaign_group</name>
<comment>Campaign Group Details.</comment>
<add>3.3</add>
-
+ <component>CiviCampaign</component>
<field>
<name>id</name>
<title>Campaign Group ID</title>
<comment>Campaign Survey Details.</comment>
<add>3.2</add>
<icon>fa-clipboard</icon>
+ <component>CiviCampaign</component>
<field>
<name>id</name>
<title>Survey ID</title>
<add>1.8</add>
<log>true</log>
<icon>fa-folder-open</icon>
+ <component>CiviCase</component>
<field>
<name>id</name>
<type>int unsigned</type>
<comment>Joining table for case-activity associations.</comment>
<add>1.8</add>
<log>true</log>
+ <component>CiviCase</component>
<field>
<name>id</name>
<title>Case Activity ID</title>
<comment>Joining table for case-contact associations.</comment>
<add>2.1</add>
<log>true</log>
+ <component>CiviCase</component>
<field>
<name>id</name>
<title>Case Contact ID</title>
<comment>Case type definition</comment>
<add>4.5</add>
<log>true</log>
+ <component>CiviCase</component>
<field>
<name>id</name>
<title>Case Type ID</title>
<add>1.3</add>
<log>true</log>
<icon>fa-credit-card</icon>
+ <component>CiviContribute</component>
<paths>
<add>civicrm/contribute/add?reset=1&action=add&context=standalone</add>
<view>civicrm/contact/view/contribution?reset=1&action=view&id=[id]</view>
<comment>A Contribution object store meta information about a single customized contribution page</comment>
<add>1.3</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Contribution Page ID</title>
<name>civicrm_contribution_product</name>
<add>1.4</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Contribution Product ID</title>
<add>1.6</add>
<log>true</log>
<title>Recurring Contribution</title>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<uniqueName>contribution_recur_id</uniqueName>
<name>civicrm_contribution_soft</name>
<add>2.2</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<uniqueName>contribution_soft_id</uniqueName>
<name>civicrm_premiums</name>
<add>1.4</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Premium ID</title>
<comment>joins premiums (settings) to individual product/premium items - determines which products are available for a given contribution page</comment>
<add>1.4</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Premium Product ID</title>
<name>civicrm_product</name>
<add>1.4</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Product ID</title>
<comment>A Widget object to store meta information about a single customized contribution widget</comment>
<add>2.0</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Widget ID</title>
<class>Cart</class>
<useBao>1</useBao>
<name>civicrm_event_carts</name>
+ <component>CiviEvent</component>
<field>
<name>id</name>
<title>Cart ID</title>
<class>EventInCart</class>
<useBao>1</useBao>
<name>civicrm_events_in_carts</name>
+ <component>CiviEvent</component>
<field>
<name>id</name>
<title>Event In Cart</title>
<add>1.7</add>
<log>true</log>
<icon>fa-calendar</icon>
+ <component>CiviEvent</component>
<paths>
<add>civicrm/event/add?reset=1</add>
<view>civicrm/event/info?reset=1&id=[id]</view>
<add>1.7</add>
<log>true</log>
<icon>fa-ticket</icon>
+ <component>CiviEvent</component>
<field>
<name>id</name>
<uniqueName>participant_id</uniqueName>
<name>civicrm_participant_payment</name>
<add>1.7</add>
<log>true</log>
+ <component>CiviEvent</component>
<field>
<name>id</name>
<title>Payment ID</title>
<comment>various types of CiviEvent participant statuses</comment>
<add>3.0</add>
<log>true</log>
+ <component>CiviEvent</component>
<field>
<name>id</name>
<title>Participant Status Type ID</title>
<name>civicrm_currency</name>
<add>1.7</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Currency ID</title>
<add>4.3</add>
<comment>Map between an entity and a financial account, where there is a specific relationship between the financial account and the entity, e.g. Income Account for or AR Account for</comment>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Entity Financial Account ID</title>
<class>EntityFinancialTrxn</class>
<name>civicrm_entity_financial_trxn</name>
<add>3.2</add>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Entity Financial Transaction ID</title>
<name>civicrm_financial_account</name>
<add>3.2</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Financial Account ID</title>
<add>4.3</add>
<comment>Financial data for civicrm_line_item, etc.</comment>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<type>int unsigned</type>
<name>civicrm_financial_trxn</name>
<add>1.3</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Financial Transaction ID</title>
<add>1.3</add>
<comment>Formerly civicrm_contribution_type merged into this table in 4.3</comment>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Financial Type ID</title>
<class>PaymentProcessor</class>
<name>civicrm_payment_processor</name>
<add>1.8</add>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Payment Processor ID</title>
<class>PaymentProcessorType</class>
<name>civicrm_payment_processor_type</name>
<add>1.8</add>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Payment Processor Type ID</title>
-<?xml version="1.0" encoding="iso-8859-1" ?>
+<?xml version="1.0" encoding="iso-8859-1" ?>
-<table>
- <base>CRM/Financial</base>
- <class>PaymentToken</class>
- <name>civicrm_payment_token</name>
- <comment>Payment Token</comment>
- <add>4.6</add>
- <field>
+<table>
+ <base>CRM/Financial</base>
+ <class>PaymentToken</class>
+ <name>civicrm_payment_token</name>
+ <comment>Payment Token</comment>
+ <add>4.6</add>
+ <component>CiviContribute</component>
+ <field>
<name>id</name>
<uniqueName>payment_token_id</uniqueName>
<title>Payment Token ID</title>
- <type>int unsigned</type>
- <required>true</required>
- <comment>Payment Token ID</comment>
- <add>4.6</add>
- </field>
- <primaryKey>
- <name>id</name>
- <autoincrement>true</autoincrement>
- </primaryKey>
- <field>
- <name>contact_id</name>
- <title>Contact ID</title>
- <type>int unsigned</type>
- <required>true</required>
- <comment>FK to Contact ID for the owner of the token</comment>
- <add>4.6</add>
- </field>
- <foreignKey>
- <name>contact_id</name>
- <table>civicrm_contact</table>
- <key>id</key>
- <add>4.6</add>
- <onDelete>CASCADE</onDelete>
- </foreignKey>
- <field>
- <name>payment_processor_id</name>
- <title>Payment Processor ID</title>
- <type>int unsigned</type>
- <required>true</required>
- <comment></comment>
- <add>4.6</add>
- </field>
- <foreignKey>
- <name>payment_processor_id</name>
- <table>civicrm_payment_processor</table>
- <key>id</key>
- <add>4.6</add>
- <onDelete>RESTRICT</onDelete>
- </foreignKey>
- <field>
- <name>token</name>
+ <type>int unsigned</type>
+ <required>true</required>
+ <comment>Payment Token ID</comment>
+ <add>4.6</add>
+ </field>
+ <primaryKey>
+ <name>id</name>
+ <autoincrement>true</autoincrement>
+ </primaryKey>
+ <field>
+ <name>contact_id</name>
+ <title>Contact ID</title>
+ <type>int unsigned</type>
+ <required>true</required>
+ <comment>FK to Contact ID for the owner of the token</comment>
+ <add>4.6</add>
+ </field>
+ <foreignKey>
+ <name>contact_id</name>
+ <table>civicrm_contact</table>
+ <key>id</key>
+ <add>4.6</add>
+ <onDelete>CASCADE</onDelete>
+ </foreignKey>
+ <field>
+ <name>payment_processor_id</name>
+ <title>Payment Processor ID</title>
+ <type>int unsigned</type>
+ <required>true</required>
+ <comment></comment>
+ <add>4.6</add>
+ </field>
+ <foreignKey>
+ <name>payment_processor_id</name>
+ <table>civicrm_payment_processor</table>
+ <key>id</key>
+ <add>4.6</add>
+ <onDelete>RESTRICT</onDelete>
+ </foreignKey>
+ <field>
+ <name>token</name>
<type>varchar</type>
<title>Token</title>
- <length>255</length>
- <required>true</required>
- <comment>Externally provided token string</comment>
- <add>4.6</add>
- </field>
- <field>
+ <length>255</length>
+ <required>true</required>
+ <comment>Externally provided token string</comment>
+ <add>4.6</add>
+ </field>
+ <field>
<name>created_date</name>
<title>Created Date</title>
- <type>timestamp</type>
+ <type>timestamp</type>
<comment>Date created</comment>
<default>CURRENT_TIMESTAMP</default>
- <add>4.6</add>
- </field>
- <field>
+ <add>4.6</add>
+ </field>
+ <field>
<name>created_id</name>
<title>Created ID</title>
- <type>int unsigned</type>
- <comment>Contact ID of token creator</comment>
- <add>4.6</add>
- </field>
+ <type>int unsigned</type>
+ <comment>Contact ID of token creator</comment>
+ <add>4.6</add>
+ </field>
<foreignKey>
<name>created_id</name>
<table>civicrm_contact</table>
<add>4.6</add>
<onDelete>SET NULL</onDelete>
</foreignKey>
- <field>
+ <field>
<name>expiry_date</name>
<title>Expiry Date</title>
- <type>datetime</type>
- <comment>Date this token expires</comment>
- <add>4.6</add>
- </field>
- <field>
+ <type>datetime</type>
+ <comment>Date this token expires</comment>
+ <add>4.6</add>
+ </field>
+ <field>
<name>email</name>
<title>Email</title>
- <length>255</length>
- <type>varchar</type>
- <comment>Email at the time of token creation. Useful for fraud forensics</comment>
- <add>4.6</add>
- </field>
- <field>
+ <length>255</length>
+ <type>varchar</type>
+ <comment>Email at the time of token creation. Useful for fraud forensics</comment>
+ <add>4.6</add>
+ </field>
+ <field>
<name>billing_first_name</name>
<title>Billing First Name</title>
- <type>varchar</type>
- <length>255</length>
- <comment>Billing first name at the time of token creation. Useful for fraud forensics</comment>
- <add>4.6</add>
- </field>
- <field>
- <name>billing_middle_name</name>
+ <type>varchar</type>
+ <length>255</length>
+ <comment>Billing first name at the time of token creation. Useful for fraud forensics</comment>
+ <add>4.6</add>
+ </field>
+ <field>
+ <name>billing_middle_name</name>
<title>Billing Middle Name</title>
- <type>varchar</type>
- <length>255</length>
- <comment>Billing middle name at the time of token creation. Useful for fraud forensics</comment>
- <add>4.6</add>
- </field>
- <field>
- <name>billing_last_name</name>
+ <type>varchar</type>
+ <length>255</length>
+ <comment>Billing middle name at the time of token creation. Useful for fraud forensics</comment>
+ <add>4.6</add>
+ </field>
+ <field>
+ <name>billing_last_name</name>
<title>Billing Last Name</title>
- <type>varchar</type>
- <length>255</length>
- <comment>Billing last name at the time of token creation. Useful for fraud forensics</comment>
- <add>4.6</add>
- </field>
- <field>
+ <type>varchar</type>
+ <length>255</length>
+ <comment>Billing last name at the time of token creation. Useful for fraud forensics</comment>
+ <add>4.6</add>
+ </field>
+ <field>
<name>masked_account_number</name>
<title>Masked Account Number</title>
- <type>varchar</type>
- <length>255</length>
- <comment>Holds the part of the card number or account details that may be retained or displayed</comment>
- <add>4.6</add>
- </field>
- <field>
+ <type>varchar</type>
+ <length>255</length>
+ <comment>Holds the part of the card number or account details that may be retained or displayed</comment>
+ <add>4.6</add>
+ </field>
+ <field>
<name>ip_address</name>
<title>IP Address</title>
- <type>varchar</type>
- <length>255</length>
- <comment>IP used when creating the token. Useful for fraud forensics</comment>
- <add>4.6</add>
- </field>
-</table>
+ <type>varchar</type>
+ <length>255</length>
+ <comment>IP used when creating the token. Useful for fraud forensics</comment>
+ <add>4.6</add>
+ </field>
+</table>
<add>1.8</add>
<log>true</log>
<icon>fa-money</icon>
+ <component>CiviGrant</component>
<paths>
<add>civicrm/grant/add?reset=1&action=add&context=standalone</add>
<view>contact/view/grant?reset=1&action=view&id=[id]&cid=[contact_id]</view>
<class>BouncePattern</class>
<name>civicrm_mailing_bounce_pattern</name>
<comment>Pseudo-constant table of patterns for bounce classification</comment>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Bounce Pattern ID</title>
<class>BounceType</class>
<name>civicrm_mailing_bounce_type</name>
<comment>Table to index the various bounce types and their properties</comment>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Bounce Type ID</title>
<class>MailingComponent</class>
<name>civicrm_mailing_component</name>
<comment>Stores information about the mailing components (header/footer).</comment>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Mailing Component ID</title>
<name>civicrm_mailing_event_bounce</name>
<comment>Tracks when and why an email bounced.</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Bounce ID</title>
<name>civicrm_mailing_event_confirm</name>
<comment>Tracks when a subscription event is confirmed by email</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Mailing Confirmation ID</title>
<name>civicrm_mailing_event_delivered</name>
<comment>Tracks when a queued email is actually delivered to the MTA</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Delivered ID</title>
<name>civicrm_mailing_event_forward</name>
<comment>Tracks when a contact forwards a mailing to a (new) contact</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Forward ID</title>
<name>civicrm_mailing_event_opened</name>
<comment>Tracks when a delivered email is opened by the recipient</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Mailing Opened ID</title>
<name>civicrm_mailing_event_queue</name>
<comment>A collection of all intended recipients of a job</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<type>int unsigned</type>
<name>civicrm_mailing_event_reply</name>
<comment>Tracks when a contact replies to a mailing</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Reply ID</title>
<name>civicrm_mailing_event_subscribe</name>
<comment>Tracks when a (new) contact subscribes to a group by email</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Mailing Subscribe ID</title>
<name>civicrm_mailing_event_trackable_url_open</name>
<comment>Tracks when a TrackableURL is clicked by a recipient.</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Trackable URL Open ID</title>
<name>civicrm_mailing_event_unsubscribe</name>
<comment>Tracks when a recipient unsubscribes from a group/domain</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Unsubscribe ID</title>
<comment>Stores information about a mailing.</comment>
<archive>true</archive>
<icon>fa-envelope-o</icon>
+ <component>CiviMail</component>
<paths>
<add>civicrm/a/#/mailing/new</add>
<update>civicrm/a/#/mailing/[id]</update>
<name>civicrm_mailing_abtest</name>
<comment>Stores information about abtesting</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<type>int unsigned</type>
<name>civicrm_mailing_group</name>
<comment>Stores information about the groups that participate in this mailing..</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Mailing Group ID</title>
<name>civicrm_mailing_job</name>
<comment>Stores information about the job that executes this mailing</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Mailing Job ID</title>
<name>civicrm_mailing_recipients</name>
<comment>Stores information about the recipients of a mailing.</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Mailing Recipients ID</title>
<class>Spool</class>
<name>civicrm_mailing_spool</name>
<comment>Stores the outbond mails</comment>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Spool ID</title>
<name>civicrm_mailing_trackable_url</name>
<comment>Stores URLs for which we should track click-throughs from mailings</comment>
<archive>true</archive>
+ <component>CiviMail</component>
<field>
<name>id</name>
<title>Trackable URL ID</title>
<add>1.5</add>
<log>true</log>
<icon>fa-id-badge</icon>
+ <component>CiviMember</component>
<paths>
<add>civicrm/member/add?reset=1&action=add&context=standalone</add>
<view>civicrm/contact/view/membership?reset=1&action=view&id=[id]&cid=[contact_id]</view>
<comment>A Membership Block stores admin configurable status options and rules</comment>
<add>1.5</add>
<log>true</log>
+ <component>CiviMember</component>
<field>
<name>id</name>
<title>Membership Block ID</title>
<log>true</log>
<comment>Logs actions which affect a Membership record (signup, status override, renewal, etc.)</comment>
<add>1.5</add>
+ <component>CiviMember</component>
<field>
<name>id</name>
<title>Membership Log ID</title>
<comment>Membership Payment</comment>
<add>1.5</add>
<log>true</log>
+ <component>CiviMember</component>
<field>
<name>id</name>
<title>Membership Payment ID</title>
<comment>Membership Status stores admin configurable rules for assigning status to memberships.</comment>
<add>1.5</add>
<log>true</log>
+ <component>CiviMember</component>
<field>
<name>id</name>
<title>Membership Status ID</title>
<comment>Sites can configure multiple types of memberships. They encode the owner organization, fee, and the rules needed to set start and end (expire) dates when a member signs up for that type.</comment>
<add>1.5</add>
<log>true</log>
+ <component>CiviMember</component>
<field>
<name>id</name>
<title>Membership Type ID</title>
<name>civicrm_pcp</name>
<add>2.2</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<uniqueName>pcp_id</uniqueName>
<comment>A Personal Campaign Page Block stores admin configurable status options and rules</comment>
<add>2.2</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>PCP Block ID</title>
<add>2.1</add>
<log>true</log>
<icon>fa-paper-plane</icon>
+ <component>CiviPledge</component>
<field>
<name>id</name>
<uniqueName>pledge_id</uniqueName>
<name>civicrm_pledge_block</name>
<add>2.1</add>
<log>true</log>
+ <component>CiviPledge</component>
<field>
<name>id</name>
<title>Pledge Block ID</title>
<comment>Pledge Payment</comment>
<add>2.1</add>
<log>true</log>
+ <component>CiviPledge</component>
<field>
<name>id</name>
<uniqueName>pledge_payment_id</uniqueName>
<name>civicrm_line_item</name>
<add>1.7</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Line Item ID</title>
<name>civicrm_price_field</name>
<add>1.8</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Price Field ID</title>
<class>PriceFieldValue</class>
<name>civicrm_price_field_value</name>
<add>3.3</add>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Price Field Value ID</title>
<name>civicrm_price_set</name>
<add>1.8</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Price Set</title>
<name>civicrm_price_set_entity</name>
<add>1.8</add>
<log>true</log>
+ <component>CiviContribute</component>
<field>
<name>id</name>
<title>Price Set Entity ID</title>
<add>2.2</add>
<title>Report</title>
<icon>fa-bar-chart</icon>
+ <component>CiviReport</component>
<field>
<name>id</name>
<title>Report Instance ID</title>
const EXT = {$ext};
const TABLE_ADDED = '{$table.add}';
+ {if !empty($table.component)}const COMPONENT = '{$table.component}';{/if}
/**
* Static instance to hold the table name.
<?xml version="1.0" encoding="iso-8859-1" ?>
<version>
- <version_no>5.33.alpha1</version_no>
+ <version_no>5.34.alpha1</version_no>
</version>