2 if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
3 /*********************************************************************************
4 * SugarCRM is a customer relationship management program developed by
5 * SugarCRM, Inc. Copyright (C) 2004-2011 SugarCRM Inc.
7 * This program is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU Affero General Public License version 3 as published by the
9 * Free Software Foundation with the addition of the following permission added
10 * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
11 * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
12 * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
14 * This program is distributed in the hope that it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
19 * You should have received a copy of the GNU Affero General Public License along with
20 * this program; if not, see http://www.gnu.org/licenses or write to the Free
21 * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24 * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
25 * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
27 * The interactive user interfaces in modified source and object code versions
28 * of this program must display Appropriate Legal Notices, as required under
29 * Section 5 of the GNU Affero General Public License version 3.
31 * In accordance with Section 7(b) of the GNU Affero General Public License version 3,
32 * these Appropriate Legal Notices must retain the display of the "Powered by
33 * SugarCRM" logo. If the display of the logo is not reasonably feasible for
34 * technical reasons, the Appropriate Legal Notices must display the words
35 * "Powered by SugarCRM".
36 ********************************************************************************/
38 /*********************************************************************************
40 * Description: TODO: To be written.
41 * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
42 * All Rights Reserved.
43 * Contributor(s): ______________________________________..
44 ********************************************************************************/
48 class UnifiedSearchAdvanced {
50 var $query_string = '';
52 function __construct(){
53 if(!empty($_REQUEST['query_string'])){
54 $query_string = trim($_REQUEST['query_string']);
55 if(!empty($query_string)){
56 $this->query_string = $query_string;
61 function getDropDownDiv($tpl = 'modules/Home/UnifiedSearchAdvanced.tpl') {
62 global $app_list_strings, $app_strings;
64 if(!file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php'))
69 include($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php');
71 if(!file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules_display.php'))
73 $this->createUnifiedSearchModulesDisplay();
76 include($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules_display.php');
78 global $mod_strings, $modListHeader, $app_list_strings, $current_user, $app_strings, $beanList;
79 $users_modules = $current_user->getPreference('globalSearch', 'search');
81 // preferences are empty, select all
82 if(empty($users_modules)) {
83 $users_modules = array();
84 foreach($unified_search_modules_display as $module=>$data) {
85 if (!empty($data['visible']) ) {
86 $users_modules[$module] = $beanList[$module];
89 $current_user->setPreference('globalSearch', $users_modules, 0, 'search');
92 $sugar_smarty = new Sugar_Smarty();
94 $modules_to_search = array();
96 foreach($users_modules as $key=>$module)
98 if(ACLController::checkAccess($key, 'list', true))
100 $modules_to_search[$key]['checked'] = true;
104 if(!empty($this->query_string))
106 $sugar_smarty->assign('query_string', securexss($this->query_string));
108 $sugar_smarty->assign('query_string', '');
111 $sugar_smarty->assign('MOD', return_module_language($GLOBALS['current_language'], 'Administration'));
112 $sugar_smarty->assign('APP', $app_strings);
113 $sugar_smarty->assign('USE_SEARCH_GIF', 0);
114 $sugar_smarty->assign('LBL_SEARCH_BUTTON_LABEL', $app_strings['LBL_SEARCH_BUTTON_LABEL']);
116 $json_enabled = array();
117 $json_disabled = array();
119 //Now add the rest of the modules that are searchable via Global Search settings
120 foreach($unified_search_modules_display as $module=>$data)
122 if(!isset($modules_to_search[$module]) && $data['visible'] && ACLController::checkAccess($module, 'list', true))
124 $modules_to_search[$module]['checked'] = false;
125 } else if (isset($modules_to_search[$module]) && !$data['visible']) {
126 unset($modules_to_search[$module]);
130 //Create the two lists (doing it this way preserves the user's ordering choice for enabled modules)
131 foreach($modules_to_search as $module=>$data)
133 $label = isset($app_list_strings['moduleList'][$module]) ? $app_list_strings['moduleList'][$module] : $module;
134 if(!empty($data['checked']))
136 $json_enabled[] = array("module" => $module, 'label' => $label);
138 $json_disabled[] = array("module" => $module, 'label' => $label);
142 $sugar_smarty->assign('enabled_modules', json_encode($json_enabled));
143 $sugar_smarty->assign('disabled_modules', json_encode($json_disabled));
145 $showDiv = $current_user->getPreference('showGSDiv', 'search');
151 $sugar_smarty->assign('SHOWGSDIV', $showDiv);
152 $sugar_smarty->debugging = true;
153 return $sugar_smarty->fetch($tpl);
157 if(!file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php'))
161 include $GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php';
163 if(!file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules_display.php'))
165 $this->createUnifiedSearchModulesDisplay();
167 include($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules_display.php');
170 require_once 'include/ListView/ListViewSmarty.php';
172 global $modListHeader, $beanList, $beanFiles, $current_language, $app_strings, $current_user, $mod_strings;
173 $home_mod_strings = return_module_language($current_language, 'Home');
176 $this->query_string = $GLOBALS['db']->quote(securexss(from_html(clean_string($this->query_string, 'UNIFIED_SEARCH'))));
178 if(!empty($_REQUEST['advanced']) && $_REQUEST['advanced'] != 'false') {
179 $modules_to_search = array();
180 if(!empty($_REQUEST['search_modules']))
182 foreach(explode (',', $_REQUEST['search_modules'] ) as $e)
184 $modules_to_search[$e] = $beanList[$e];
188 $current_user->setPreference('showGSDiv', isset($_REQUEST['showGSDiv']) ? $_REQUEST['showGSDiv'] : 'no', 0, 'search');
189 $current_user->setPreference('globalSearch', $modules_to_search, 0, 'search'); // save selections to user preference
191 $users_modules = $current_user->getPreference('globalSearch', 'search');
192 $modules_to_search = array();
194 if(!empty($users_modules)) {
195 // use user's previous selections
196 foreach ( $users_modules as $key => $value ) {
197 if (isset($unified_search_modules_display[$key]) && !empty($unified_search_modules_display[$key]['visible'])) {
198 $modules_to_search[$key] = $beanList[$key];
202 foreach($unified_search_modules_display as $module=>$data) {
203 if (!empty($data['visible']) ) {
204 $modules_to_search[$module] = $beanList[$module];
208 $current_user->setPreference('globalSearch', $modules_to_search, 'search');
212 $templateFile = 'modules/Home/UnifiedSearchAdvancedForm.tpl';
213 if(file_exists('custom/' . $templateFile))
215 $templateFile = 'custom/'.$templateFile;
218 echo $this->getDropDownDiv($templateFile);
220 $module_results = array();
221 $module_counts = array();
222 $has_results = false;
224 if(!empty($this->query_string)) {
225 foreach($modules_to_search as $moduleName => $beanName) {
226 require_once $beanFiles[$beanName] ;
227 $seed = new $beanName();
229 $lv = new ListViewSmarty();
230 $lv->lvd->additionalDetails = false;
231 $mod_strings = return_module_language($current_language, $seed->module_dir);
233 //retrieve the original list view defs and store for processing in case of custom layout changes
234 require('modules/'.$seed->module_dir.'/metadata/listviewdefs.php');
235 $orig_listViewDefs = $listViewDefs;
237 if(file_exists('custom/modules/'.$seed->module_dir.'/metadata/listviewdefs.php'))
239 require('custom/modules/'.$seed->module_dir.'/metadata/listviewdefs.php');
242 if ( !isset($listViewDefs) || !isset($listViewDefs[$seed->module_dir]) )
247 $unifiedSearchFields = array () ;
248 $innerJoins = array();
249 foreach ( $unified_search_modules[ $moduleName ]['fields'] as $field=>$def )
251 $listViewCheckField = strtoupper($field);
252 //check to see if the field is in listview defs
253 if ( empty($listViewDefs[$seed->module_dir][$listViewCheckField]['default']) ) {
254 //check to see if field is in original list view defs (in case we are using custom layout defs)
255 if (!empty($orig_listViewDefs[$seed->module_dir][$listViewCheckField]['default']) ) {
256 //if we are here then the layout has been customized, but the field is still needed for query creation
257 $listViewDefs[$seed->module_dir][$listViewCheckField] = $orig_listViewDefs[$seed->module_dir][$listViewCheckField];
262 //bug: 34125 we might want to try to use the LEFT JOIN operator instead of the INNER JOIN in the case we are
263 //joining against a field that has not been populated.
264 if(!empty($def['innerjoin']) )
266 if (empty($def['db_field']) )
270 $innerJoins[$field] = $def;
271 $def['innerjoin'] = str_replace('INNER', 'LEFT', $def['innerjoin']);
273 $unifiedSearchFields[ $moduleName ] [ $field ] = $def ;
274 $unifiedSearchFields[ $moduleName ] [ $field ][ 'value' ] = $this->query_string ;
278 * Use searchForm2->generateSearchWhere() to create the search query, as it can generate SQL for the full set of comparisons required
279 * generateSearchWhere() expects to find the search conditions for a field in the 'value' parameter of the searchFields entry for that field
281 require_once $beanFiles[$beanName] ;
282 $seed = new $beanName();
283 require_once 'include/SearchForm/SearchForm2.php' ;
284 $searchForm = new SearchForm ( $seed, $moduleName ) ;
286 $searchForm->setup (array ( $moduleName => array() ) , $unifiedSearchFields , '' , 'saved_views' /* hack to avoid setup doing further unwanted processing */ ) ;
287 $where_clauses = $searchForm->generateSearchWhere() ;
288 //add inner joins back into the where clause
289 $params = array('custom_select' => "");
290 foreach($innerJoins as $field=>$def) {
291 if (isset ($def['db_field'])) {
292 foreach($def['db_field'] as $dbfield)
293 $where_clauses[] = $dbfield . " LIKE '" . $this->query_string . "%'";
294 $params['custom_select'] .= ", $dbfield";
295 $params['distinct'] = true;
296 //$filterFields[$dbfield] = $dbfield;
300 if (count($where_clauses) > 0)
302 $where = '(('. implode(' ) OR ( ', $where_clauses) . '))';
305 $displayColumns = array();
306 foreach($listViewDefs[$seed->module_dir] as $colName => $param)
308 if(!empty($param['default']) && $param['default'] == true)
310 $param['url_sort'] = true;//bug 27933
311 $displayColumns[$colName] = $param;
315 if(count($displayColumns) > 0)
317 $lv->displayColumns = $displayColumns;
319 $lv->displayColumns = $listViewDefs[$seed->module_dir];
323 $lv->mergeduplicates = false;
324 $lv->multiSelect = false;
327 $lv->showMassupdateFields = false;
333 $lv->overlib = false;
336 $lv->setup($seed, 'include/ListView/ListViewNoMassUpdate.tpl', $where, $params, 0, 10);
338 $module_results[$moduleName] = '<br /><br />' . get_form_header($GLOBALS['app_list_strings']['moduleList'][$seed->module_dir] . ' (' . $lv->data['pageData']['offsets']['total'] . ')', '', false);
339 $module_counts[$moduleName] = $lv->data['pageData']['offsets']['total'];
341 if($lv->data['pageData']['offsets']['total'] == 0) {
342 //$module_results[$moduleName] .= "<li class='noBullet' id='whole_subpanel_{$moduleName}'><div id='div_{$moduleName}'><h2>" . $home_mod_strings['LBL_NO_RESULTS_IN_MODULE'] . '</h2></div></li>';
343 $module_results[$moduleName] .= '<h2>' . $home_mod_strings['LBL_NO_RESULTS_IN_MODULE'] . '</h2>';
346 //$module_results[$moduleName] .= "<li class='noBullet' id='whole_subpanel_{$moduleName}'><div id='div_{$moduleName}'>" . $lv->display(false, false) . '</div></li>';
347 $module_results[$moduleName] .= $lv->display(false, false);
354 foreach($module_counts as $name=>$value) {
355 echo $module_results[$name];
357 } else if(empty($_REQUEST['form_only'])) {
358 echo $home_mod_strings['LBL_NO_RESULTS'];
359 echo $home_mod_strings['LBL_NO_RESULTS_TIPS'];
364 function buildCache()
367 global $beanList, $beanFiles, $dictionary;
369 $supported_modules = array();
371 foreach($beanList as $moduleName=>$beanName)
373 if (!isset($beanFiles[$beanName]))
376 if($beanName == 'aCase') $beanName = 'Case';
378 $manager = new VardefManager ( );
379 $manager->loadVardef( $moduleName , $beanName ) ;
381 // obtain the field definitions used by generateSearchWhere (duplicate code in view.list.php)
382 if(file_exists('custom/modules/'.$moduleName.'/metadata/metafiles.php')){
383 require('custom/modules/'.$moduleName.'/metadata/metafiles.php');
384 }elseif(file_exists('modules/'.$moduleName.'/metadata/metafiles.php')){
385 require('modules/'.$moduleName.'/metadata/metafiles.php');
389 if(!empty($metafiles[$moduleName]['searchfields']))
391 require $metafiles[$moduleName]['searchfields'] ;
392 } else if(file_exists("modules/{$moduleName}/metadata/SearchFields.php")) {
393 require "modules/{$moduleName}/metadata/SearchFields.php" ;
396 $isCustomModule = preg_match('/^([a-z0-9]{1,5})_([a-z0-9_]+)$/i' , $moduleName);
398 //If the bean supports unified search or if it's a custom module bean and unified search is not defined
399 if(!empty($dictionary[$beanName]['unified_search']) || $isCustomModule)
402 foreach ( $dictionary [ $beanName ][ 'fields' ] as $field => $def )
404 // We cannot enable or disable unified_search for email in the vardefs as we don't actually have a vardef entry for 'email' -
405 // the searchFields entry for 'email' doesn't correspond to any vardef entry. Instead it contains SQL to directly perform the search.
406 // So as a proxy we allow any field in the vardefs that has a name starting with 'email...' to be tagged with the 'unified_search' parameter
408 if (strpos($field,'email') !== false)
411 //bug: 38139 - allow phone to be searched through Global Search
412 if (strpos($field,'phone') !== false)
415 if ( !empty($def['unified_search']) && isset ( $searchFields [ $moduleName ] [ $field ] ))
417 $fields [ $field ] = $searchFields [ $moduleName ] [ $field ] ;
421 if(count($fields) > 0) {
422 $supported_modules [$moduleName] ['fields'] = $fields;
423 if (isset($dictionary[$beanName]['unified_search_default_enabled']) && $dictionary[$beanName]['unified_search_default_enabled'] === TRUE) {
424 $supported_modules [$moduleName]['default'] = true;
426 $supported_modules [$moduleName]['default'] = false;
434 ksort($supported_modules);
435 write_array_to_file('unified_search_modules', $supported_modules, $GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php');
442 function modifyGlobalSearchSettings()
444 global $mod_strings, $app_strings, $app_list_strings;
446 if(!file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules_display.php'))
448 $this->createUnifiedSearchModulesDisplay();
451 include($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules_display.php');
453 $sugar_smarty = new Sugar_Smarty();
454 $sugar_smarty->assign('APP', $app_strings);
455 $sugar_smarty->assign('MOD', $mod_strings);
457 //Add the translated attribute for display label
458 $json_enabled = array();
459 $json_disabled = array();
460 foreach($unified_search_modules_display as $module=>$data)
462 $label = isset($app_list_strings['moduleList'][$module]) ? $app_list_strings['moduleList'][$module] : $module;
463 if($data['visible'] === true)
465 $json_enabled[] = array("module" => $module, 'label' => $label);
467 $json_disabled[] = array("module" => $module, 'label' => $label);
471 //If the file doesn't exist
472 if(!file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php'))
477 include($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php');
479 //Now add any new modules that may have since been added to unified_search_modules.php
480 foreach($unified_search_modules as $module=>$data)
482 if(!isset($unified_search_modules_display[$module]))
484 $label = isset($app_list_strings['moduleList'][$module]) ? $app_list_strings['moduleList'][$module] : $module;
487 $json_enabled[] = array("module" => $module, 'label' => $label);
489 $json_disabled[] = array("module" => $module, 'label' => $label);
494 $sugar_smarty->assign('enabled_modules', json_encode($json_enabled));
495 $sugar_smarty->assign('disabled_modules', json_encode($json_disabled));
497 //uasort($unified_search_modules_display, 'unified_search_modules_cmp');
498 $tpl = 'modules/Administration/templates/GlobalSearchSettings.tpl';
499 if(file_exists('custom/' . $tpl))
501 $tpl = 'custom/' . $tpl;
503 return $sugar_smarty->fetch($tpl);
508 * addModuleToUnifiedSearch
509 * This method handles adding a new module to the unified search list of modules. It will add an
510 * entry to the unified_search_modules.php if it already exists
512 * @param module String value of the module entry to add
513 * @return boolean value indiciating whether or not the module was added to the unified_search_modules.php file
515 function addModuleToUnifiedSearch($module='')
522 //If the file doesn't exist
523 if(!file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php'))
525 include($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php');
527 return isset($unified_search_modules[$module]) ? true : false;
530 include($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php');
532 //If modules is already in list, unset it and rebuild
533 if(isset($unified_search_modules[$module]))
535 unset($unified_search_modules[$module]);
539 global $beanList, $beanFiles, $dictionary;
541 if(!isset($beanList[$module]))
543 $GLOBALS['log']->fatal('no beanList entry!');
548 $beanName = $beanList[$module];
550 if (!isset($beanFiles[$beanName]))
552 $GLOBALS['log']->fatal('no beanFiles entry!');
556 if($beanName == 'aCase')
561 $manager = new VardefManager();
562 $manager->loadVardef($module, $beanName);
564 // obtain the field definitions used by generateSearchWhere (duplicate code in view.list.php)
565 if(file_exists('custom/modules/'.$module.'/metadata/metafiles.php'))
567 require('custom/modules/'.$module.'/metadata/metafiles.php');
568 } elseif (file_exists('modules/'.$module.'/metadata/metafiles.php')) {
569 require('modules/'.$module.'/metadata/metafiles.php');
573 if(!empty($metafiles[$module]['searchfields']))
575 require $metafiles[$moduleName]['searchfields'] ;
576 } else if(file_exists("modules/{$module}/metadata/SearchFields.php")) {
577 require "modules/{$module}/metadata/SearchFields.php" ;
580 $isCustomModule = preg_match('/^([a-z0-9]{1,5})_([a-z0-9_]+)$/i' , $module);
582 //If the bean supports unified search or if it's a custom module bean and unified search is not defined
583 if(!empty($dictionary[$beanName]['unified_search']) || $isCustomModule)
585 $GLOBALS['log']->fatal("found dictionary entry!");
587 foreach ( $dictionary [ $beanName ][ 'fields' ] as $field => $def )
589 // We cannot enable or disable unified_search for email in the vardefs as we don't actually have a vardef entry for 'email' -
590 // the searchFields entry for 'email' doesn't correspond to any vardef entry. Instead it contains SQL to directly perform the search.
591 // So as a proxy we allow any field in the vardefs that has a name starting with 'email...' to be tagged with the 'unified_search' parameter
592 if (strpos($field,'email') !== false)
595 //bug: 38139 - allow phone to be searched through Global Search
596 if (strpos($field,'phone') !== false)
599 if (!empty($def['unified_search']) && isset ($searchFields [$module] [ $field ]))
601 $fields[ $field ] = $searchFields [$module] [ $field ] ;
605 if(count($fields) > 0) {
606 $unified_search_modules [$module] ['fields'] = $fields;
607 if (isset($dictionary[$beanName]['unified_search_default_enabled']) && $dictionary[$beanName]['unified_search_default_enabled'] === TRUE) {
608 $unified_search_modules[$module]['default'] = true;
610 $unified_search_modules[$module]['default'] = false;
615 if(!isset($unified_search_modules[$module]))
620 return write_array_to_file('unified_search_modules', $unified_search_modules, $GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php');
624 * saveGlobalSearchSettings
625 * This method handles the administrator's request to save the searchable modules selected and stores
626 * the results in the unified_search_modules_display.php file
629 function saveGlobalSearchSettings()
631 if(!file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules_display.php'))
633 $this->createUnifiedSearchModulesDisplay();
636 include($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules_display.php');
638 if(isset($_REQUEST['enabled_modules']))
640 $new_unified_search_modules_display = array();
642 foreach(explode (',', $_REQUEST['enabled_modules'] ) as $module)
644 $new_unified_search_modules_display[$module]['visible'] = true;
647 foreach($unified_search_modules_display as $module=>$data)
649 if(!isset($new_unified_search_modules_display[$module]))
651 $new_unified_search_modules_display[$module]['visible'] = false;
655 $this->writeUnifiedSearchModulesDisplayFile($new_unified_search_modules_display);
660 public static function unlinkUnifiedSearchModulesFile() {
661 //clear the unified_search_module.php file
662 if(file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php'))
664 $GLOBALS['log']->info("unlink {$GLOBALS['sugar_config']['cache_dir']}modules/unified_search_modules.php file");
665 unlink($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php');
670 * createUnifiedSearchModulesDisplay
671 * method to create the unified_search_modules_display.php file
674 function createUnifiedSearchModulesDisplay()
676 //Make directory if it doesn't exist
677 if(!file_exists('cache/modules'))
679 mkdir_recursive('cache/modules');
682 //Load unified_search_modules.php file
683 if(!file_exists($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php'))
688 include($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules.php');
690 $unified_search_modules_display = array();
692 if(!empty($unified_search_modules))
694 foreach($unified_search_modules as $module=>$data)
696 $unified_search_modules_display[$module]['visible'] = (isset($data['default']) && $data['default']) ? true : false;
700 $this->writeUnifiedSearchModulesDisplayFile($unified_search_modules_display);
705 * writeUnifiedSearchModulesDisplayFile
706 * Private method to handle writing the unified_search_modules_display value to file
708 * @param mixed The array of the unified search modules and their display attributes
709 * @return boolean value indication whether or not file was successfully written
710 * @throws Exception Thrown if the file write operation fails
712 private function writeUnifiedSearchModulesDisplayFile($unified_search_modules_display)
714 if(is_null($unified_search_modules_display) || empty($unified_search_modules_display))
719 if(!write_array_to_file("unified_search_modules_display", $unified_search_modules_display, $GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules_display.php'))
721 //Log error message and throw Exception
723 $msg = string_format($app_strings['ERR_FILE_WRITE'], array($GLOBALS['sugar_config']['cache_dir'].'modules/unified_search_modules_display.php'));
724 $GLOBALS['log']->error($msg);
725 throw new Exception($msg);
733 function unified_search_modules_cmp($a, $b) {
734 if(!isset($a['translated']) || !isset($b['translated']))
739 $name1 = strtolower($a['translated']);
740 $name2 = strtolower($b['translated']);
742 return $name1 < $name2 ? -1 : 1;