CRM-17120 remove last instance of call to uncached CRM_Core_OptionGroup::optionLabel fn
authoreileen <emcnaughton@wikimedia.org>
Sat, 10 Oct 2015 03:50:19 +0000 (16:50 +1300)
committereileen <emcnaughton@wikimedia.org>
Sat, 10 Oct 2015 03:50:19 +0000 (16:50 +1300)
I searched  & didn't find any other instances of this function

CRM/Contact/Page/View/Note.php
CRM/Core/OptionGroup.php
xml/schema/Core/Note.xml

index ffc3657c4bc754d4321dae7ca39f8f1ef73ecef1..b762d92666192f2c5e70d4d41f90364d7a8602d6 100644 (file)
@@ -58,8 +58,9 @@ class CRM_Contact_Page_View_Note extends CRM_Core_Page {
     $note->id = $this->_id;
     if ($note->find(TRUE)) {
       $values = array();
+
       CRM_Core_DAO::storeValues($note, $values);
-      $values['privacy'] = CRM_Core_OptionGroup::optionLabel('note_privacy', $values['privacy']);
+      $values['privacy'] = CRM_Core_PseudoConstant::getLabel('CRM_Core_BAO_Note', 'privacy', $values['privacy']);
       $this->assign('note', $values);
     }
 
index 4ae7c858112221f54efa0dd0056d5d1ef6ea477a..dcddadd583006af50de93af4ac9b4ae264592e8e 100644 (file)
@@ -561,27 +561,6 @@ DELETE g, v
     $dao = CRM_Core_DAO::executeQuery($query, $params);
   }
 
-  /**
-   * @param string $groupName
-   * @param $value
-   *
-   * @return null|string
-   */
-  public static function optionLabel($groupName, $value) {
-    $query = "
-SELECT v.label
-  FROM civicrm_option_group g,
-       civicrm_option_value v
- WHERE g.id = v.option_group_id
-   AND g.name  = %1
-   AND v.value = %2";
-    $params = array(
-      1 => array($groupName, 'String'),
-      2 => array($value, 'String'),
-    );
-    return CRM_Core_DAO::singleValueQuery($query, $params);
-  }
-
   /**
    * @param string $groupName
    * @param $fieldValue
index c71cd3f8da2a1dc7d0ce7e510e794b6d731a4b45..128da7796ed6d016a851205d72883ca52cf0dd66 100644 (file)
     <length>255</length>
     <comment>Foreign Key to Note Privacy Level (which is an option value pair and hence an implicit FK)</comment>
     <add>3.3</add>
+    <pseudoconstant>
+      <optionGroupName>note_privacy</optionGroupName>
+    </pseudoconstant>
   </field>
 </table>