* @param string $contactType
*
* @return bool
+ *
+ * @throws \API_Exception
*/
public static function isActive($contactType) {
- $contact = self::contactTypeInfo(FALSE);
+ $contact = self::contactTypeInfo();
return array_key_exists($contactType, $contact);
}
/**
* Retrieve all subtypes Information.
*
- * @todo - call getAllContactTypes & return filtered results.
- *
* @param array $contactType
- * ..
* @param bool $all
- * @param bool $ignoreCache
*
* @return array
- * Array of sub type information
+ * Array of sub type information, subset of getAllContactTypes.
+ *
+ * @throws \API_Exception
*/
- public static function subTypeInfo($contactType = NULL, $all = FALSE, $ignoreCache = FALSE) {
- $argString = $all ? 'CRM_CT_STI_1_' : 'CRM_CT_STI_0_';
- if (!empty($contactType)) {
- $contactType = (array) $contactType;
- $argString .= implode('_', $contactType);
- }
- if (!Civi::cache('contactTypes')->has($argString) || $ignoreCache) {
- $ctWHERE = '';
- if (!empty($contactType)) {
- $ctWHERE = " AND parent.name IN ('" . implode("','", $contactType) . "')";
- }
-
- $sql = "
-SELECT subtype.*, parent.name as parent, parent.label as parent_label
-FROM civicrm_contact_type subtype
-INNER JOIN civicrm_contact_type parent ON subtype.parent_id = parent.id
-WHERE subtype.name IS NOT NULL AND subtype.parent_id IS NOT NULL {$ctWHERE}
-";
- if ($all === FALSE) {
- $sql .= " AND subtype.is_active = 1 AND parent.is_active = 1 ORDER BY parent.id";
- }
- $dao = CRM_Core_DAO::executeQuery($sql, [],
- FALSE, 'CRM_Contact_DAO_ContactType'
- );
- $values = [];
- while ($dao->fetch()) {
- $value = [];
- CRM_Core_DAO::storeValues($dao, $value);
- $value['parent'] = $dao->parent;
- $value['parent_label'] = $dao->parent_label;
- $values[$dao->name] = $value;
+ public static function subTypeInfo($contactType = NULL, $all = FALSE) {
+ $contactTypes = self::getAllContactTypes();
+ foreach ($contactTypes as $index => $type) {
+ if (empty($type['parent']) ||
+ (!$all && !$type['is_active'])
+ || ($contactType && $type['parent'] !== $contactType)
+ ) {
+ unset($contactTypes[$index]);
}
- Civi::cache('contactTypes')->set($argString, $values);
}
- return Civi::cache('contactTypes')->get($argString);
+ return $contactTypes;
}
/**
* @return array
* all subtypes OR list of subtypes associated to
* a given basic contact type
+ * @throws \API_Exception
*/
public static function subTypes($contactType = NULL, $all = FALSE, $columnName = 'name', $ignoreCache = FALSE) {
if ($columnName === 'name') {
*
* Generated from xml/schema/CRM/Contribute/Contribution.xml
* DO NOT EDIT. Generated by CRM_Core_CodeGen
- * (GenCodeChecksum:5e4c6a77803e361625cafbd2f6e58bbe)
+ * (GenCodeChecksum:74fa8c515ced28f337a6e6e35425f821)
*/
/**
'FKClassName' => 'CRM_Contribute_DAO_ContributionPage',
'html' => [
'type' => 'Select',
+ 'label' => ts("Contribution Page"),
],
'pseudoconstant' => [
'table' => 'civicrm_contribution_page',
--- /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 FiveThirty */
+class CRM_Upgrade_Incremental_php_FiveThirty 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.30.alpha1 during upgrade *}
{name: 'ang2', label: ts('Batch Calls'), code: ''}
],
cli: [
- {name: 'cv', label: ts('CV'), code: ''}
+ {name: 'short', label: ts('CV (short)'), code: ''},
+ {name: 'long', label: ts('CV (long)'), code: ''},
+ {name: 'pipe', label: ts('CV (pipe)'), code: ''}
]
};
}
// Then lookup implicit links
_.each(path, function(node) {
- entity = _.find(links[entity], {alias: node}).entity;
+ var link = _.find(links[entity], {alias: node});
+ if (!link) {
+ return false;
+ }
+ entity = link.entity;
});
return entity;
}
break;
case 'cli':
- // Write cli code
- code.cv = 'cv api4 ' + entity + '.' + action + " '" + stringify(params) + "'";
+ // Cli code using json input
+ code.long = 'cv api4 ' + entity + '.' + action + ' ' + cliFormat(JSON.stringify(params));
+ code.pipe = 'echo ' + cliFormat(JSON.stringify(params)) + ' | cv api4 ' + entity + '.' + action + ' --in=json';
+
+ // Cli code using short syntax
+ code.short = 'cv api4 ' + entity + '.' + action;
+ var limitSet = false;
+ _.each(params, function(param, key) {
+ switch (true) {
+ case (key === 'select' && !_.includes(param.join(), ' ')):
+ code.short += ' +s ' + cliFormat(param.join(','));
+ break;
+ case (key === 'where' && !_.intersection(_.map(param, 0), ['AND', 'OR', 'NOT']).length):
+ _.each(param, function(clause) {
+ code.short += ' +w ' + cliFormat(clause[0] + ' ' + clause[1] + (clause.length > 2 ? (' ' + JSON.stringify(clause[2])) : ''));
+ });
+ break;
+ case (key === 'orderBy'):
+ _.each(param, function(dir, field) {
+ code.short += ' +o ' + cliFormat(field + ' ' + dir);
+ });
+ break;
+ case (key === 'values'):
+ _.each(param, function(val, field) {
+ code.short += ' +v ' + cliFormat(field + '=' + val);
+ });
+ break;
+ case (key === 'limit' || key === 'offset'):
+ // These 2 get combined
+ if (!limitSet) {
+ limitSet = true;
+ code.short += ' +l ' + (params.limit || '0') + (params.offset ? ('@' + params.offset) : '');
+ }
+ break;
+ default:
+ code.short += ' ' + key + '=' + (typeof param === 'string' ? cliFormat(param) : cliFormat(JSON.stringify(param)));
+ }
+ });
}
}
_.each($scope.code, function(vals) {
return JSON.stringify(val).replace(/\$/g, '\\$');
}
+ // Format string to be cli-input-safe
+ function cliFormat(str) {
+ if (!_.includes(str, ' ') && !_.includes(str, '"') && !_.includes(str, "'")) {
+ return str;
+ }
+ if (!_.includes(str, "'")) {
+ return "'" + str + "'";
+ }
+ if (!_.includes(str, '"')) {
+ return '"' + str + '"';
+ }
+ return "'" + str.replace(/'/g, "\\'") + "'";
+ }
+
function fetchMeta() {
crmApi4(getMetaParams)
.then(function(data) {
"typo3/phar-stream-wrapper": "^2 || ^3.0",
"brick/money": "~0.4",
"ext-intl": "*",
- "pear/mail_mime": "~1.10"
+ "pear/mail_mime": "~1.10",
+ "pear/db": "1.10"
},
"scripts": {
"post-install-cmd": [
"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"
},
+ "pear/db": {
+ "Apply CiviCRM Customisations for the pear:db package": "https://raw.githubusercontent.com/civicrm/civicrm-core/a48a43c2b5f6d694fff1cfb99d522c5d9e2459a0/tools/scripts/composer/pear_db_civicrm_changes.patch"
+ },
"pear/mail": {
"Apply CiviCRM Customisations for CRM-1367 and CRM-5946": "https://raw.githubusercontent.com/civicrm/civicrm-core/36319938a5bf26c1e7e2110a26a65db6a5979268/tools/scripts/composer/patches/pear-mail.patch"
},
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "1ff9c045fb03756148c0c66562aa61fd",
+ "content-hash": "46e891da51f0683373d9a6e62fb6f868",
"packages": [
{
"name": "adrienrn/php-mimetyper",
"description": "More info available on: http://pear.php.net/package/Console_Getopt",
"time": "2015-07-20T20:28:12+00:00"
},
+ {
+ "name": "pear/db",
+ "version": "v1.10.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/pear/DB.git",
+ "reference": "e158c3a48246b67cd8c95856ffbb93de4ef380fe"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/pear/DB/zipball/e158c3a48246b67cd8c95856ffbb93de4ef380fe",
+ "reference": "e158c3a48246b67cd8c95856ffbb93de4ef380fe",
+ "shasum": ""
+ },
+ "require": {
+ "pear/pear-core-minimal": "*"
+ },
+ "type": "library",
+ "extra": {
+ "patches_applied": {
+ "Apply CiviCRM Customisations for the pear:db package": "https://raw.githubusercontent.com/civicrm/civicrm-core/a48a43c2b5f6d694fff1cfb99d522c5d9e2459a0/tools/scripts/composer/pear_db_civicrm_changes.patch"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "DB": "./"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "include-path": [
+ "./"
+ ],
+ "license": [
+ "PHP License v3.01"
+ ],
+ "authors": [
+ {
+ "name": "Daniel Convissor",
+ "email": "danielc@php.net",
+ "role": "Lead"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net",
+ "role": "Lead"
+ },
+ {
+ "name": "Stig Bakken",
+ "email": "stig@php.net",
+ "role": "Developer"
+ },
+ {
+ "name": "Tomas V.V.Cox",
+ "email": "cox@idecnet.com",
+ "role": "Developer"
+ }
+ ],
+ "description": "More info available on: http://pear.php.net/package/DB",
+ "time": "2020-04-19T19:45:59+00:00"
+ },
{
"name": "pear/log",
"version": "1.13.2",
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.29.beta1',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.30.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.29.beta1';
+UPDATE civicrm_domain SET version = '5.30.alpha1';
{$form.financial_type_id.html|crmAddClass:twenty}
</td>
<td>
- <label>{ts}Contribution Page{/ts}</label> <br />
+ <label>{$form.contribution_page_id.label}</label> <br />
{$form.contribution_page_id.html|crmAddClass:twenty}
</td>
</tr>
* configuration option, but wish to, for example, use fr_CA instead of the
* default fr_FR (for French), set one or more of the constants below to an
* appropriate regional value.
+ *
+ * Note that since 5.26.0 specifically https://github.com/civicrm/civicrm-core/pull/16700
+ * This generally doesn't get used by WordPress especially if using the Polylang plugin.
+ * The reason is that the WordPress implementation has been changed to get the full locale
+ * from the WordPress plugin rather than just the 2 string language code.
*/
// define('CIVICRM_LANGUAGE_MAPPING_FR', 'fr_CA');
// define('CIVICRM_LANGUAGE_MAPPING_EN', 'en_CA');
// check for type:Individual
$result = CRM_Contact_BAO_ContactType::subTypes('Individual');
$this->assertEquals(array_keys($this->getExpectedContactSubTypes('Individual')), $result);
+ $this->assertEquals($this->getExpectedContactSubTypes('Individual'), CRM_Contact_BAO_ContactType::subTypeInfo('Individual'));
// check for type:Organization
$result = CRM_Contact_BAO_ContactType::subTypes('Organization');
$this->assertEquals(array_keys($this->getExpectedContactSubTypes('Organization')), $result);
+ $this->assertEquals($this->getExpectedContactSubTypes('Organization'), CRM_Contact_BAO_ContactType::subTypeInfo('Organization'));
// check for type:Household
$result = CRM_Contact_BAO_ContactType::subTypes('Household');
$this->assertEquals(array_keys($this->getExpectedContactSubTypes('Household')), $result);
+ $this->assertEquals($this->getExpectedContactSubTypes('Household'), CRM_Contact_BAO_ContactType::subTypeInfo('Household'));
// check for all contact types
$result = CRM_Contact_BAO_ContactType::subTypes();
$subtypes = array_keys($this->getExpectedAllSubtypes());
$this->assertEquals(sort($subtypes), sort($result));
+ $this->assertEquals($this->getExpectedAllSubtypes(), CRM_Contact_BAO_ContactType::subTypeInfo());
+
}
/**
</pseudoconstant>
<html>
<type>Select</type>
+ <label>Contribution Page</label>
</html>
<add>1.5</add>
</field>
<?xml version="1.0" encoding="iso-8859-1" ?>
<version>
- <version_no>5.29.beta1</version_no>
+ <version_no>5.30.alpha1</version_no>
</version>