From 3cf5f8e490da971f72bbb62a279355461d80f62a Mon Sep 17 00:00:00 2001
From: "Donald A. Lobo" <lobo@civicrm.org>
Date: Tue, 30 Apr 2013 14:58:52 -0700
Subject: [PATCH] Migrate to new code

---
 CRM/Contact/BAO/Query.php | 4 ++--
 CRM/Core/OptionValue.php  | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php
index 2ac81c09a5..9112fbb984 100644
--- a/CRM/Contact/BAO/Query.php
+++ b/CRM/Contact/BAO/Query.php
@@ -587,7 +587,7 @@ class CRM_Contact_BAO_Query {
         continue;
       }
 
-      if ($field['pseudoconstant']) {
+      if (CRM_Utils_Array::value('pseudoconstant', $field)) {
         continue;
       }
 
@@ -1730,7 +1730,7 @@ class CRM_Contact_BAO_Query {
     elseif ($field['pseudoconstant']) {
       $this->optionValueQuery(
         $name, $op, $value, $grouping,
-        CRM_Core_PseudoConstant::{$field['pseudoconstant']['name']}(),
+        CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', $field['dbName']),
         $field,
         $field['title'],
         'String',
diff --git a/CRM/Core/OptionValue.php b/CRM/Core/OptionValue.php
index d54ff87f90..cd3a892e54 100644
--- a/CRM/Core/OptionValue.php
+++ b/CRM/Core/OptionValue.php
@@ -323,6 +323,7 @@ class CRM_Core_OptionValue {
           $title = array(
             'gender' => array(
               'name' => 'gender',
+              'dbName' => 'gender_id',
               'title' => ts('Gender'),
               'headerPattern' => '/^gender$/i',
               'pseudoconstant' => $contactFields['gender_id']['pseudoconstant'],
@@ -330,6 +331,7 @@ class CRM_Core_OptionValue {
              ),
             'individual_prefix' => array(
               'name' => 'individual_prefix',
+              'dbName' => 'prefix_id',
               'title' => ts('Individual Prefix'),
               'headerPattern' => '/^(prefix|title)/i',
               'pseudoconstant' => $contactFields['prefix_id']['pseudoconstant'],
@@ -337,6 +339,7 @@ class CRM_Core_OptionValue {
             ),
             'individual_suffix' => array(
               'name' => 'individual_suffix',
+              'dbName' => 'suffix_id',
               'title' => ts('Individual Suffix'),
               'headerPattern' => '/^suffix$/i',
               'pseudoconstant' => $contactFields['suffix_id']['pseudoconstant'],
-- 
GitLab