Refactored out of CRM_Core_PseudoConstant: websiteType(), fromEmailAddress(), honorTy...
authorAllen Shaw <allen@emphanos.com>
Wed, 1 May 2013 05:45:18 +0000 (22:45 -0700)
committerColeman Watts <coleman@civicrm.org>
Thu, 30 May 2013 05:11:08 +0000 (22:11 -0700)
----------------------------------------
* CRM-12464: Search improvements in 4.4
  http://issues.civicrm.org/jira/browse/CRM-12464

----------------------------------------
* CRM-12464:
  http://issues.civicrm.org/jira/browse/CRM-12464
* CRM-12464::
  http://issues.civicrm.org/jira/browse/CRM-12464:

44 files changed:
CRM/Activity/BAO/Activity.php
CRM/Activity/Form/Activity.php
CRM/Admin/Form/MailSettings.php
CRM/Admin/Form/Mapping.php
CRM/Admin/Form/Preferences/Display.php
CRM/Admin/Page/MailSettings.php
CRM/Case/BAO/Case.php
CRM/Contact/BAO/Query.php
CRM/Contact/Form/Edit/Website.php
CRM/Contact/Form/Task/EmailCommon.php
CRM/Contact/Import/Form/MapField.php
CRM/Contact/Import/ImportJob.php
CRM/Contact/Page/Inline/Website.php
CRM/Contact/Selector.php
CRM/Contribute/BAO/Contribution.php
CRM/Contribute/Form/AdditionalInfo.php
CRM/Contribute/Form/Contribution.php
CRM/Contribute/Form/Contribution/Confirm.php
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/Contribution/ThankYou.php
CRM/Contribute/Form/ContributionView.php
CRM/Core/BAO/UFGroup.php
CRM/Core/Form.php
CRM/Core/Page/Basic.php
CRM/Core/PseudoConstant.php
CRM/Logging/Differ.php
CRM/Mailing/Form/Upload.php
CRM/Mailing/MailStore.php
CRM/Member/Form/Membership.php
CRM/Member/Form/MembershipRenewal.php
CRM/Pledge/BAO/Pledge.php
CRM/Pledge/Form/Pledge.php
CRM/Pledge/Form/PledgeView.php
CRM/Profile/Selector/Listings.php
CRM/Report/Form/ActivitySummary.php
api/v3/Contact.php
tests/phpunit/CRM/Core/PseudoConstantTest.php
xml/schema/Activity/Activity.xml
xml/schema/Contribute/Contribution.xml
xml/schema/Core/MailSettings.xml
xml/schema/Core/Mapping.xml
xml/schema/Core/MappingField.xml
xml/schema/Core/Website.xml
xml/schema/Pledge/Pledge.xml

index dd54cfc8bb0f28f46c40964ec2bc1f57442720a5..5c0c0a15c3a4e57a61dba3b4bb2b5ca06ac35a57 100644 (file)
@@ -309,7 +309,7 @@ class CRM_Activity_BAO_Activity extends CRM_Activity_DAO_Activity {
       // if not set and not 0
       !CRM_Utils_Array::value('id', $params)
     ) {
-      $priority = CRM_Core_PseudoConstant::priority();
+      $priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id');
       $params['priority_id'] = array_search('Normal', $priority);
     }
 
index f921a08c80d48f9d905934239c1910d6debef973..05f805d8f872245bf81568189f49c2dbceab5f0c 100644 (file)
@@ -168,7 +168,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
         'type' => 'select',
         'label' => ts('Priority'),
         'attributes' =>
-        CRM_Core_PseudoConstant::priority(),
+        CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'),
         'required' => TRUE
       ),
       'source_contact_id' => array(
@@ -597,7 +597,7 @@ class CRM_Activity_Form_Activity extends CRM_Contact_Form_Task {
       );
     }
     if (!CRM_Utils_Array::value('priority_id', $defaults)) {
-      $priority = CRM_Core_PseudoConstant::priority();
+      $priority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id');
       $defaults['priority_id'] = array_search('Normal', $priority);
     }
     if (!CRM_Utils_Array::value('status_id', $defaults)) {
index 3973a96c0dbe039ce4bbf7435a623a35958d05e8..992a209df4a17c975a2115e07b580872692640d1 100644 (file)
@@ -70,7 +70,7 @@ class CRM_Admin_Form_MailSettings extends CRM_Admin_Form {
 
     $this->add('select', 'protocol',
       ts('Protocol'),
-      array('' => ts('- select -')) + CRM_Core_PseudoConstant::mailProtocol(),
+      array('' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol'),
       TRUE
     );
 
index 9fe11f20e52db8acc933d24b6ae4e7f342dabe4e..63ea130bccb9e26b71db40dbf8cc6da3eaf1736a 100644 (file)
@@ -70,7 +70,7 @@ class CRM_Admin_Form_Mapping extends CRM_Admin_Form {
         CRM_Core_DAO::getAttribute('CRM_Core_DAO_Mapping', 'description')
       );
 
-      $mappingType = $this->addElement('select', 'mapping_type_id', ts('Mapping Type'), CRM_Core_PseudoConstant::mappingTypes());
+      $mappingType = $this->addElement('select', 'mapping_type_id', ts('Mapping Type'), CRM_Core_PseudoConstant::get('CRM_Core_DAO_Mapping', 'mapping_type_id'));
 
       if ($this->_action == CRM_Core_Action::UPDATE) {
         $mappingType->freeze();
index bc0962cf54658cb6d947db601a20d71e6d7c9391..d92dbc41b9cdad552b69d0939d0004106f820da0 100644 (file)
@@ -147,7 +147,7 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
    * @access public
    */
   public function buildQuickForm() {
-    $wysiwyg_options = array('' => ts('Textarea')) + CRM_Core_PseudoConstant::wysiwygEditor();
+    $wysiwyg_options = array('' => ts('Textarea')) + CRM_Core_OptionGroup::values('wysiwyg_editor');
 
     $config = CRM_Core_Config::singleton();
     $extra = array();
index 2a9c0e674c417f036f48034175cb7b9e73bec19e..ed38e1bb8bfc8e534a1d4b319ccbf5cfbbdff23e 100644 (file)
@@ -94,7 +94,7 @@ class CRM_Admin_Page_MailSettings extends CRM_Core_Page_Basic {
     $allMailSettings = array();
     $mailSetting = new CRM_Core_DAO_MailSettings();
 
-    $allProtocols = CRM_Core_PseudoConstant::mailProtocol();
+    $allProtocols = CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol');
 
     //multi-domain support for mail settings. CRM-5244
     $mailSetting->domain_id = CRM_Core_Config::domainID();
index c72877bc1a0b0375b0d720430c92ad97bf7219bb..9bdad9ac6202e93efc59f44be199e183ae57cfff 100644 (file)
@@ -1104,7 +1104,7 @@ SELECT case_status.label AS case_status, status_id, case_type.label AS case_type
 
     $activityTypes    = CRM_Case_PseudoConstant::caseActivityType(FALSE, TRUE);
     $activityStatus   = CRM_Core_PseudoConstant::activityStatus();
-    $activityPriority = CRM_Core_PseudoConstant::priority();
+    $activityPriority = CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id');
 
     $url = CRM_Utils_System::url("civicrm/case/activity",
       "reset=1&cid={$contactID}&caseid={$caseID}", FALSE, NULL, FALSE
index b6a222050fb884b35eb1186f82c538ef706ba822..b3bf07c144401d418aabdbfd82bfe66520a56c66 100644 (file)
@@ -3077,8 +3077,8 @@ WHERE  id IN ( $groupIDs )
    */
   function phone_option_group($values) {
     list($name, $op, $value, $grouping, $wildcard) = $values;
-    $option = $name == 'phone_phone_type_id' ? 'phoneType' : 'locationType';
-    $options = CRM_Core_PseudoConstant::$option();
+    $option = ($name == 'phone_phone_type_id' ? 'phone_type_id' : 'location_type_id');
+    $options = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', $option);
     $optionName = $options[$value];
     $this->_qill[$grouping][] = ts('Phone') . ' ' . ($name == 'phone_phone_type_id' ? ts('type') : ('location')) . " $op $optionName";
     $this->_where[$grouping][] = self::buildClause('civicrm_phone.' . substr($name, 6), $op, $value, 'Integer');
index a2c4de4d81c224f4ddb617e3bc91d506fc2e1eca..22bc9618a9254377f85dadad79bdcbb14de8c604 100644 (file)
@@ -59,7 +59,7 @@ class CRM_Contact_Form_Edit_Website {
     $form->applyFilter('__ALL__', 'trim');
 
     //Website type select
-    $form->addElement('select', "website[$blockId][website_type_id]", '', CRM_Core_PseudoConstant::websiteType());
+    $form->addElement('select', "website[$blockId][website_type_id]", '', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'));
 
     //Website box
     $form->addElement('text', "website[$blockId][url]", ts('Website'),
index 2694d6a8ddedd6e43daea5dd1df02039e8a1d2f4..06337bbc6ed01bf47334fe0e905e468b142dc181 100644 (file)
@@ -105,7 +105,7 @@ class CRM_Contact_Form_Task_EmailCommon {
 
     // now add domain from addresses
     $domainEmails = array();
-    $domainFrom = CRM_Core_PseudoConstant::fromEmailAddress();
+    $domainFrom = CRM_Core_OptionGroup::values('from_email_address');
     foreach (array_keys($domainFrom) as $k) {
       $domainEmail = $domainFrom[$k];
       $domainEmails[$domainEmail] = htmlspecialchars($domainEmail);
index aecbe5aeb8a9b707e5e089bba6b5bb37b97ece44..31591528d98983c88038ea7513998128a7eb37c8 100644 (file)
@@ -355,7 +355,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Core_Form {
 
     $phoneTypes   = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
     $imProviders  = CRM_Core_PseudoConstant::IMProvider();
-    $websiteTypes = CRM_Core_PseudoConstant::websiteType();
+    $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
 
     foreach ($this->_location_types as $key => $value) {
       $sel3['phone'][$key] = &$phoneTypes;
@@ -763,7 +763,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Core_Form {
 
     $phoneTypes    = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
     $imProviders   = CRM_Core_PseudoConstant::IMProvider();
-    $websiteTypes  = CRM_Core_PseudoConstant::websiteType();
+    $websiteTypes  = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
     $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
 
     //these mapper params need to set key as array and val as null.
index a09a2fdb9d141bde0bdc3f5fc34ef4d85104802b..2007de91d1cc323641aa7e368103aa5a05caea3c 100644 (file)
@@ -146,7 +146,7 @@ class CRM_Contact_Import_ImportJob {
     $mapperFields  = array();
     $phoneTypes    = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
     $imProviders   = CRM_Core_PseudoConstant::IMProvider();
-    $websiteTypes  = CRM_Core_PseudoConstant::websiteType();
+    $websiteTypes  = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
     $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
 
     //initialize mapper perperty value.
index 4a48c3b618889f26cdc1d45ddcd3aad632eb49eb..ab4a2a29ad98b6b895f096d143bbc28079185292 100644 (file)
@@ -52,7 +52,7 @@ class CRM_Contact_Page_Inline_Website extends CRM_Core_Page {
     // get the emails for this contact
     $contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
 
-    $websiteTypes = CRM_Core_PseudoConstant::websiteType();
+    $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
 
     $params   = array('contact_id' => $contactId);
     $websites = CRM_Core_BAO_Website::getValues($params, CRM_Core_DAO::$_nullArray);
index 78c891e1e51c2703a810caa7d53e720e13eb5f70..734f31ce7c2867fadb70ad737254e89dabced2d7 100644 (file)
@@ -665,7 +665,7 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
           $propertyArray = explode('-', $property);
           $websiteFld = $websiteKey . '-' . array_pop($propertyArray);
           if (!empty($result->$websiteFld)) {
-            $websiteTypes = CRM_Core_PseudoConstant::websiteType();
+            $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
             $websiteType  = $websiteTypes[$result->{"$websiteKey-website_type_id"}];
             $websiteValue = $result->$websiteFld;
             $websiteUrl   = "<a href=\"{$websiteValue}\">{$websiteValue}  ({$websiteType})</a>";
index 0103ce58d6b9ef851e62ceb5a744571755aaf496..6f866190e4a0d91bc66dc1db0e0f89ad85129e06 100644 (file)
@@ -2255,7 +2255,7 @@ WHERE  contribution_id = %1 ";
       $honorIds['contribution'] = $this->id;
       $idParams = array('id' => $honorID, 'contact_id' => $honorID);
       CRM_Contact_BAO_Contact::retrieve($idParams, $honorDefault, $honorIds);
-      $honorType = CRM_Core_PseudoConstant::honor();
+      $honorType = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
 
       $template->assign('honor_block_is_active', 1);
       if (CRM_Utils_Array::value('prefix_id', $honorDefault)) {
index af123b1e1c17c8498e0cdcfbac8b94ade780845b..b01b24328609ff944cad1ab38358fc521f202010 100644 (file)
@@ -164,7 +164,7 @@ class CRM_Contribute_Form_AdditionalInfo {
   static function buildHonoree(&$form) {
     //Honoree section
     $form->add('hidden', 'hidden_Honoree', 1);
-    $honor = CRM_Core_PseudoConstant::honor();
+    $honor = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
     $extraOption = array('onclick' => "return enableHonorType();");
     foreach ($honor as $key => $var) {
       $honorTypes[$key] = $form->createElement('radio', NULL, NULL, $var, $key, $extraOption);
@@ -363,7 +363,7 @@ class CRM_Contribute_Form_AdditionalInfo {
     // retrieve individual prefix value for honoree
     if (CRM_Utils_Array::value('hidden_Honoree', $params)) {
       $individualPrefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
-      $honor = CRM_Core_PseudoConstant::honor();
+      $honor = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
       $params['honor_prefix'] = CRM_Utils_Array::value(CRM_Utils_Array::value('honor_prefix_id',
           $params
         ),
index 195539a29e8dd894c824d52ebddb23be5e1a5b1d..38152e65f3161c4f94e41aced0fc00af2d73ad3f 100644 (file)
@@ -380,7 +380,7 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP
     if (isset($defaults['honor_contact_id'])) {
       $honorDefault = $ids = array();
       $this->_honorID = $defaults['honor_contact_id'];
-      $honorType = CRM_Core_PseudoConstant::honor();
+      $honorType = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
       $idParams = array(
         'id' => $defaults['honor_contact_id'],
         'contact_id' => $defaults['honor_contact_id'],
index 19e83fc3566c7c9f22bdfcacd77e36131c6da74e..dd751378f19d8c4e7fed76559e20709bbfbc3385 100644 (file)
@@ -388,7 +388,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
       $this->assign('honor_block_title', CRM_Utils_Array::value('honor_block_title', $this->_values));
 
       $prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
-      $honor = CRM_Core_PseudoConstant::honor();
+      $honor = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
       $this->assign('honor_type', CRM_Utils_Array::value($params['honor_type_id'], $honor));
       $this->assign('honor_prefix', CRM_Utils_Array::value($params['honor_prefix_id'], $prefix));
       $this->assign('honor_first_name', $params['honor_first_name']);
@@ -1573,7 +1573,7 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr
     $this->assign('honor_block_title', CRM_Utils_Array::value('honor_block_title', $this->_values));
 
     $prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
-    $honorType = CRM_Core_PseudoConstant::honor();
+    $honorType = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
     $this->assign('honor_type', CRM_Utils_Array::value(CRM_Utils_Array::value('honor_type_id', $params), $honorType));
     $this->assign('honor_prefix', CRM_Utils_Array::value(CRM_Utils_Array::value('honor_prefix_id', $params), $prefix));
     $this->assign('honor_first_name', CRM_Utils_Array::value('honor_first_name', $params));
index 83a293fe1997a7951c635a175d39b7fd119314f7..35d53b77f7fb47b7968934f07a414212cb7a235c 100644 (file)
@@ -599,7 +599,7 @@ class CRM_Contribute_Form_Contribution_Main extends CRM_Contribute_Form_Contribu
     $extraOption = array('onclick' => "enableHonorType();");
     // radio button for Honor Type
     $honorOptions = array();
-    $honor = CRM_Core_PseudoConstant::honor();
+    $honor = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
     foreach ($honor as $key => $var) {
       $honorTypes[$key] = $this->createElement('radio', NULL, NULL, $var, $key, $extraOption);
     }
index 392d065f7abcff7ac8bc22622a0d0e0036a71b94..ae70d52a4cc34f80b8604f4d7cf8c9927749c558 100644 (file)
@@ -129,7 +129,7 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont
       $this->assign('honor_block_title', CRM_Utils_Array::value('honor_block_title', $this->_values));
 
       $prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
-      $honor = CRM_Core_PseudoConstant::honor();
+      $honor = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
       $this->assign('honor_type', $honor[$params["honor_type_id"]]);
       $this->assign('honor_prefix', ($params["honor_prefix_id"]) ? $prefix[$params["honor_prefix_id"]] : ' ');
       $this->assign('honor_first_name', $params["honor_first_name"]);
index be1fe301b6c5c8886e5dfb950e89b05bfe69a001..f1fb3d234008565fde76278315f43feb110a9b29 100644 (file)
@@ -78,7 +78,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form {
         $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid=$values[honor_contact_id]");
         $values['honor_display'] = "<A href = $url>" . $dao->display_name . "</A>";
       }
-      $honor = CRM_Core_PseudoConstant::honor();
+      $honor = CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id');
       $values['honor_type'] = CRM_Utils_Array::value(CRM_Utils_Array::value('honor_type_id', $values), $honor);
     }
 
index acbeff7fc660bd6ed596441ab47ca3a345128bac..2c03cd1b37cbe84e3c034aa0959d269faee0dc13 100644 (file)
@@ -915,7 +915,7 @@ class CRM_Core_BAO_UFGroup extends CRM_Core_DAO_UFGroup {
 
     $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
     $imProviders   = CRM_Core_PseudoConstant::IMProvider();
-    $websiteTypes  = CRM_Core_PseudoConstant::websiteType();
+    $websiteTypes  = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
 
     $multipleFields = array('url');
     $nullIndex = $nullValueIndex = ' ';
@@ -1974,10 +1974,10 @@ AND    ( entity_id IS NULL OR entity_id <= 0 )
         if (substr($name, -1) == ']') {
           $websiteTypeName = substr($name, 0, -1) . '-website_type_id]';
         }
-        $form->addElement('select', $websiteTypeName, NULL, CRM_Core_PseudoConstant::websiteType());
+        $form->addElement('select', $websiteTypeName, NULL, CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'));
       }
       else {
-        $form->addElement('select', $name . '-website_type_id', NULL, CRM_Core_PseudoConstant::websiteType());
+        $form->addElement('select', $name . '-website_type_id', NULL, CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'));
       }
     }
     // Note should be rendered as textarea
index 649c3464a25aacde8afc072a790efa7e56937da4..a8b81dbc86b96009d926d66da958613bb86fa7a2 100644 (file)
@@ -870,7 +870,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
       'editor_id'
     );
     $editor = strtolower(CRM_Utils_Array::value($editorID,
-        CRM_Core_PseudoConstant::wysiwygEditor()
+        CRM_Core_OptionGroup::values('wysiwyg_editor')
       ));
     if (!$editor || $forceTextarea) {
       $editor = 'textarea';
index 3c7a441f8c85725f95c2aff5176d8c49d364e963..c55c368829f9d4dd9657150f2f8b7f79e9376ec6 100644 (file)
@@ -263,7 +263,7 @@ abstract class CRM_Core_Page_Basic extends CRM_Core_Page {
           $this->action($object, $action, $values[$object->id], $links, $permission);
 
           if (isset($object->mapping_type_id)) {
-            $mappintTypes = CRM_Core_PseudoConstant::mappingTypes();
+            $mappintTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Mapping', 'mapping_type_id');
             $values[$object->id]['mapping_type'] = $mappintTypes[$object->mapping_type_id];
           }
         }
index 0ae97ec3ecd607d93e6586cc228b17aa59bf2681..f4a8e4bf257d563cbc8c34478f8202318b8fb87b 100644 (file)
@@ -98,20 +98,6 @@ class CRM_Core_PseudoConstant {
    */
   private static $imProvider;
 
-  /**
-   * website protocols
-   * @var array
-   * @static
-   */
-  private static $websiteType;
-
-  /**
-   * im protocols
-   * @var array
-   * @static
-   */
-  private static $fromEmailAddress;
-
   /**
    * states, provinces
    * @var array
@@ -238,13 +224,6 @@ class CRM_Core_PseudoConstant {
    */
   private static $worldRegions;
 
-  /**
-   * honorType
-   * @var array
-   * @static
-   */
-  private static $honorType;
-
   /**
    * activity status
    * @var array
@@ -252,27 +231,6 @@ class CRM_Core_PseudoConstant {
    */
   private static $activityStatus;
 
-  /**
-   * priority
-   * @var array
-   * @static
-   */
-  private static $priority;
-
-  /**
-   * wysiwyg Editor
-   * @var array
-   * @static
-   */
-  private static $wysiwygEditor;
-
-  /**
-   * Mapping Types
-   * @var array
-   * @static
-   */
-  private static $mappingType;
-
   /**
    * Visibility
    * @var array
@@ -280,13 +238,6 @@ class CRM_Core_PseudoConstant {
    */
   private static $visibility;
 
-  /**
-   * Mail Protocols
-   * @var array
-   * @static
-   */
-  private static $mailProtocol;
-
   /**
    * Greetings
    * @var array
@@ -736,71 +687,7 @@ class CRM_Core_PseudoConstant {
     }
     return self::$imProvider;
   }
-
-  /**
-   * Get all the website types from database.
-   *
-   * The static array websiteType is returned, and if it's
-   * called the first time, the <b>Website DAO</b> is used
-   * to get all the Website Types.
-   *
-   * Note: any database errors will be trapped by the DAO.
-   *
-   * @access public
-   * @static
-   *
-   * @return array - array reference of all Website types.
-   *
-   */
-  public static function &websiteType() {
-    if (!self::$websiteType) {
-      self::$websiteType = CRM_Core_OptionGroup::values('website_type');
-    }
-    return self::$websiteType;
-  }
-
-  /**
-   * Get the all From Email Address from database.
-   *
-   * The static array $fromEmailAddress is returned, and if it's
-   * called the first time, DAO is used
-   * to get all the From Email Address
-   *
-   * Note: any database errors will be trapped by the DAO.
-   *
-   * @access public
-   * @static
-   *
-   * @return array - array reference of all From Email Address.
-   */
-  public static function &fromEmailAddress() {
-    if (!self::$fromEmailAddress) {
-      self::$fromEmailAddress = CRM_Core_OptionGroup::values('from_email_address');
-    }
-    return self::$fromEmailAddress;
-  }
-
-  /**
-   * Get the all Mail Protocols from database.
-   *
-   * The static array mailProtocol is returned, and if it's
-   * called the first time, the DAO is used
-   * to get all the Mail Protocol.
-   *
-   * Note: any database errors will be trapped by the DAO.
-   *
-   * @access public
-   * @static
-   *
-   * @return array - array reference of all Mail Protocols.
-   */
-  public static function &mailProtocol() {
-    if (!self::$mailProtocol) {
-      self::$mailProtocol = CRM_Core_OptionGroup::values('mail_protocol');
-    }
-    return self::$mailProtocol;
-  }
-
   /**
    * Get all the State/Province from database.
    *
@@ -1687,26 +1574,6 @@ WHERE  id = %1";
     return self::$worldRegions;
   }
 
-  /**
-   * Get all Honor Type.
-   *
-   * The static array honorType is returned
-   *
-   * @access public
-   * @static
-   *
-   * @param boolean $all - get All Honor Type.
-   *
-   * @return array - array reference of all Honor Types.
-   *
-   */
-  public static function &honor() {
-    if (!self::$honorType) {
-      self::$honorType = CRM_Core_OptionGroup::values('honor_type');
-    }
-    return self::$honorType;
-  }
-
   /**
    * Get all Activity Statuses.
    *
@@ -1730,41 +1597,6 @@ WHERE  id = %1";
     return self::$activityStatus[$column];
   }
 
-  /**
-   * Get all Priorities
-   *
-   * The static array Priority is returned
-   *
-   * @access public
-   * @static
-   *
-   * @return array - array reference of all Priority
-   */
-  public static function &priority() {
-    if (!self::$priority) {
-      self::$priority = CRM_Core_OptionGroup::values('priority');
-    }
-
-    return self::$priority;
-  }
-
-  /**
-   * Get all WYSIWYG Editors.
-   *
-   * The static array wysiwygEditor is returned
-   *
-   * @access public
-   * @static
-   *
-   * @return array - array reference of all wysiwygEditors
-   */
-  public static function &wysiwygEditor() {
-    if (!self::$wysiwygEditor) {
-      self::$wysiwygEditor = CRM_Core_OptionGroup::values('wysiwyg_editor');
-    }
-    return self::$wysiwygEditor;
-  }
-
   /**
    * Get all Visibility levels.
    *
@@ -1788,20 +1620,6 @@ WHERE  id = %1";
     return self::$visibility[$column];
   }
 
-  /**
-   * Get all mapping types
-   *
-   * @return array - array reference of all mapping types
-   * @access public
-   * @static
-   */
-  public static function &mappingTypes() {
-    if (!self::$mappingType) {
-      self::$mappingType = CRM_Core_OptionGroup::values('mapping_type');
-    }
-    return self::$mappingType;
-  }
-
   public static function &stateProvinceForCountry($countryID, $field = 'name') {
     static $_cache = NULL;
 
index 61b8dbef14195e2b58df3dab51125e141a82150e..a9ba451f9dff13169757234ed0f3588d7b63244b 100644 (file)
@@ -244,10 +244,10 @@ WHERE log_conn_id = %1 AND
           'provider_id' => CRM_Core_PseudoConstant::IMProvider(),
           'state_province_id' => CRM_Core_PseudoConstant::stateProvince(),
           'suffix_id' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'),
-          'website_type_id' => CRM_Core_PseudoConstant::websiteType(),
+          'website_type_id' => CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id'),
           'activity_type_id' => CRM_Core_PseudoConstant::activityType(TRUE, TRUE, FALSE, 'label', TRUE),
           'case_type_id' => CRM_Case_PseudoConstant::caseType('label', FALSE),
-          'priority_id'  => CRM_Core_PseudoConstant::priority(),
+          'priority_id'  => CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'),
         );
 
         // for columns that appear in more than 1 table
index 1fd093c26c181c6d565e98277353d1fd34a510fb..98f02584459982345c3fada08633c308d142ed19 100644 (file)
@@ -214,7 +214,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
       "CRM_Mailing_Controller_Send_{$this->controller->_key}"
     );
 
-    $fromEmailAddress = CRM_Core_PseudoConstant::fromEmailAddress('from_email_address');
+    $fromEmailAddress = CRM_Core_OptionGroup::values('from_email_address');
     if (empty($fromEmailAddress)) {
       //redirect user to enter from email address.
       $url = CRM_Utils_System::url('civicrm/admin/options/from_email_address', 'group=from_email_address&action=add&reset=1');
@@ -430,7 +430,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
 
     //handle mailing from name & address.
     $fromEmailAddress = CRM_Utils_Array::value($formValues['from_email_address'],
-      CRM_Core_PseudoConstant::fromEmailAddress('from_email_address')
+      CRM_Core_OptionGroup::values('from_email_address')
     );
 
     //get the from email address
@@ -441,7 +441,7 @@ class CRM_Mailing_Form_Upload extends CRM_Core_Form {
 
     //Add Reply-To to headers
     if (CRM_Utils_Array::value('reply_to_address', $formValues)) {
-      $replyToEmail = CRM_Core_PseudoConstant::fromEmailAddress('from_email_address');
+      $replyToEmail = CRM_Core_OptionGroup::values('from_email_address');
       $params['replyto_email'] = CRM_Utils_Array::value($formValues['reply_to_address'], $replyToEmail);
     }
 
index bc8ce2e59c62e4de09aadefb196664b01244742b..ee9e8dd5fac24111f5d9033fced094550aa9b252 100644 (file)
@@ -51,7 +51,7 @@ class CRM_Mailing_MailStore {
       throw new Exception("Could not find entry named $name in civicrm_mail_settings");
     }
 
-    $protocols = CRM_Core_PseudoConstant::mailProtocol();
+    $protocols = CRM_Core_PseudoConstant::get('CRM_Core_DAO_MailSettings', 'protocol');
 
     switch ($protocols[$dao->protocol]) {
       case 'IMAP':
index da4e4ad680ef44382f127e6507e71fc1af24c77f..d790bece257dd18fe0e84e4cf8b45e923b955786 100644 (file)
@@ -766,7 +766,7 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
       // causes a conflict in standalone mode so skip in standalone for now
       $this->addElement('checkbox', 'is_different_contribution_contact', ts('Record Payment from a Different Contact?'));
       $this->add( 'select', 'honor_type_id', ts('Membership payment is : '),
-                        array( '' => ts( '-') ) + CRM_Core_PseudoConstant::honor() );
+                        array( '' => ts( '-') ) + CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id') );
       CRM_Contact_Form_NewContact::buildQuickForm($this,1, null, false,'contribution_');
     }
 
index 0733b03dee9be0f4f4545397425249229cbb5731..f1649a091db857fa4e1d627032037cc37a13e821 100644 (file)
@@ -500,7 +500,7 @@ WHERE   id IN ( ' . implode(' , ', array_keys($membershipType)) . ' )';
       // causes a conflict in standalone mode so skip in standalone for now
       $this->addElement('checkbox', 'contribution_contact', ts('Record Payment from a Different Contact?'));
       $this->add( 'select', 'honor_type_id', ts('Membership payment is : '),
-        array( '' => ts( '-') ) + CRM_Core_PseudoConstant::honor() );
+        array( '' => ts( '-') ) + CRM_Core_PseudoConstant::get('CRM_Contribute_DAO_Contribution', 'honor_type_id') );
       require_once 'CRM/Contact/Form/NewContact.php';
       CRM_Contact_Form_NewContact::buildQuickForm($this,1, null, false,'contribution_');
   }
index 565066442070858dde61896334497b03da0ee8c6..5f88e13255dd906826ae36400ec9e3ac165c02f8 100644 (file)
@@ -548,7 +548,7 @@ GROUP BY  currency
     ) {
       $honor_block_is_active = TRUE;
       $prefix = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id');
-      $honor = CRM_Core_PseudoConstant::honor();
+      $honor = CRM_Core_PseudoConstant::get('CRM_Pledge_DAO_Pledge', 'honor_type_id');
       $form->assign('honor_type', $honor[$params['honor_type_id']]);
       $form->assign('honor_prefix', $prefix[$params['honor_prefix_id']]);
       $form->assign('honor_first_name', $params['honor_first_name']);
index fa154f95eb6aba331d48c7ab85ad6baa5615989f..6cb55a661e41967e90a4c6c12d754156473a7328 100644 (file)
@@ -257,7 +257,7 @@ class CRM_Pledge_Form_Pledge extends CRM_Core_Form {
       $honorDefault = array();
       $idParams = array('contact_id' => $this->_honorID);
       CRM_Contact_BAO_Contact::retrieve($idParams, $honorDefault);
-      $honorType = CRM_Core_PseudoConstant::honor();
+      $honorType = CRM_Core_PseudoConstant::get('CRM_Pledge_DAO_Pledge', 'honor_type_id');
       $defaults['honor_prefix_id'] = $honorDefault['prefix_id'];
       $defaults['honor_first_name'] = CRM_Utils_Array::value('first_name', $honorDefault);
       $defaults['honor_last_name'] = CRM_Utils_Array::value('last_name', $honorDefault);
index 617a89e981dfe961ebf6e52c25497fd4d17421e4..715725227bc4707d5515ec61659b7ec60ba905ff 100644 (file)
@@ -64,7 +64,7 @@ class CRM_Pledge_Form_PledgeView extends CRM_Core_Form {
         $url = CRM_Utils_System::url('civicrm/contact/view', "reset=1&cid=$values[honor_contact_id]");
         $values["honor_display"] = "<A href = $url>" . $dao->display_name . "</A>";
       }
-      $honor = CRM_Core_PseudoConstant::honor();
+      $honor = CRM_Core_PseudoConstant::get('CRM_Pledge_DAO_Pledge', 'honor_type_id');
       $values['honor_type'] = $honor[$values['honor_type_id']];
     }
 
index 43cded7c3ca84664b07dab54225684d977112ce0..1b469d2cec0408dee5eff2a937a25a9055a22a5a 100644 (file)
@@ -569,7 +569,7 @@ class CRM_Profile_Selector_Listings extends CRM_Core_Selector_Base implements CR
     $showProfileOverlay = CRM_Core_BAO_UFGroup::showOverlayProfile();
 
     $imProviders  = CRM_Core_PseudoConstant::IMProvider();
-    $websiteTypes = CRM_Core_PseudoConstant::websiteType();
+    $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
     $languages    = CRM_Core_PseudoConstant::languages();
     while ($result->fetch()) {
       if (isset($result->country)) {
index e176003aacd877f2b6e9199de9e76b00f3752c45..c7dadeb5ec09f004b576d6a683396231d5190d44 100644 (file)
@@ -149,7 +149,7 @@ class CRM_Report_Form_ActivitySummary extends CRM_Report_Form {
           'priority_id' =>
           array('title' => ts('Priority'),
             'operatorType' => CRM_Report_Form::OP_MULTISELECT,
-            'options' => CRM_Core_PseudoConstant::priority(),
+            'options' => CRM_Core_PseudoConstant::get('CRM_Activity_DAO_Activity', 'priority_id'),
           ),
         ),
         'group_bys' =>
index 48fd7301de048a998c97e2101579df2803d1d1e3..44e3e1b1ae141a5e4b9f7ad967d4b819e17cfa58 100644 (file)
@@ -78,7 +78,7 @@ function civicrm_api3_contact_create($params) {
   }
 
   if (!empty($params['home_url'])) {
-    $websiteTypes = CRM_Core_PseudoConstant::websiteType();
+    $websiteTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Website', 'website_type_id');
     $params['website'] = array(1 => array('website_type_id' => key($websiteTypes),
         'url' => $params['home_url'],
       ),
index 0389fee30c153f67093c3514b03e83b2adde7cbe..feb295d87a079a6f230d44c38b0bcebad00cb308 100644 (file)
@@ -50,6 +50,55 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
     // - sample: Any one value which is expected in the list of option values.
     // - max: integer (default = 10) maximum number of option values expected.
     $fields = array(
+      'CRM_Project_DAO_Task' => array(
+        array(
+          'fieldName' => 'priority_id',
+          'sample' => 'Urgent',
+        ),
+      ),
+      'CRM_Activity_DAO_Activity' => array(
+        array(
+          'fieldName' => 'priority_id',
+          'sample' => 'Urgent',
+        ),
+      ),
+      'CRM_Core_DAO_MailSettings' => array(
+        array(
+          'fieldName' => 'protocol',
+          'sample' => 'Localdir',
+        ),
+      ),
+      'CRM_Core_DAO_Mapping' => array(
+        array(
+          'fieldName' => 'mapping_type_id',
+          'sample' => 'Search Builder',
+          'max' => 15,
+        ),
+      ),
+      'CRM_Pledge_DAO_Pledge' => array(
+        array(
+          'fieldName' => 'honor_type_id',
+          'sample' => 'In Honor of',
+        ),
+      ),
+      'CRM_Contribute_DAO_Contribution' => array(
+        array(
+          'fieldName' => 'honor_type_id',
+          'sample' => 'In Honor of',
+        ),
+      ),
+      'CRM_Core_DAO_Website' => array(
+        array(
+          'fieldName' => 'website_type_id',
+          'sample' => 'Facebook',
+        ),
+      ),
+      'CRM_Core_DAO_MappingField' => array(
+        array(
+          'fieldName' => 'website_type_id',
+          'sample' => 'Facebook',
+        ),
+      ),
       'CRM_Contact_DAO_Contact' => array(
         array(
           'fieldName' => 'prefix_id',
@@ -86,6 +135,18 @@ class CRM_Core_PseudoConstantTest extends CiviUnitTestCase {
           'sample' => 'Home',
         ),
       ),
+      'CRM_Core_DAO_Website' => array(
+        array(
+          'fieldName' => 'website_type_id',
+          'sample' => 'Facebook',
+        ),
+      ),
+      'CRM_Core_DAO_MappingField' => array(
+        array(
+          'fieldName' => 'website_type_id',
+          'sample' => 'Facebook',
+        ),
+      ),
     );
 
     foreach ($fields as $daoName => $daoFields) {
index f18c4d324ea0db2b681d3bbd1201f284198d7a8a..7f80e1f923b10e31dd9a6900e6c18e6d4da3b5f2 100644 (file)
       <comment>ID of the priority given to this activity. Foreign key to civicrm_option_value.</comment>
       <add>2.0</add>
       <pseudoconstant>
-        <name>priority</name>
         <optionGroupName>priority</optionGroupName>
       </pseudoconstant>
   </field>
index 61623ab630e01693b3434ba39311eb7ff2fb4d2d..60bd84cade7de49223fcd036b59baafec94d6bab 100644 (file)
     <comment>Implicit FK to civicrm_option_value.</comment>
     <add>2.0</add>
     <onDelete>SET NULL</onDelete>
+    <pseudoconstant>
+      <optionGroupName>honor_type</optionGroupName>
+    </pseudoconstant>
   </field>
   <index>
     <name>index_contribution_status</name>
index 39d5726f418ba8f6ecffd18ad02bfa74c724cbaf..49530292b2717dae8da22c0de712b0e4623c6c1f 100644 (file)
@@ -62,6 +62,9 @@
     <length>255</length>
     <comment>name of the protocol to use for polling (like IMAP, POP3 or Maildir)</comment>
     <add>2.2</add>
+    <pseudoconstant>
+      <optionGroupName>mail_protocol</optionGroupName>
+    </pseudoconstant>
   </field>
   <field>
     <name>server</name>
index 33578409c9fe44f0ab14e5cdb3ce1545c510ce7b..ee570c0fa7bdfa1b23e7d4c543a6eb55b28fd94f 100644 (file)
@@ -45,6 +45,9 @@
       <type>int unsigned</type>
       <comment>Mapping Type</comment>
       <add>2.1</add>
+      <pseudoconstant>
+        <optionGroupName>mapping_type</optionGroupName>
+      </pseudoconstant>
   </field>
   <index>
     <name>UI_name</name>
index fd6125ba012848b110d59f538f35041590ac883d..c2b67f2dc5b8243d4c7d0fbccb26227cd1ac490d 100644 (file)
@@ -89,6 +89,9 @@
        <type>int unsigned</type>
        <comment>Which type of website does this site belong</comment>
        <add>3.2</add>
+       <pseudoconstant>
+         <optionGroupName>website_type</optionGroupName>
+       </pseudoconstant>
   </field> 
   <field>
        <name>relationship_type_id</name>
index 6c9a64277ec06c3cd595fb4be3928ebedc3b3ebf..0305638e4c8a67423cdb9ebb5093fe213dc9815a 100644 (file)
@@ -49,7 +49,6 @@
       <comment>Which Website type does this website belong to.</comment>
       <add>3.2</add>
       <pseudoconstant>
-        <name>websiteType</name>
         <optionGroupName>website_type</optionGroupName>
       </pseudoconstant>
   </field>
index b520d8fe5f1bad853504ec84738c099c183eba4e..4c95b343dd9774b9484cd83cec4e9d81d8f13f2f 100644 (file)
     <comment>Implicit FK to civicrm_option_value.</comment>
     <add>2.1</add>
     <onDelete>SET NULL</onDelete>
+    <pseudoconstant>
+      <optionGroupName>honor_type</optionGroupName>
+    </pseudoconstant>
   </field>
   <field>
     <name>max_reminders</name>