From 29494eef068cf34b9c580a550142c88cc2271a14 Mon Sep 17 00:00:00 2001 From: Allen Shaw Date: Sat, 4 May 2013 15:28:23 -0700 Subject: [PATCH] Added xml metadata for group_id column in various tables. CRM-12464 ---------------------------------------- * CRM-12464: Search improvements in 4.4 http://issues.civicrm.org/jira/browse/CRM-12464 --- CRM/Core/PseudoConstant.php | 10 ++++ tests/phpunit/CRM/Core/PseudoConstantTest.php | 46 +++++++++++++++++++ xml/schema/Bridge/OG.xml | 10 ++++ xml/schema/Bridge/Role.xml | 15 ++++-- xml/schema/Contact/GroupContact.xml | 17 ++++--- xml/schema/Contact/GroupContactCache.xml | 15 ++++-- xml/schema/Contact/GroupOrganization.xml | 5 ++ xml/schema/Contact/SubscriptionHistory.xml | 13 ++++-- xml/schema/Core/ActionSchedule.xml | 15 ++++-- xml/schema/Mailing/Event/Subscribe.xml | 13 ++++-- 10 files changed, 130 insertions(+), 29 deletions(-) diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index ff35937d1a..bb8e4bf774 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -57,6 +57,8 @@ class CRM_Core_PseudoConstant { private static $cache; /** + * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. + * * activity type * @var array * @static @@ -106,6 +108,8 @@ class CRM_Core_PseudoConstant { private static $countryIsoCode; /** + * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. + * * group * @var array * @static @@ -162,6 +166,8 @@ class CRM_Core_PseudoConstant { private static $worldRegions; /** + * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. + * * activity status * @var array * @static @@ -785,6 +791,8 @@ WHERE id = %1"; } /** + * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. + * * Get all groups from database * * The static array group is returned, and if it's @@ -1351,6 +1359,8 @@ WHERE id = %1"; } /** + * DEPRECATED. Please use the buildOptions() method in the appropriate BAO object. + * * Get all Activity Statuses. * * The static array activityStatus is returned diff --git a/tests/phpunit/CRM/Core/PseudoConstantTest.php b/tests/phpunit/CRM/Core/PseudoConstantTest.php index af1a2d6997..6df056dd58 100644 --- a/tests/phpunit/CRM/Core/PseudoConstantTest.php +++ b/tests/phpunit/CRM/Core/PseudoConstantTest.php @@ -49,6 +49,7 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase { */ function testOptionValues() { + // Create a custom field group for testing. $custom_group_name = md5(microtime()); $api_params = array( 'version' => 3, @@ -58,6 +59,15 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase { ); $result = civicrm_api('customGroup', 'create', $api_params); + // Create a Group for testing. + $group_name = md5(microtime()); + $api_params = array( + 'version' => 3, + 'title' => $group_name, + 'is_active' => TRUE, + ); + $result = civicrm_api('group', 'create', $api_params); + /** * daoName/field combinations to test * Format: array[DAO Name] = $properties, where properties is an array whose @@ -68,6 +78,42 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase { * - max: integer (default = 10) maximum number of option values expected. */ $fields = array( + 'CRM_Contact_DAO_GroupContact' => array( + array( + 'fieldName' => 'group_id', + 'sample' => $group_name, + ), + ), + 'CRM_Contact_DAO_GroupContactCache' => array( + array( + 'fieldName' => 'group_id', + 'sample' => $group_name, + ), + ), + 'CRM_Contact_DAO_GroupOrganization' => array( + array( + 'fieldName' => 'group_id', + 'sample' => $group_name, + ), + ), + 'CRM_Contact_DAO_SubscriptionHistory' => array( + array( + 'fieldName' => 'group_id', + 'sample' => $group_name, + ), + ), + 'CRM_Core_DAO_ActionSchedule' => array( + array( + 'fieldName' => 'group_id', + 'sample' => $group_name, + ), + ), + 'CRM_Mailing_Event_DAO_Subscribe' => array( + array( + 'fieldName' => 'group_id', + 'sample' => $group_name, + ), + ), 'CRM_Activity_DAO_Activity' => array( array( 'fieldName' => 'activity_type_id', diff --git a/xml/schema/Bridge/OG.xml b/xml/schema/Bridge/OG.xml index c9e8a28e92..c1a171e2af 100644 --- a/xml/schema/Bridge/OG.xml +++ b/xml/schema/Bridge/OG.xml @@ -34,6 +34,11 @@ true FK to civicrm group. 2.0 + + civicrm_group
+ id + title +
group_id @@ -60,6 +65,11 @@ true FK to admin civicrm group. 2.0 + + civicrm_group
+ id + title +
admin_group_id diff --git a/xml/schema/Bridge/Role.xml b/xml/schema/Bridge/Role.xml index 726b1583ee..948c53982c 100644 --- a/xml/schema/Bridge/Role.xml +++ b/xml/schema/Bridge/Role.xml @@ -29,11 +29,16 @@ 2.0 - group_id - int unsigned - true - FK to civicrm group. - 2.0 + group_id + int unsigned + true + FK to civicrm group. + 2.0 + + civicrm_group
+ id + title +
group_id diff --git a/xml/schema/Contact/GroupContact.xml b/xml/schema/Contact/GroupContact.xml index 1c1b8b3b60..5aed17d81b 100644 --- a/xml/schema/Contact/GroupContact.xml +++ b/xml/schema/Contact/GroupContact.xml @@ -20,12 +20,17 @@ true - group_id - int unsigned - Group ID - true - FK to civicrm_group - 1.1 + group_id + int unsigned + Group ID + true + FK to civicrm_group + 1.1 + + civicrm_group
+ id + title +
group_id diff --git a/xml/schema/Contact/GroupContactCache.xml b/xml/schema/Contact/GroupContactCache.xml index 6dbc52d91e..893b0e03d8 100644 --- a/xml/schema/Contact/GroupContactCache.xml +++ b/xml/schema/Contact/GroupContactCache.xml @@ -18,11 +18,16 @@ true - group_id - int unsigned - true - FK to civicrm_group - 2.1 + group_id + int unsigned + true + FK to civicrm_group + 2.1 + + civicrm_group
+ id + title +
group_id diff --git a/xml/schema/Contact/GroupOrganization.xml b/xml/schema/Contact/GroupOrganization.xml index 6d5e33253e..1f8afa6137 100644 --- a/xml/schema/Contact/GroupOrganization.xml +++ b/xml/schema/Contact/GroupOrganization.xml @@ -24,6 +24,11 @@ true ID of the group 2.0 + + civicrm_group
+ id + title +
group_id diff --git a/xml/schema/Contact/SubscriptionHistory.xml b/xml/schema/Contact/SubscriptionHistory.xml index 846fc86dc4..f308694092 100644 --- a/xml/schema/Contact/SubscriptionHistory.xml +++ b/xml/schema/Contact/SubscriptionHistory.xml @@ -33,10 +33,15 @@ CASCADE - group_id - int unsigned - Group Id - 1.1 + group_id + int unsigned + Group Id + 1.1 + + civicrm_group
+ id + title +
group_id diff --git a/xml/schema/Core/ActionSchedule.xml b/xml/schema/Core/ActionSchedule.xml index 12d6feb003..1d4dff806c 100644 --- a/xml/schema/Core/ActionSchedule.xml +++ b/xml/schema/Core/ActionSchedule.xml @@ -189,11 +189,16 @@ SET NULL - group_id - int unsigned - FK to Group - 3.4 - + group_id + int unsigned + FK to Group + + civicrm_group
+ id + title +
+ 3.4 + group_id civicrm_group
diff --git a/xml/schema/Mailing/Event/Subscribe.xml b/xml/schema/Mailing/Event/Subscribe.xml index 5ddf290803..2a458bb6fb 100644 --- a/xml/schema/Mailing/Event/Subscribe.xml +++ b/xml/schema/Mailing/Event/Subscribe.xml @@ -16,10 +16,15 @@ true - group_id - int unsigned - true - FK to Group + group_id + int unsigned + true + FK to Group + + civicrm_group
+ id + title +
group_id -- 2.25.1