本文整理汇总了PHP中CRM_Core_DAO_UFGroup::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_DAO_UFGroup::fetch方法的具体用法?PHP CRM_Core_DAO_UFGroup::fetch怎么用?PHP CRM_Core_DAO_UFGroup::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_DAO_UFGroup
的用法示例。
在下文中一共展示了CRM_Core_DAO_UFGroup::fetch方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade_3_4_3
/**
* @param $rev
*/
public function upgrade_3_4_3($rev)
{
// CRM-8147, update group_type for uf groups, check and add component field types
$ufGroups = new CRM_Core_DAO_UFGroup();
$ufGroups->find();
$skipGroupTypes = array('Individual,Contact', 'Organization,Contact', 'Household,Contact', 'Contact', 'Individual', 'Organization', 'Household');
while ($ufGroups->fetch()) {
if (!in_array($ufGroups->group_type, $skipGroupTypes)) {
$groupTypes = CRM_Core_BAO_UFGroup::calculateGroupType($ufGroups->id, TRUE);
CRM_Core_BAO_UFGroup::updateGroupTypes($ufGroups->id, $groupTypes);
}
}
$ufGroups->free();
// CRM-8134 add phone_ext column if it wasn't already added for this site in 3.3.7 upgrade (3.3.7 was released after 3.4.0)
$dao = new CRM_Contact_DAO_Contact();
$dbName = $dao->_database;
$chkExtQuery = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = %1\n AND TABLE_NAME = 'civicrm_phone' AND COLUMN_NAME = 'phone_ext'";
$extensionExists = CRM_Core_DAO::singleValueQuery($chkExtQuery, array(1 => array($dbName, 'String')), TRUE, FALSE);
if (!$extensionExists) {
$colQuery = 'ALTER TABLE `civicrm_phone` ADD `phone_ext` VARCHAR( 16 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL AFTER `phone` ';
CRM_Core_DAO::executeQuery($colQuery);
}
$sql = "SELECT id FROM civicrm_location_type WHERE name = 'Main'";
if (!CRM_Core_DAO::singleValueQuery($sql)) {
$query = "\nINSERT INTO civicrm_location_type ( name, description, is_reserved, is_active )\n VALUES ( 'Main', 'Main office location', 0, 1 );";
CRM_Core_DAO::executeQuery($query);
}
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
}
示例2: VARCHAR
function upgrade_3_3_alpha1($rev)
{
$config = CRM_Core_Config::singleton();
if ($config->userSystem->is_drupal) {
// CRM-6426 - make civicrm profiles permissioned on drupal my account
$config->userSystem->updateCategories();
}
// CRM-6846
// insert name column for custom field table.
// make sure name for custom field, group and
// profile should be unique and properly munged.
$colQuery = 'ALTER TABLE `civicrm_custom_field` ADD `name` VARCHAR( 64 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NULL DEFAULT NULL AFTER `custom_group_id` ';
CRM_Core_DAO::executeQuery($colQuery, CRM_Core_DAO::$_nullArray, TRUE, NULL, FALSE, FALSE);
$customFldCntQuery = 'select count(*) from civicrm_custom_field where name like %1 and id != %2';
$customField = new CRM_Core_DAO_CustomField();
$customField->selectAdd();
$customField->selectAdd('id, label');
$customField->find();
while ($customField->fetch()) {
$name = CRM_Utils_String::munge($customField->label, '_', 64);
$fldCnt = CRM_Core_DAO::singleValueQuery($customFldCntQuery, array(1 => array($name, 'String'), 2 => array($customField->id, 'Integer')), TRUE, FALSE);
if ($fldCnt) {
$name = CRM_Utils_String::munge("{$name}_" . rand(), '_', 64);
}
$customFieldQuery = "\nUpdate `civicrm_custom_field`\nSET `name` = %1\nWHERE id = %2\n";
$customFieldParams = array(1 => array($name, 'String'), 2 => array($customField->id, 'Integer'));
CRM_Core_DAO::executeQuery($customFieldQuery, $customFieldParams, TRUE, NULL, FALSE, FALSE);
}
$customField->free();
$customGrpCntQuery = 'select count(*) from civicrm_custom_group where name like %1 and id != %2';
$customGroup = new CRM_Core_DAO_CustomGroup();
$customGroup->selectAdd();
$customGroup->selectAdd('id, title');
$customGroup->find();
while ($customGroup->fetch()) {
$name = CRM_Utils_String::munge($customGroup->title, '_', 64);
$grpCnt = CRM_Core_DAO::singleValueQuery($customGrpCntQuery, array(1 => array($name, 'String'), 2 => array($customGroup->id, 'Integer')));
if ($grpCnt) {
$name = CRM_Utils_String::munge("{$name}_" . rand(), '_', 64);
}
CRM_Core_DAO::setFieldValue('CRM_Core_DAO_CustomGroup', $customGroup->id, 'name', $name);
}
$customGroup->free();
$ufGrpCntQuery = 'select count(*) from civicrm_uf_group where name like %1 and id != %2';
$ufGroup = new CRM_Core_DAO_UFGroup();
$ufGroup->selectAdd();
$ufGroup->selectAdd('id, title');
$ufGroup->find();
while ($ufGroup->fetch()) {
$name = CRM_Utils_String::munge($ufGroup->title, '_', 64);
$ufGrpCnt = CRM_Core_DAO::singleValueQuery($ufGrpCntQuery, array(1 => array($name, 'String'), 2 => array($ufGroup->id, 'Integer')));
if ($ufGrpCnt) {
$name = CRM_Utils_String::munge("{$name}_" . rand(), '_', 64);
}
CRM_Core_DAO::setFieldValue('CRM_Core_DAO_UFGroup', $ufGroup->id, 'name', $name);
}
$ufGroup->free();
$upgrade = new CRM_Upgrade_Form();
$upgrade->processSQL($rev);
// now modify the config so that the directories are stored in option group/value
// CRM-6914
// require_once 'CRM/Core/BAO/ConfigSetting.php';
// $params = array( );
// CRM_Core_BAO_ConfigSetting::add( $parambs );
}
示例3: checkProfileGroupType
/**
* function to check for mix profiles groups (eg: individual + other contact types)
*
* @return true for mix profile group else false
* @acess public
* @static
*/
static function checkProfileGroupType($ctype)
{
$ufGroup = new CRM_Core_DAO_UFGroup();
$query = "\nSELECT ufg.id as id\n FROM civicrm_uf_group as ufg, civicrm_uf_join as ufj\n WHERE ufg.id = ufj.uf_group_id\n AND ufj.module = 'User Registration'\n AND ufg.is_active = 1 ";
$ufGroup =& CRM_Core_DAO::executeQuery($query);
$fields = array();
$validProfiles = array('Individual', 'Organization', 'Household', 'Contribution');
while ($ufGroup->fetch()) {
$profileType = self::getProfileType($ufGroup->id);
if (in_array($profileType, $validProfiles)) {
continue;
} else {
if ($profileType) {
return false;
}
}
}
return true;
}