From 71a707c321340dd5dc1341b028dad40eeb6c1b44 Mon Sep 17 00:00:00 2001 From: kurund Date: Wed, 12 Feb 2014 21:53:36 -0800 Subject: [PATCH] CRM-14181, add callback function, so that enums are accessible via api etc ---------------------------------------- * CRM-14181: migrate enums to varchar in schema for all tables http://issues.civicrm.org/jira/browse/CRM-14181 --- CRM/Core/SelectValues.php | 33 ++++++++++++++++++++++ xml/schema/Dedupe/RuleGroup.xml | 9 ++++++ xml/schema/Event/ParticipantStatusType.xml | 3 ++ xml/schema/Mailing/BounceType.xml | 3 -- xml/schema/Mailing/Component.xml | 3 ++ xml/schema/Mailing/Mailing.xml | 3 ++ xml/schema/Mailing/MailingGroup.xml | 3 ++ xml/schema/Mailing/MailingJob.xml | 3 ++ xml/schema/Member/MembershipStatus.xml | 12 ++++++++ xml/schema/Member/MembershipType.xml | 6 ++++ xml/schema/Pledge/Pledge.xml | 4 +++ xml/schema/Price/PriceField.xml | 3 ++ 12 files changed, 82 insertions(+), 3 deletions(-) diff --git a/CRM/Core/SelectValues.php b/CRM/Core/SelectValues.php index 3c1edc26fb..59512601d2 100644 --- a/CRM/Core/SelectValues.php +++ b/CRM/Core/SelectValues.php @@ -1027,5 +1027,38 @@ class CRM_Core_SelectValues { return $jobFrequency; } + /** + * mailing group types + */ + static function getMailingGroupTypes() { + static $mailingGroupTypes = NULL; + if (!$mailingGroupTypes) { + $mailingGroupTypes = array( + 'Include' => ts('Include'), + 'Exclude' => ts('Exclude'), + 'Base' => ts('Base'), + ); + } + return $mailingGroupTypes; + } + + /** + * Mailing Job Status + */ + static function geMailingJobStatus() { + static $mailingJobStatus = NULL; + if (!$mailingJobStatus) { + $mailingJobStatus = array( + 'Scheduled' => ts('Scheduled'), + 'Running' => ts('Running'), + 'Complete' => ts('Complete'), + 'Paused' => ts('Paused'), + 'Canceled' => ts('Canceled'), + ); + } + + return $mailingJobStatus; + } + } diff --git a/xml/schema/Dedupe/RuleGroup.xml b/xml/schema/Dedupe/RuleGroup.xml index 6ec09dce67..90ce856878 100644 --- a/xml/schema/Dedupe/RuleGroup.xml +++ b/xml/schema/Dedupe/RuleGroup.xml @@ -21,6 +21,12 @@ varchar 12 The type of contacts this group applies to + + civicrm_contact_type
+ name + label + parent_id IS NULL +
1.8 Select @@ -47,6 +53,9 @@ 12 true Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically) + + CRM_Core_SelectValues::getDedupeRuleTypes() + 4.3 Select diff --git a/xml/schema/Event/ParticipantStatusType.xml b/xml/schema/Event/ParticipantStatusType.xml index c1449baa80..0f7c5e4ec2 100644 --- a/xml/schema/Event/ParticipantStatusType.xml +++ b/xml/schema/Event/ParticipantStatusType.xml @@ -42,6 +42,9 @@ varchar 8 the general group of status type this one belongs to + + CRM_Event_PseudoConstant::participantStatusClass() + 3.0 Select diff --git a/xml/schema/Mailing/BounceType.xml b/xml/schema/Mailing/BounceType.xml index 913194885e..392cc9169b 100644 --- a/xml/schema/Mailing/BounceType.xml +++ b/xml/schema/Mailing/BounceType.xml @@ -20,9 +20,6 @@ 8 true Type of bounce - - Select - description diff --git a/xml/schema/Mailing/Component.xml b/xml/schema/Mailing/Component.xml index 63e94a7085..7c7d934818 100644 --- a/xml/schema/Mailing/Component.xml +++ b/xml/schema/Mailing/Component.xml @@ -26,6 +26,9 @@ varchar 12 Type of Component. + + CRM_Core_SelectValues::mailingComponents() + Select diff --git a/xml/schema/Mailing/Mailing.xml b/xml/schema/Mailing/Mailing.xml index 21eead08d7..9ee2ed8748 100644 --- a/xml/schema/Mailing/Mailing.xml +++ b/xml/schema/Mailing/Mailing.xml @@ -302,6 +302,9 @@ 40 'User and User Admin Only' In what context(s) is the mailing contents visible (online viewing) + + CRM_Core_SelectValues::ufVisibility(true) + 3.3 Select diff --git a/xml/schema/Mailing/MailingGroup.xml b/xml/schema/Mailing/MailingGroup.xml index cab52163dc..b986986abf 100644 --- a/xml/schema/Mailing/MailingGroup.xml +++ b/xml/schema/Mailing/MailingGroup.xml @@ -32,6 +32,9 @@ varchar 8 Are the members of the group included or excluded?. + + CRM_Core_SelectValues::getMailingGroupTypes() + Select diff --git a/xml/schema/Mailing/MailingJob.xml b/xml/schema/Mailing/MailingJob.xml index 51dc63ff93..e489c517df 100644 --- a/xml/schema/Mailing/MailingJob.xml +++ b/xml/schema/Mailing/MailingJob.xml @@ -47,6 +47,9 @@ varchar 12 The state of this job + + CRM_Core_SelectValues::geMailingJobStatus() + Select diff --git a/xml/schema/Member/MembershipStatus.xml b/xml/schema/Member/MembershipStatus.xml index d214c4ed79..85cc4be608 100644 --- a/xml/schema/Member/MembershipStatus.xml +++ b/xml/schema/Member/MembershipStatus.xml @@ -41,6 +41,9 @@ varchar 12 Event when this status starts. + + CRM_Core_SelectValues::eventDate() + 1.5 Select @@ -51,6 +54,9 @@ varchar 8 Unit used for adjusting from start_event. + + CRM_Core_SelectValues::unitList() + 1.5 Select @@ -67,6 +73,9 @@ varchar 12 Event after which this status ends. + + CRM_Core_SelectValues::eventDate() + 1.5 Select @@ -77,6 +86,9 @@ varchar 8 Unit used for adjusting from the ending event. + + CRM_Core_SelectValues::unitList() + 1.5 Select diff --git a/xml/schema/Member/MembershipType.xml b/xml/schema/Member/MembershipType.xml index 8722b3ed02..d5999cf198 100644 --- a/xml/schema/Member/MembershipType.xml +++ b/xml/schema/Member/MembershipType.xml @@ -109,6 +109,9 @@ varchar 8 Unit in which membership period is expressed. + + CRM_Core_SelectValues::unitList('duration') + 1.5 Select @@ -125,6 +128,9 @@ varchar 8 Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day. + + CRM_Core_SelectValues::periodType() + 1.5 diff --git a/xml/schema/Pledge/Pledge.xml b/xml/schema/Pledge/Pledge.xml index f6e4c6c20d..2d57f03b92 100644 --- a/xml/schema/Pledge/Pledge.xml +++ b/xml/schema/Pledge/Pledge.xml @@ -138,6 +138,10 @@ 8 'month' Time units for recurrence of pledge payments. + + recur_frequency_units + name + 2.1 Select diff --git a/xml/schema/Price/PriceField.xml b/xml/schema/Price/PriceField.xml index 0e8e47b371..6fe1e27dae 100644 --- a/xml/schema/Price/PriceField.xml +++ b/xml/schema/Price/PriceField.xml @@ -65,6 +65,9 @@ varchar 12 true + + CRM_Price_BAO_PriceField::htmlTypes() + 1.8 Select -- 2.25.1