From 93bfa565cac6cdfb8a5914a85ccc2dccccde8e96 Mon Sep 17 00:00:00 2001 From: kurund Date: Thu, 13 Feb 2014 13:28:13 -0800 Subject: [PATCH] CRM-14181, more clean and fixes to support callback ---------------------------------------- * CRM-14181: migrate enums to varchar in schema for all tables http://issues.civicrm.org/jira/browse/CRM-14181 --- CRM/Core/SelectValues.php | 25 ++++++++++++++++++++++ CRM/Group/Form/Edit.php | 4 +--- CRM/Mailing/Form/Settings.php | 4 +--- CRM/Member/Form/MembershipType.php | 2 +- xml/schema/ACL/ACL.xml | 2 +- xml/schema/Campaign/CampaignGroup.xml | 2 +- xml/schema/Contact/ACLContactCache.xml | 2 +- xml/schema/Contact/Contact.xml | 2 +- xml/schema/Contact/Group.xml | 2 +- xml/schema/Contact/GroupContact.xml | 2 +- xml/schema/Contact/RelationshipType.xml | 4 ++-- xml/schema/Contact/SubscriptionHistory.xml | 4 ++-- xml/schema/Contribute/Product.xml | 6 +++--- xml/schema/Core/CustomField.xml | 4 ++-- xml/schema/Core/CustomGroup.xml | 2 +- xml/schema/Core/Extension.xml | 2 +- xml/schema/Core/Job.xml | 2 +- xml/schema/Core/MappingField.xml | 2 +- xml/schema/Core/UFField.xml | 2 +- xml/schema/Core/UFGroup.xml | 2 +- xml/schema/Core/WordReplacement.xml | 2 +- xml/schema/Dedupe/RuleGroup.xml | 2 +- xml/schema/Event/ParticipantStatusType.xml | 2 +- xml/schema/Mailing/Component.xml | 2 +- xml/schema/Mailing/Mailing.xml | 2 +- xml/schema/Mailing/MailingGroup.xml | 2 +- xml/schema/Mailing/MailingJob.xml | 2 +- xml/schema/Member/MembershipStatus.xml | 8 +++---- xml/schema/Member/MembershipType.xml | 4 ++-- xml/schema/Price/PriceField.xml | 2 +- 30 files changed, 63 insertions(+), 42 deletions(-) diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 59512601d2..88372829e1 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -125,6 +125,18 @@ class CRM_Core_SelectValues { return $unitList; } + /** + * membership type unit + * @static + */ + static function membershipTypeUnitList( ) { + static $membershipTypeUnitList = NULL; + if (!$membershipTypeUnitList) { + $membershipTypeUnitList = self::unitList('duration'); + } + return $membershipTypeUnitList; + } + /** * various pre defined period types * @static @@ -394,6 +406,19 @@ class CRM_Core_SelectValues { return $_visibility; } + /** + * values for group form visibility options + * + * @static + */ + static function groupVisibility() { + static $_groupVisibility = NULL; + if (!$_groupVisibility) { + $_groupVisibility = self::ufVisibility(true); + } + return $_groupVisibility; + } + /** * different type of Mailing Components * diff --git a/CRM/Group/Form/Edit.php b/CRM/Group/Form/Edit.php index 17d97c96c4..fa38878f74 100644 --- a/CRM/Group/Form/Edit.php +++ b/CRM/Group/Form/Edit.php @@ -265,9 +265,7 @@ class CRM_Group_Form_Edit extends CRM_Core_Form { ); } - $this->add('select', 'visibility', ts('Visibility'), - CRM_Core_SelectValues::ufVisibility(TRUE), TRUE - ); + $this->add('select', 'visibility', ts('Visibility'), CRM_Core_SelectValues::groupVisibility(), TRUE); $groupNames = CRM_Core_PseudoConstant::group(); diff --git a/CRM/Mailing/Form/Settings.php b/CRM/Mailing/Form/Settings.php index d931a2fb0a..46b1803f7a 100644 --- a/CRM/Mailing/Form/Settings.php +++ b/CRM/Mailing/Form/Settings.php @@ -121,9 +121,7 @@ class CRM_Mailing_Form_Settings extends CRM_Core_Form { $this->add('checkbox', 'auto_responder', ts('Auto-respond to Replies?')); $defaults['auto_responder'] = FALSE; - $this->add('select', 'visibility', ts('Mailing Visibility'), - CRM_Core_SelectValues::ufVisibility(TRUE), TRUE - ); + $this->add('select', 'visibility', ts('Mailing Visibility'), CRM_Core_SelectValues::groupVisibility(), TRUE); $this->add('select', 'reply_id', ts('Auto-responder'), CRM_Mailing_PseudoConstant::component('Reply'), TRUE diff --git a/CRM/Member/Form/MembershipType.php b/CRM/Member/Form/MembershipType.php index b24043531f..f703d1d369 100644 --- a/CRM/Member/Form/MembershipType.php +++ b/CRM/Member/Form/MembershipType.php @@ -137,7 +137,7 @@ class CRM_Member_Form_MembershipType extends CRM_Member_Form { ); $this->addRule('minimum_fee', ts('Please enter a monetary value for the Minimum Fee.'), 'money'); - $this->addElement('select', 'duration_unit', ts('Duration'), CRM_Core_SelectValues::unitList('duration')); + $this->addElement('select', 'duration_unit', ts('Duration'), CRM_Core_SelectValues::membershipTypeUnitList()); //period type $this->addElement('select', 'period_type', ts('Period Type'), CRM_Core_SelectValues::periodType()); diff --git a/xml/schema/ACL/ACL.xml b/xml/schema/ACL/ACL.xml index 046d75fa20..62fc944b6c 100644 --- a/xml/schema/ACL/ACL.xml +++ b/xml/schema/ACL/ACL.xml @@ -66,7 +66,7 @@ true What operation does this ACL entry control? - CRM_ACL_BAO_ACL::operation() + CRM_ACL_BAO_ACL::operation Select diff --git a/xml/schema/Campaign/CampaignGroup.xml b/xml/schema/Campaign/CampaignGroup.xml index 49d5817168..a3b849a588 100644 --- a/xml/schema/Campaign/CampaignGroup.xml +++ b/xml/schema/Campaign/CampaignGroup.xml @@ -45,7 +45,7 @@ NULL Type of Group. - CRM_Core_SelectValues::getCampaignGroupTypes() + CRM_Core_SelectValues::getCampaignGroupTypes Select diff --git a/xml/schema/Contact/ACLContactCache.xml b/xml/schema/Contact/ACLContactCache.xml index 5a6150f383..32448ead05 100644 --- a/xml/schema/Contact/ACLContactCache.xml +++ b/xml/schema/Contact/ACLContactCache.xml @@ -51,7 +51,7 @@ true What operation does this user have permission on? - CRM_ACL_BAO_ACL::operation() + CRM_ACL_BAO_ACL::operation 1.6 diff --git a/xml/schema/Contact/Contact.xml b/xml/schema/Contact/Contact.xml index 4b76895a39..374fa6a61d 100644 --- a/xml/schema/Contact/Contact.xml +++ b/xml/schema/Contact/Contact.xml @@ -323,7 +323,7 @@ What is the preferred mode of sending an email. 1.1 - CRM_Core_SelectValues::pmf() + CRM_Core_SelectValues::pmf Select diff --git a/xml/schema/Contact/Group.xml b/xml/schema/Contact/Group.xml index 444b6a6178..5cab0e21b0 100644 --- a/xml/schema/Contact/Group.xml +++ b/xml/schema/Contact/Group.xml @@ -85,7 +85,7 @@ 'User and User Admin Only' In what context(s) is this field visible. - CRM_Core_SelectValues::ufVisibility(true) + CRM_Core_SelectValues::groupVisibility 1.2 diff --git a/xml/schema/Contact/GroupContact.xml b/xml/schema/Contact/GroupContact.xml index 837f820b5a..014b2b028c 100644 --- a/xml/schema/Contact/GroupContact.xml +++ b/xml/schema/Contact/GroupContact.xml @@ -64,7 +64,7 @@ Group Contact Status status of contact relative to membership in group - CRM_Core_SelectValues::groupContactStatus() + CRM_Core_SelectValues::groupContactStatus 1.1 diff --git a/xml/schema/Contact/RelationshipType.xml b/xml/schema/Contact/RelationshipType.xml index c9e3e1937b..08280f652f 100644 --- a/xml/schema/Contact/RelationshipType.xml +++ b/xml/schema/Contact/RelationshipType.xml @@ -66,7 +66,7 @@ 12 If defined, contact_a in a relationship of this type must be a specific contact_type. - CRM_Contact_BAO_ContactType::getSelectElements() + CRM_Contact_BAO_ContactType::getSelectElements 1.1 @@ -80,7 +80,7 @@ 12 If defined, contact_b in a relationship of this type must be a specific contact_type. - CRM_Contact_BAO_ContactType::getSelectElements() + CRM_Contact_BAO_ContactType::getSelectElements 1.1 diff --git a/xml/schema/Contact/SubscriptionHistory.xml b/xml/schema/Contact/SubscriptionHistory.xml index bfcb7a257d..af7dacdce0 100644 --- a/xml/schema/Contact/SubscriptionHistory.xml +++ b/xml/schema/Contact/SubscriptionHistory.xml @@ -66,7 +66,7 @@ 8 How the (un)subscription was triggered - CRM_Core_SelectValues::getSubscriptionHistoryMethods() + CRM_Core_SelectValues::getSubscriptionHistoryMethods 1.1 @@ -79,7 +79,7 @@ 8 The state of the contact within the group - CRM_Core_SelectValues::groupContactStatus() + CRM_Core_SelectValues::groupContactStatus 1.1 diff --git a/xml/schema/Contribute/Product.xml b/xml/schema/Contribute/Product.xml index 2761dc6b4a..f5d689afc8 100644 --- a/xml/schema/Contribute/Product.xml +++ b/xml/schema/Contribute/Product.xml @@ -141,7 +141,7 @@ Rolling means we set start/end based on current day, fixed means we set start/end for current year or month (e.g. 1 year + fixed -> we would set start/end for 1/1/06 thru 12/31/06 for any premium chosen in 2006) - CRM_Core_SelectValues::periodType() + CRM_Core_SelectValues::periodType 1.4 @@ -163,7 +163,7 @@ 8 'year' - CRM_Core_SelectValues::getPremiumUnits() + CRM_Core_SelectValues::getPremiumUnits 1.4 @@ -185,7 +185,7 @@ 'month' Frequency unit and interval allow option to store actual delivery frequency for a subscription or service. - CRM_Core_SelectValues::getPremiumUnits() + CRM_Core_SelectValues::getPremiumUnits 1.4 diff --git a/xml/schema/Core/CustomField.xml b/xml/schema/Core/CustomField.xml index 3efb5c00c1..3e0f7a57ea 100644 --- a/xml/schema/Core/CustomField.xml +++ b/xml/schema/Core/CustomField.xml @@ -63,7 +63,7 @@ true Controls location of data storage in extended_data table. - CRM_Core_BAO_CustomField::dataType() + CRM_Core_BAO_CustomField::dataType 1.1 @@ -77,7 +77,7 @@ true HTML types plus several built-in extended types. - CRM_Core_BAO_CustomField::dataToHtml() + CRM_Core_BAO_CustomField::dataToHtml 1.1 diff --git a/xml/schema/Core/CustomGroup.xml b/xml/schema/Core/CustomGroup.xml index 9eae882192..68834bcc13 100644 --- a/xml/schema/Core/CustomGroup.xml +++ b/xml/schema/Core/CustomGroup.xml @@ -71,7 +71,7 @@ 8 Visual relationship between this form and its parent. - CRM_Core_SelectValues::customGroupStyle() + CRM_Core_SelectValues::customGroupStyle 1.1 diff --git a/xml/schema/Core/Extension.xml b/xml/schema/Core/Extension.xml index 3d1abc4817..573ae549f3 100644 --- a/xml/schema/Core/Extension.xml +++ b/xml/schema/Core/Extension.xml @@ -25,7 +25,7 @@ true - CRM_Core_SelectValues::getExtensionTypes() + CRM_Core_SelectValues::getExtensionTypes 4.2 diff --git a/xml/schema/Core/Job.xml b/xml/schema/Core/Job.xml index fcf89f856f..4597172cd2 100644 --- a/xml/schema/Core/Job.xml +++ b/xml/schema/Core/Job.xml @@ -38,7 +38,7 @@ "Daily" Scheduled job run frequency. - CRM_Core_SelectValues::getJobFrequency() + CRM_Core_SelectValues::getJobFrequency 4.1 diff --git a/xml/schema/Core/MappingField.xml b/xml/schema/Core/MappingField.xml index 3cefbc8e93..5c136763ee 100644 --- a/xml/schema/Core/MappingField.xml +++ b/xml/schema/Core/MappingField.xml @@ -142,7 +142,7 @@ enum SQL WHERE operator for search-builder mapping fields (search criteria). - CRM_Core_SelectValues::getSearchBuilderOperators() + CRM_Core_SelectValues::getSearchBuilderOperators 1.5 diff --git a/xml/schema/Core/UFField.xml b/xml/schema/Core/UFField.xml index 582b1dcdb6..7aac57cbd1 100644 --- a/xml/schema/Core/UFField.xml +++ b/xml/schema/Core/UFField.xml @@ -114,7 +114,7 @@ 'User and User Admin Only' In what context(s) is this field visible. - CRM_Core_SelectValues::ufVisibility() + CRM_Core_SelectValues::ufVisibility 1.1 diff --git a/xml/schema/Core/UFGroup.xml b/xml/schema/Core/UFGroup.xml index 7ae8901c60..df8409a31b 100644 --- a/xml/schema/Core/UFGroup.xml +++ b/xml/schema/Core/UFGroup.xml @@ -32,7 +32,7 @@ true This column will store a comma separated list of the type(s) of profile fields. - CRM_Core_SelectValues::getProfileGroupType() + CRM_Core_SelectValues::getProfileGroupType 2.1 diff --git a/xml/schema/Core/WordReplacement.xml b/xml/schema/Core/WordReplacement.xml index 5a16a83953..9c64a1afe6 100644 --- a/xml/schema/Core/WordReplacement.xml +++ b/xml/schema/Core/WordReplacement.xml @@ -54,7 +54,7 @@ 16 "wildcardMatch" - CRM_Core_SelectValues::getWordReplacementMatchType() + CRM_Core_SelectValues::getWordReplacementMatchType 4.4 diff --git a/xml/schema/Dedupe/RuleGroup.xml b/xml/schema/Dedupe/RuleGroup.xml index 90ce856878..eb59b83758 100644 --- a/xml/schema/Dedupe/RuleGroup.xml +++ b/xml/schema/Dedupe/RuleGroup.xml @@ -54,7 +54,7 @@ true Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically) - CRM_Core_SelectValues::getDedupeRuleTypes() + CRM_Core_SelectValues::getDedupeRuleTypes 4.3 diff --git a/xml/schema/Event/ParticipantStatusType.xml b/xml/schema/Event/ParticipantStatusType.xml index 0f7c5e4ec2..407c6d1b1e 100644 --- a/xml/schema/Event/ParticipantStatusType.xml +++ b/xml/schema/Event/ParticipantStatusType.xml @@ -43,7 +43,7 @@ 8 the general group of status type this one belongs to - CRM_Event_PseudoConstant::participantStatusClass() + CRM_Event_PseudoConstant::participantStatusClass 3.0 diff --git a/xml/schema/Mailing/Component.xml b/xml/schema/Mailing/Component.xml index 7c7d934818..9ff4b2accd 100644 --- a/xml/schema/Mailing/Component.xml +++ b/xml/schema/Mailing/Component.xml @@ -27,7 +27,7 @@ 12 Type of Component. - CRM_Core_SelectValues::mailingComponents() + CRM_Core_SelectValues::mailingComponents Select diff --git a/xml/schema/Mailing/Mailing.xml b/xml/schema/Mailing/Mailing.xml index 9ee2ed8748..81fb8d2e22 100644 --- a/xml/schema/Mailing/Mailing.xml +++ b/xml/schema/Mailing/Mailing.xml @@ -303,7 +303,7 @@ 'User and User Admin Only' In what context(s) is the mailing contents visible (online viewing) - CRM_Core_SelectValues::ufVisibility(true) + CRM_Core_SelectValues::groupVisibility 3.3 diff --git a/xml/schema/Mailing/MailingGroup.xml b/xml/schema/Mailing/MailingGroup.xml index b986986abf..0d45536818 100644 --- a/xml/schema/Mailing/MailingGroup.xml +++ b/xml/schema/Mailing/MailingGroup.xml @@ -33,7 +33,7 @@ 8 Are the members of the group included or excluded?. - CRM_Core_SelectValues::getMailingGroupTypes() + CRM_Core_SelectValues::getMailingGroupTypes Select diff --git a/xml/schema/Mailing/MailingJob.xml b/xml/schema/Mailing/MailingJob.xml index e489c517df..3fb29e4617 100644 --- a/xml/schema/Mailing/MailingJob.xml +++ b/xml/schema/Mailing/MailingJob.xml @@ -48,7 +48,7 @@ 12 The state of this job - CRM_Core_SelectValues::geMailingJobStatus() + CRM_Core_SelectValues::geMailingJobStatus Select diff --git a/xml/schema/Member/MembershipStatus.xml b/xml/schema/Member/MembershipStatus.xml index 85cc4be608..03cbec8012 100644 --- a/xml/schema/Member/MembershipStatus.xml +++ b/xml/schema/Member/MembershipStatus.xml @@ -42,7 +42,7 @@ 12 Event when this status starts. - CRM_Core_SelectValues::eventDate() + CRM_Core_SelectValues::eventDate 1.5 @@ -55,7 +55,7 @@ 8 Unit used for adjusting from start_event. - CRM_Core_SelectValues::unitList() + CRM_Core_SelectValues::unitList 1.5 @@ -74,7 +74,7 @@ 12 Event after which this status ends. - CRM_Core_SelectValues::eventDate() + CRM_Core_SelectValues::eventDate 1.5 @@ -87,7 +87,7 @@ 8 Unit used for adjusting from the ending event. - CRM_Core_SelectValues::unitList() + CRM_Core_SelectValues::unitList 1.5 diff --git a/xml/schema/Member/MembershipType.xml b/xml/schema/Member/MembershipType.xml index d5999cf198..ffbab31e17 100644 --- a/xml/schema/Member/MembershipType.xml +++ b/xml/schema/Member/MembershipType.xml @@ -110,7 +110,7 @@ 8 Unit in which membership period is expressed. - CRM_Core_SelectValues::unitList('duration') + CRM_Core_SelectValues::membershipTypeUnitList 1.5 @@ -129,7 +129,7 @@ 8 Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day. - CRM_Core_SelectValues::periodType() + CRM_Core_SelectValues::periodType 1.5 diff --git a/xml/schema/Price/PriceField.xml b/xml/schema/Price/PriceField.xml index 6fe1e27dae..37ef91f5c3 100644 --- a/xml/schema/Price/PriceField.xml +++ b/xml/schema/Price/PriceField.xml @@ -66,7 +66,7 @@ 12 true - CRM_Price_BAO_PriceField::htmlTypes() + CRM_Price_BAO_PriceField::htmlTypes 1.8 -- 2.25.1