CRM-14264 : start using xml for gender / suffix / prefix
authorDonald A. Lobo <lobo@civicrm.org>
Wed, 1 May 2013 01:50:04 +0000 (18:50 -0700)
committerColeman Watts <coleman@civicrm.org>
Wed, 29 May 2013 21:57:18 +0000 (14:57 -0700)
----------------------------------------
* CRM-14264:
  http://issues.civicrm.org/jira/browse/CRM-14264

CRM/Contact/BAO/Query.php
CRM/Contact/Form/Search/Advanced.php
CRM/Contact/Form/Search/Criteria.php
CRM/Contact/Selector.php
templates/CRM/Contact/Form/Search/Criteria/Demographics.tpl

index 03c72a933f8a10b43186ccdb30f4ad26fd105ec3..b6a222050fb884b35eb1186f82c538ef706ba822 100644 (file)
@@ -1726,13 +1726,13 @@ class CRM_Contact_BAO_Query {
     elseif ($field['pseudoconstant']) {
       $this->optionValueQuery(
         $name, $op, $value, $grouping,
-        CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', $field['dbName']),
+        CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', $field['name']),
         $field,
         $field['title'],
         'String',
         TRUE
       );
-      if ($name == 'gender') {
+      if ($name == 'gender_id') {
         self::$_openedPanes[ts('Demographics')] = TRUE;
       }
     }
@@ -4866,7 +4866,15 @@ AND   displayRelType.is_active = 1
       // its a string, lets get the int value
       $value = array_search($value, $selectValues);
     }
-    $wc = self::caseImportant($op) && ! $useIDsOnly ? "LOWER({$field['where']})" : "{$field['where']}";
+    if ($useIDsOnly) {
+      list($tableName, $fieldName) = explode('.', $field['where'], 2);
+      if ($tableName == 'civicrm_contact') {
+        $wc = "contact_a.$fieldName";
+      }
+    }
+    else {
+      $wc = self::caseImportant($op) ? "LOWER({$field['where']})" : "{$field['where']}";
+    }
     $this->_where[$grouping][] = self::buildClause($wc, $op, $value, $dataType);
     $this->_qill[$grouping][] = $label . " $op '$qill'";
   }
index a3892ba35ad88cbfb58401c0b460576a4dd9f040..e6fcc3f7754af0fd3ae93862f43c8544aac60396 100644 (file)
@@ -8,7 +8,7 @@
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
  | CiviCRM is free software; you can copy, modify, and distribute it  |
- | under the terms of the GNU Affero General Public License           |
+s | under the terms of the GNU Affero General Public License           |
  | Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
  |                                                                    |
  | CiviCRM is distributed in the hope that it will be useful, but     |
index 47ea794b32c1c151fdeba21565ddbbc0041ac105..6c0ac1aaee996901825fd2de77754cd9d996b2be 100644 (file)
@@ -477,7 +477,7 @@ class CRM_Contact_Form_Search_Criteria {
         array('id' => "civicrm_gender_{$var}_{$key}")
       );
     }
-    $form->addGroup($genderOptions, 'gender', ts('Gender'));
+    $form->addGroup($genderOptions, 'gender_id', ts('Gender'));
 
     CRM_Core_Form_Date::buildDateRange($form, 'birth_date', 1, '_low', '_high', ts('From'), FALSE, FALSE, 'birth');
 
index 06c9a7ad568446548e29994a281cd4e888955e9d..78c891e1e51c2703a810caa7d53e720e13eb5f70 100644 (file)
@@ -576,14 +576,16 @@ class CRM_Contact_Selector extends CRM_Core_Selector_Base implements CRM_Core_Se
     $groupID = CRM_Utils_Array::key('1', $this->_formValues['group']);
 
     $pseudoconstants = array();
-    // get all the pseudoconstant values
-    foreach ($this->_fields as $name => $values) {
-      if (isset($this->_fields[$name]['pseudoconstant'])) {
-        $pseudoconstants[$name] =
-          array(
-            'dbName' => $this->_fields[$name]['name'],
-            'values' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', $name),
-          );
+    if (!empty($this->_fields)) {
+      // get all the pseudoconstant values
+      foreach ($this->_fields as $name => $values) {
+        if (isset($this->_fields[$name]['pseudoconstant'])) {
+          $pseudoconstants[$name] =
+            array(
+              'dbName' => $this->_fields[$name]['name'],
+              'values' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', $name),
+            );
+        }
       }
     }
 
index 957a46374e9b035478a91e3bc90ce23ee64618ce..38bd053f6840d224c61258449f313e8597b35926 100644 (file)
@@ -42,8 +42,8 @@
       </tr>
       <tr>
          <td>
-            {$form.gender.label}<br />
-            {$form.gender.html}<span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('gender', 'Advanced'); return false;" >{ts}clear{/ts}</a>)</span>
+            {$form.gender_id.label}<br />
+            {$form.gender_id.html}<span class="crm-clear-link">(<a href="#" title="unselect" onclick="unselectRadio('gender_id', 'Advanced'); return false;" >{ts}clear{/ts}</a>)</span>
          </td>
       </tr>
     </table>