CRM-19769 - Add colors to entityRef output
[civicrm-core.git] / CRM / Admin / Page / AJAX.php
index 06a34e186c9478821615089506fa0d1ee1e99f77..4374d62403c4ff5501c8f75eafe52d9b8449dec6 100644 (file)
@@ -3,7 +3,7 @@
  +--------------------------------------------------------------------+
  | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2015                                |
+ | Copyright CiviCRM LLC (c) 2004-2016                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2015
+ * @copyright CiviCRM LLC (c) 2004-2016
  */
 
 /**
@@ -45,7 +45,9 @@ class CRM_Admin_Page_AJAX {
     $contactID = CRM_Core_Session::singleton()->get('userID');
     if ($contactID) {
       CRM_Core_Page_AJAX::setJsHeaders();
-      print CRM_Core_Smarty::singleton()->fetchWith('CRM/common/navigation.js.tpl', array(
+      $smarty = CRM_Core_Smarty::singleton();
+      $smarty->assign('includeEmail', civicrm_api3('setting', 'getvalue', array('name' => 'includeEmailInName', 'group' => 'Search Preferences')));
+      print $smarty->fetchWith('CRM/common/navigation.js.tpl', array(
         'navigation' => CRM_Core_BAO_Navigation::createNavigation($contactID),
       ));
     }
@@ -264,7 +266,7 @@ class CRM_Admin_Page_AJAX {
 
     // query to list mergable tags
     $query = "
-SELECT t1.name, t1.id, t1.used_for, t2.name as parent
+SELECT t1.name, t1.id, t1.used_for, t1.color, t2.name as parent
 FROM   civicrm_tag t1
 LEFT JOIN civicrm_tag t2 ON t1.parent_id = t2.id
 WHERE  t1.id <> {$fromId} AND
@@ -278,6 +280,7 @@ LIMIT $limit";
       $row = array(
         'id' => $dao->id,
         'text' => ($dao->parent ? "{$dao->parent} :: " : '') . $dao->name,
+        'color' => isset($dao->color) ? $dao->color : NULL,
       );
       // Add warning about used_for types
       if (!empty($dao->used_for)) {