CRM-14181, add callback function, so that enums are accessible via api etc
authorkurund <kurund@civicrm.org>
Thu, 13 Feb 2014 05:53:36 +0000 (21:53 -0800)
committerkurund <kurund@civicrm.org>
Thu, 13 Feb 2014 05:53:36 +0000 (21:53 -0800)
----------------------------------------
* CRM-14181: migrate enums to varchar in schema for all tables
  http://issues.civicrm.org/jira/browse/CRM-14181

12 files changed:
CRM/Core/SelectValues.php
xml/schema/Dedupe/RuleGroup.xml
xml/schema/Event/ParticipantStatusType.xml
xml/schema/Mailing/BounceType.xml
xml/schema/Mailing/Component.xml
xml/schema/Mailing/Mailing.xml
xml/schema/Mailing/MailingGroup.xml
xml/schema/Mailing/MailingJob.xml
xml/schema/Member/MembershipStatus.xml
xml/schema/Member/MembershipType.xml
xml/schema/Pledge/Pledge.xml
xml/schema/Price/PriceField.xml

index 3c1edc26fb5cacdd0a5e49a3b9af322b87c75246..59512601d247e844253aa14edd72813c0983c13d 100644 (file)
@@ -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;
+  }
+
 }
 
index 6ec09dce6730d0d2d0715f8e5f7b724fa80d4e42..90ce856878a1dc7af59c317d7806eb0b9e2ec52f 100644 (file)
     <type>varchar</type>
     <length>12</length>
     <comment>The type of contacts this group applies to</comment>
+    <pseudoconstant>
+      <table>civicrm_contact_type</table>
+      <keyColumn>name</keyColumn>
+      <labelColumn>label</labelColumn>
+      <condition>parent_id IS NULL</condition>
+    </pseudoconstant>
     <add>1.8</add>
     <html>
       <type>Select</type>
@@ -47,6 +53,9 @@
     <length>12</length>
     <required>true</required>
     <comment>Whether the rule should be used for cases where usage is Unsupervised, Supervised OR General(programatically)</comment>
+    <pseudoconstant>
+      <callback>CRM_Core_SelectValues::getDedupeRuleTypes()</callback>
+    </pseudoconstant>
     <add>4.3</add>
     <html>
       <type>Select</type>
index c1449baa80d3868f57e8cc16c8e31d40f3864e7e..0f7c5e4ec282cc14848dd52c57c5d4ce40d32923 100644 (file)
@@ -42,6 +42,9 @@
     <type>varchar</type>
     <length>8</length>
     <comment>the general group of status type this one belongs to</comment>
+    <pseudoconstant>
+      <callback>CRM_Event_PseudoConstant::participantStatusClass()</callback>
+    </pseudoconstant>
     <add>3.0</add>
     <html>
       <type>Select</type>
index 913194885e580639f0a220873c4b5312d0e5fbf1..392cc9169b44850673a9d333c4b8a89266496412 100644 (file)
@@ -20,9 +20,6 @@
         <length>8</length>
         <required>true</required>
         <comment>Type of bounce</comment>
-        <html>
-          <type>Select</type>
-        </html>
     </field>
     <field>
         <name>description</name>
index 63e94a708509b721a60565f30596fe333fc39415..7c7d9348183b5b22d9f0b4bd7d509bd9a671b2c7 100644 (file)
@@ -26,6 +26,9 @@
        <type>varchar</type>
        <length>12</length>
        <comment>Type of Component.</comment>
+       <pseudoconstant>
+         <callback>CRM_Core_SelectValues::mailingComponents()</callback>
+       </pseudoconstant>
        <html>
          <type>Select</type>
        </html>
index 21eead08d7e77ac92caccd5b292457d41ec71369..9ee2ed8748edc8e6ffe95a570cdc690eb1d66678 100644 (file)
        <length>40</length>
        <default>'User and User Admin Only'</default>
        <comment>In what context(s) is the mailing contents visible (online viewing)</comment>
+       <pseudoconstant>
+         <callback>CRM_Core_SelectValues::ufVisibility(true)</callback>
+       </pseudoconstant>
        <add>3.3</add>
        <html>
          <type>Select</type>
index cab52163dcf2aaf8680cf927e2ea7b33ec3a2dc3..b986986abf9ea9aaf147325937baa03232b6fb99 100644 (file)
@@ -32,6 +32,9 @@
        <type>varchar</type>
        <length>8</length>
        <comment>Are the members of the group included or excluded?.</comment>
+       <pseudoconstant>
+         <callback>CRM_Core_SelectValues::getMailingGroupTypes()</callback>
+       </pseudoconstant>
        <html>
          <type>Select</type>
        </html>
index 51dc63ff935465efe97c74495a1dd512b4f9f8e1..e489c517df43b56ac89d15085e7d5c9e8ff0c9ce 100644 (file)
@@ -47,6 +47,9 @@
       <type>varchar</type>
       <length>12</length>
       <comment>The state of this job</comment>
+      <pseudoconstant>
+        <callback>CRM_Core_SelectValues::geMailingJobStatus()</callback>
+      </pseudoconstant>
       <html>
         <type>Select</type>
       </html>
index d214c4ed793943866b2466881cca337b7116df0e..85cc4be608dfa0d09113f7882d281cfd469fdd75 100644 (file)
@@ -41,6 +41,9 @@
        <type>varchar</type>
        <length>12</length>
        <comment>Event when this status starts.</comment>
+       <pseudoconstant>
+         <callback>CRM_Core_SelectValues::eventDate()</callback>
+       </pseudoconstant>
        <add>1.5</add>
        <html>
          <type>Select</type>
@@ -51,6 +54,9 @@
       <type>varchar</type>
       <length>8</length>
       <comment>Unit used for adjusting from start_event.</comment>
+      <pseudoconstant>
+        <callback>CRM_Core_SelectValues::unitList()</callback>
+      </pseudoconstant>
       <add>1.5</add>
       <html>
         <type>Select</type>
@@ -67,6 +73,9 @@
       <type>varchar</type>
       <length>12</length>
       <comment>Event after which this status ends.</comment>
+      <pseudoconstant>
+        <callback>CRM_Core_SelectValues::eventDate()</callback>
+      </pseudoconstant>
       <add>1.5</add>
       <html>
         <type>Select</type>
@@ -77,6 +86,9 @@
       <type>varchar</type>
       <length>8</length>
       <comment>Unit used for adjusting from the ending event.</comment>
+      <pseudoconstant>
+        <callback>CRM_Core_SelectValues::unitList()</callback>
+      </pseudoconstant>
       <add>1.5</add>
       <html>
         <type>Select</type>
index 8722b3ed02d91648d688322f09845fd50f557e54..d5999cf198f07063e4dbec6cfd0f44d0fdfd80aa 100644 (file)
     <type>varchar</type>
     <length>8</length>
     <comment>Unit in which membership period is expressed.</comment>
+    <pseudoconstant>
+      <callback>CRM_Core_SelectValues::unitList('duration')</callback>
+    </pseudoconstant>
     <add>1.5</add>
     <html>
       <type>Select</type>
     <type>varchar</type>
     <length>8</length>
     <comment>Rolling membership period starts on signup date. Fixed membership periods start on fixed_period_start_day.</comment>
+    <pseudoconstant>
+      <callback>CRM_Core_SelectValues::periodType()</callback>
+    </pseudoconstant>
     <add>1.5</add>
   </field>
   <field>
index f6e4c6c20de54b3352a47e7b98919c404f21677e..2d57f03b920e5ede6d2d2a044609bbddb82f1bad 100644 (file)
     <length>8</length>
     <default>'month'</default>
     <comment>Time units for recurrence of pledge payments.</comment>
+    <pseudoconstant>
+      <optionGroupName>recur_frequency_units</optionGroupName>
+      <keyColumn>name</keyColumn>
+    </pseudoconstant>
     <add>2.1</add>
     <html>
       <type>Select</type>
index 0e8e47b371768d759c353e1f5bf3f57247c61f24..6fe1e27dae7e4708f954053e0b1f8535de1adf92 100644 (file)
@@ -65,6 +65,9 @@
       <type>varchar</type>
       <length>12</length>
       <required>true</required>
+      <pseudoconstant>
+        <callback>CRM_Price_BAO_PriceField::htmlTypes()</callback>
+      </pseudoconstant>
       <add>1.8</add>
       <html>
         <type>Select</type>