public function run() { $config = SugarConfig::getInstance(); foreach ($this->upgradeLabels as $module => $labels) { $changedLanguages = array(); // Let's fix labels for all languages foreach ($config->get('languages') as $key => $value) { if ($this->upgradeModuleLabels($module, $key)) { $changedLanguages[$key] = $key; } } // Rebuild changed languages for module if (!empty($changedLanguages)) { $this->rebuildLanguages($changedLanguages, $module); } $changedSubpanels = array(); // Fix subpanels if ($this->upgradeSubpanelModuleLabels($module)) { $changedSubpanels[$key] = $key; } $changedListViews = array(); // Fix list views if ($this->upgradeListViewModuleLabels($module)) { $changedListViews[$key] = $key; } } }
private function __construct() { $level = SugarConfig::getInstance()->get('logger.level', $this->level); if (!empty($level)) { $this->setLevel($level); } }
function handleOverride() { global $sugar_config, $sugar_version; $sc = SugarConfig::getInstance(); $overrideArray = $this->readOverride(); $this->previous_sugar_override_config_array = $overrideArray; $diffArray = deepArrayDiff($this->config, $sugar_config); $overrideArray = sugarArrayMerge($overrideArray, $diffArray); $overideString = "<?php\n/***CONFIGURATOR***/\n"; sugar_cache_put('sugar_config', $this->config); $GLOBALS['sugar_config'] = $this->config; foreach ($overrideArray as $key => $val) { if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key])) { if (strcmp("{$val}", 'true') == 0) { $val = true; $this->config[$key] = $val; } if (strcmp("{$val}", 'false') == 0) { $val = false; $this->config[$key] = false; } } $overideString .= override_value_to_string_recursive2('sugar_config', $key, $val); } $overideString .= '/***CONFIGURATOR***/'; $this->saveOverride($overideString); if (isset($this->config['logger']['level']) && $this->logger) { $this->logger->setLevel($this->config['logger']['level']); } }
/** * Get cron driver * @return SugarCronJobs */ protected function getCronDriver() { $cronDriver = $this->config->get('cron_class', 'SugarCronJobs'); $this->logger->debug("Using {$cronDriver} as CRON driver"); \SugarAutoLoader::requireWithCustom("include/SugarQueue/{$cronDriver}.php"); return new $cronDriver(); }
/** * @see SugarView::display() */ public function display() { global $current_user, $mod_strings, $app_strings, $app_list_strings, $sugar_config, $locale; $configurator = new Configurator(); $sugarConfig = SugarConfig::getInstance(); $focus = new Administration(); $configurator->parseLoggerSettings(); $focus->retrieveSettings(); if (!empty($_POST['restore'])) { $configurator->restoreConfig(); } $this->ss->assign('MOD', $mod_strings); $this->ss->assign('APP', $app_strings); $this->ss->assign('APP_LIST', $app_list_strings); $this->ss->assign('config', $configurator->config); $this->ss->assign('error', $configurator->errors); $this->ss->assign("AUTO_REFRESH_INTERVAL_OPTIONS", get_select_options_with_id($app_list_strings['dashlet_auto_refresh_options_admin'], isset($configurator->config['dashlet_auto_refresh_min']) ? $configurator->config['dashlet_auto_refresh_min'] : 30)); $this->ss->assign('LANGUAGES', get_languages()); $this->ss->assign("JAVASCRIPT", get_set_focus_js() . get_configsettings_js()); $this->ss->assign('company_logo', SugarThemeRegistry::current()->getImageURL('company_logo.png')); $this->ss->assign("settings", $focus->settings); $this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype'])); if (!empty($focus->settings['proxy_on'])) { $this->ss->assign("PROXY_CONFIG_DISPLAY", 'inline'); } else { $this->ss->assign("PROXY_CONFIG_DISPLAY", 'none'); } if (!empty($focus->settings['proxy_auth'])) { $this->ss->assign("PROXY_AUTH_DISPLAY", 'inline'); } else { $this->ss->assign("PROXY_AUTH_DISPLAY", 'none'); } if (!empty($configurator->config['logger']['level'])) { $this->ss->assign('log_levels', get_select_options_with_id(LoggerManager::getLoggerLevels(), $configurator->config['logger']['level'])); } else { $this->ss->assign('log_levels', get_select_options_with_id(LoggerManager::getLoggerLevels(), '')); } if (!empty($configurator->config['lead_conv_activity_opt'])) { $this->ss->assign('lead_conv_activities', get_select_options_with_id(Lead::getActivitiesOptions(), $configurator->config['lead_conv_activity_opt'])); } else { $this->ss->assign('lead_conv_activities', get_select_options_with_id(Lead::getActivitiesOptions(), '')); } if (!empty($configurator->config['logger']['file']['suffix'])) { $this->ss->assign('filename_suffix', get_select_options_with_id(SugarLogger::$filename_suffix, $configurator->config['logger']['file']['suffix'])); } else { $this->ss->assign('filename_suffix', get_select_options_with_id(SugarLogger::$filename_suffix, '')); } echo $this->getModuleTitle(false); $this->ss->display('modules/Configurator/tpls/EditView.tpl'); $javascript = new javascript(); $javascript->setFormName("ConfigureSettings"); $javascript->addFieldGeneric("notify_fromaddress", "email", $mod_strings['LBL_NOTIFY_FROMADDRESS'], TRUE, ""); $javascript->addFieldGeneric("notify_subject", "varchar", $mod_strings['LBL_NOTIFY_SUBJECT'], TRUE, ""); $javascript->addFieldGeneric("proxy_host", "varchar", $mod_strings['LBL_PROXY_HOST'], TRUE, ""); $javascript->addFieldGeneric("proxy_port", "int", $mod_strings['LBL_PROXY_PORT'], TRUE, ""); $javascript->addFieldGeneric("proxy_password", "varchar", $mod_strings['LBL_PROXY_PASSWORD'], TRUE, ""); $javascript->addFieldGeneric("proxy_username", "varchar", $mod_strings['LBL_PROXY_USERNAME'], TRUE, ""); echo $javascript->getScript(); }
public function tearDown() { if (file_exists($this->_filename)) { unlink($this->_filename); } $GLOBALS['sugar_config']['default_permissions'] = $this->_old_default_permissions; SugarConfig::getInstance()->clearCache(); }
/** * Ctor * @param string $version */ public function __construct($version, LoggerTransition $logger = null) { $this->localInstall = $version != "GLOBAL" && $version != "PROJECT"; if ($this->localInstall) { $this->logger = new LoggerTransition(\LoggerManager::getLogger()); $this->config = \SugarConfig::getInstance(); } parent::__construct('sugar-cli', $version); }
public function logDebug($message) { $defaultLogLevel = 'fatal'; $config = SugarConfig::getInstance(); $level = $config->get('logger.level', $defaultLogLevel); if ($level == 'debug') { $this->log($message); } }
private function __construct() { $level = SugarConfig::getInstance()->get('logger.level', $this->_level); if (!empty($level)) { $this->setLevel($level); } if (empty(self::$_loggers)) { $this->_findAvailableLoggers(); } }
/** * @see SugarView::display() */ public function display() { global $current_user, $mod_strings, $app_list_strings, $sugar_config, $locale, $sugar_version; if (!is_admin($current_user)) { sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']); } $themeObject = SugarThemeRegistry::current(); $configurator = new Configurator(); $sugarConfig = SugarConfig::getInstance(); $focus = new Administration(); $focus->retrieveSettings(); $ut = $GLOBALS['current_user']->getPreference('ut'); if (empty($ut)) { $this->ss->assign('SKIP_URL', 'index.php?module=Users&action=Wizard&skipwelcome=1'); } else { $this->ss->assign('SKIP_URL', 'index.php?module=Home&action=index'); } // Always mark that we have got past this point $focus->saveSetting('system', 'adminwizard', 1); $css = $themeObject->getCSS(); $favicon = $themeObject->getImageURL('sugar_icon.ico', false); $this->ss->assign('FAVICON_URL', getJSPath($favicon)); $this->ss->assign('SUGAR_CSS', $css); $this->ss->assign('MOD_USERS', return_module_language($GLOBALS['current_language'], 'Users')); $this->ss->assign('CSS', '<link rel="stylesheet" type="text/css" href="' . SugarThemeRegistry::current()->getCSSURL('wizard.css') . '" />'); $this->ss->assign('LANGUAGES', get_languages()); $this->ss->assign('config', $sugar_config); $this->ss->assign('SUGAR_VERSION', $sugar_version); $this->ss->assign('settings', $focus->settings); $this->ss->assign('exportCharsets', get_select_options_with_id($locale->getCharsetSelect(), $sugar_config['default_export_charset'])); $this->ss->assign('getNameJs', $locale->getNameJs()); $this->ss->assign('NAMEFORMATS', $locale->getUsableLocaleNameOptions($sugar_config['name_formats'])); $this->ss->assign('JAVASCRIPT', get_set_focus_js() . get_configsettings_js()); $this->ss->assign('company_logo', SugarThemeRegistry::current()->getImageURL('company_logo.png')); $this->ss->assign('mail_smtptype', $focus->settings['mail_smtptype']); $this->ss->assign('mail_smtpserver', $focus->settings['mail_smtpserver']); $this->ss->assign('mail_smtpport', $focus->settings['mail_smtpport']); $this->ss->assign('mail_smtpuser', $focus->settings['mail_smtpuser']); $this->ss->assign('mail_smtppass', $focus->settings['mail_smtppass']); $this->ss->assign('mail_smtpauth_req', $focus->settings['mail_smtpauth_req'] ? "checked='checked'" : ''); $this->ss->assign('MAIL_SSL_OPTIONS', get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl'])); $this->ss->assign('notify_allow_default_outbound_on', !empty($focus->settings['notify_allow_default_outbound']) && $focus->settings['notify_allow_default_outbound'] == 2 ? 'CHECKED' : ''); $this->ss->assign('THEME', SugarThemeRegistry::current()->__toString()); // get javascript ob_start(); $this->options['show_javascript'] = true; $this->renderJavascript(); $this->options['show_javascript'] = false; $this->ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS()); ob_end_clean(); $this->ss->assign('langHeader', get_language_header()); $this->ss->assign('START_PAGE', !empty($_REQUEST['page']) ? $_REQUEST['page'] : 'welcome'); $this->ss->display('modules/Configurator/tpls/adminwizard.tpl'); }
function __construct() { $config = SugarConfig::getInstance(); $this->ext = $config->get('logger.file.ext', $this->ext); $this->logfile = $config->get('logger.file.name', $this->logfile); $this->dateFormat = $config->get('logger.file.dateFormat', $this->dateFormat); $this->logSize = $config->get('logger.file.maxSize', $this->logSize); $this->maxLogs = $config->get('logger.file.maxLogs', $this->maxLogs); $this->filesuffix = $config->get('logger.file.suffix', $this->filesuffix); unset($config); $this->doInitialization(); }
/** * Get the memcached object; initialize if needed */ protected function _getMemcachedObject() { if (!$this->_memcached instanceof Memcached) { $this->_memcached = new Memcached(); $this->_host = SugarConfig::getInstance()->get('external_cache.memcache.host', $this->_host); $this->_port = SugarConfig::getInstance()->get('external_cache.memcache.port', $this->_port); if (!@$this->_memcached->addServer($this->_host, $this->_port)) { return false; } } return $this->_memcached; }
public function __construct() { $config = SugarConfig::getInstance(); $this->ext = '.log'; $this->logfile = 'PMSE'; $this->dateFormat = $config->get('logger.file.dateFormat', $this->dateFormat); $this->logSize = $config->get('logger.file.maxSize', $this->logSize); $this->maxLogs = $config->get('logger.file.maxLogs', $this->maxLogs); $this->filesuffix = $config->get('logger.file.suffix', $this->filesuffix); $log_dir = $config->get('log_dir', $this->log_dir); $this->log_dir = $log_dir . (empty($log_dir) ? '' : '/'); unset($config); $this->_doInitialization(); }
public function testAssertLogging() { $GLOBALS['log']->setLevel('debug'); $GLOBALS['log']->assert('this was asserted true', true); $GLOBALS['log']->assert('this was asserted false', false); $config = SugarConfig::getInstance(); $ext = $config->get('logger.file.ext'); $logfile = $config->get('logger.file.name'); $log_dir = $config->get('log_dir'); $log_dir = $log_dir . (empty($log_dir) ? '' : '/'); $logFile = file_get_contents($log_dir . $logfile . $ext); $this->assertContains('[DEBUG] this was asserted false', $logFile); $this->assertNotContains('[DEBUG] this was asserted true', $logFile); }
/** * @param SugarSearchEngineAqbstractBase $engine */ public function __construct(SugarSearchEngineAbstractBase $engine = null) { if ($engine != null) { $this->SSEngine = $engine; } else { $this->SSEngine = SugarSearchEngineFactory::getInstance(); } $this->db = DBManagerFactory::getInstance('fts'); $this->table_name = self::QUEUE_TABLE; $config = SugarConfig::getInstance(); $this->max_bulk_threshold = $config->get('search_engine.max_bulk_threshold', $this->max_bulk_threshold); $this->max_bulk_query_threshold = $config->get('search_engine.max_bulk_query_threshold', $this->max_bulk_query_threshold); $this->max_bulk_delete_threshold = $config->get('search_engine.max_bulk_delete_threshold', $this->max_bulk_delete_threshold); $this->postpone_job_time = $config->get('search_engine.postpone_job_time', $this->postpone_job_time); }
/** * Constructor * * Reads the config file for logger settings */ public function __construct() { $config = SugarConfig::getInstance(); $this->ext = $config->get('logger.file.ext', $this->ext); $this->logfile = $config->get('logger.file.name', $this->logfile); $this->dateFormat = $config->get('logger.file.dateFormat', $this->dateFormat); $this->logSize = $config->get('logger.file.maxSize', $this->logSize); $this->maxLogs = $config->get('logger.file.maxLogs', $this->maxLogs); $this->filesuffix = $config->get('logger.file.suffix', $this->filesuffix); $log_dir = $config->get('log_dir', $this->log_dir); $this->log_dir = $log_dir . (empty($log_dir) ? '' : '/'); unset($config); $this->_doInitialization(); LoggerManager::setLogger('default', 'SugarLogger'); }
/** * Get the memcache object; initialize if needed */ protected function _getRedisObject() { try { if (!$this->_redis instanceof Redis) { $this->_redis = new Redis(); $this->_host = SugarConfig::getInstance()->get('external_cache.redis.host', $this->_host); $this->_port = SugarConfig::getInstance()->get('external_cache.redis.port', $this->_port); if (!$this->_redis->connect($this->_host, $this->_port)) { return false; } } } catch (RedisException $e) { return false; } return $this->_redis; }
function display() { $smarty = new Sugar_Smarty(); parent::display(); $db = DBManagerFactory::getInstance(); //$myquery = 'SELECT tab4.first_name fname, tab4.last_name lname, tab5.mrn_c mrn, tab4.id patid, tab5.location_c location, tab5.active_c active, ( SELECT tab1.reg_patient_reg_encounterreg_encounter_idb enclink FROM reg_patient_reg_encounter_c tab1 WHERE tab1.reg_patient_reg_encounterreg_patient_ida = patid AND tab1.date_modified = (SELECT max( date_modified ) dat FROM reg_patient_reg_encounter_c enc1 WHERE enc1.reg_patient_reg_encounterreg_patient_ida = patid) ) enclink, ( SELECT DATE_FORMAT(tab3.next_rx_refill_due_c,"%m/%d/%Y") ref1 FROM reg_encounter_cstm tab3 where tab3.id_c = enclink ) refill, ( SELECT DATE_FORMAT(tab3.last_uts_c,"%m/%d/%Y") uts1 FROM reg_encounter_cstm tab3 where tab3.id_c = enclink ) last_uts , ( SELECT DATE_FORMAT(tab3.next_uts_due_c,"%m/%d/%Y") uts11 FROM reg_encounter_cstm tab3 where tab3.id_c = enclink ) uts , (SELECT DATE_FORMAT(tab3.next_pcp_visit_c,"%m/%d/%Y") pcp11 FROM reg_encounter_cstm tab3 where tab3.id_c = enclink ) next_pcp, (SELECT p1b.name provname from reg_provider p1b, reg_provider_reg_patient_c p2b WHERE p2b.reg_provider_reg_patientreg_provider_ida = p1b.id AND p2b.reg_provider_reg_patientreg_patient_idb = patid) provname, ( SELECT risklvl_c risk1 FROM reg_encounter_cstm tab3 where tab3.id_c = enclink ) risk FROM reg_patient tab4, reg_patient_cstm tab5, reg_patient_reg_encounter_c tab1, ( SELECT max( date_modified ) dat, reg_patient_reg_encounterreg_patient_ida pat FROM reg_patient_reg_encounter_c GROUP BY reg_patient_reg_encounterreg_patient_ida) tab2, reg_encounter_cstm tab3 WHERE tab5.id_c = tab4.id AND tab1.date_modified = tab2.dat AND tab1.reg_patient_reg_encounterreg_patient_ida = tab2.pat AND tab3.id_c = tab1.reg_patient_reg_encounterreg_encounter_idb AND tab4.id = tab2.pat'; $myquery = 'SELECT tab4.first_name fname, tab4.last_name lname, tab5.mrn_c mrn, tab4.id patid, tab5.location_c location, tab5.active_c active, ( SELECT tab1.reg_patient_reg_encounterreg_encounter_idb enclink FROM reg_patient_reg_encounter_c tab1 WHERE tab1.reg_patient_reg_encounterreg_patient_ida = patid AND tab1.date_modified = (SELECT max( date_modified ) dat FROM reg_patient_reg_encounter_c enc1 WHERE enc1.reg_patient_reg_encounterreg_patient_ida = patid) ) enclink, ( SELECT DATE_FORMAT(tab3.next_rx_refill_due_c,"%m/%d/%Y") ref1 FROM reg_encounter_cstm tab3 where tab3.id_c = enclink ) refill, ( SELECT DATE_FORMAT(tab3.last_uts_c,"%m/%d/%Y") uts1 FROM reg_encounter_cstm tab3 where tab3.id_c = enclink ) last_uts , ( SELECT DATE_FORMAT(tab3.next_uts_due_c,"%m/%d/%Y") uts11 FROM reg_encounter_cstm tab3 where tab3.id_c = enclink ) uts , (SELECT DATE_FORMAT(tab3.next_pcp_visit_c,"%m/%d/%Y") pcp11 FROM reg_encounter_cstm tab3 where tab3.id_c = enclink ) next_pcp, (SELECT p1b.name provname from reg_provider p1b, reg_provider_reg_patient_c p2b WHERE p2b.reg_provider_reg_patientreg_provider_ida = p1b.id AND p2b.reg_provider_reg_patientreg_patient_idb = patid) provname, ( SELECT risklvl_c risk1 FROM reg_encounter_cstm tab3 where tab3.id_c = enclink ) risk FROM reg_patient tab4, reg_patient_cstm tab5 WHERE tab5.id_c = tab4.id '; $result = $db->query($myquery); $mydata = null; while ($row = $db->fetchRow($result)) { $mydata[] = $row; } global $cal_strings, $current_language; $cal_strings = return_module_language($current_language, 'Calendar'); if (empty($_REQUEST['view'])) { $_REQUEST['view'] = SugarConfig::getInstance()->get('calendar.default_view', 'week'); } $cal = new Calendar($_REQUEST['view']); if (in_array($cal->view, array('day', 'week', 'month'))) { $cal->add_activities($GLOBALS['current_user']); } else { if ($cal->view == 'shared') { $cal->init_shared(); global $shared_user; $shared_user = new User(); foreach ($cal->shared_ids as $member) { $shared_user->retrieve($member); $cal->add_activities($shared_user); } } } if (in_array($cal->view, array("day", "week", "month", "shared"))) { $cal->load_activities(); } if (!empty($_REQUEST['print']) && $_REQUEST['print'] == 'true') { $cal->setPrint(true); } $display = new CalendarDisplay($cal); $smarty->assign("mydata", $mydata); echo "<table><tr><td>"; $smarty->display($this->lv->tpl); echo "</td>"; echo "<td style='width:100%;vertical-align:top'>"; $caltest = new caltest(); $caltest->test(); echo "</td></tr></table>"; }
/** * getInstance() * * Create or fetch index strategy * * @static * @param string $name * @param array $config * @return ElasticIndexStrategyInterface */ public static function getInstance($strategy = '', $config = null) { $sugarConfig = SugarConfig::getInstance(); // get strategy name from $sugar_config, default to "single" if (empty($strategy)) { $strategy = $sugarConfig->get('full_text_engine.Elastic.index_strategy.name', 'single'); } if (!empty(self::$instance[$strategy])) { return self::$instance[$strategy]; } // use strategy config from $sugar_config if not set explicitly if (!is_array($config)) { $config = $sugarConfig->get('full_text_engine.Elastic.index_strategy.config', array()); } // setup instance self::$instance[$strategy] = self::setupStrategy($strategy, $config); return self::$instance[$strategy]; }
/** * Get the memcache object; initialize if needed */ protected function _getMemcacheObject() { if (!$this->_memcache instanceof Memcache) { $this->_memcache = new Memcache(); $config = SugarConfig::getInstance(); $this->_host = $config->get('external_cache.memcache.host', $this->_host); $this->_port = $config->get('external_cache.memcache.port', $this->_port); if (!@$this->_memcache->connect($this->_host, $this->_port)) { return false; } if ($config->get('external_cache.memcache.disable_compression', false)) { $this->_memcache->setCompressThreshold($config->get('external_cache.memcache.min_compression', $this->min_compress)); } else { $this->_memcache->setCompressThreshold(0); } } return $this->_memcache; }
function handleOverride($fromParseLoggerSettings = false) { global $sugar_config, $sugar_version; $sc = SugarConfig::getInstance(); $overrideArray = $this->readOverride(); $this->previous_sugar_override_config_array = $overrideArray; $diffArray = deepArrayDiff($this->config, $sugar_config); $overrideArray = sugarArrayMergeRecursive($overrideArray, $diffArray); // To remember checkbox state if (!$this->useAuthenticationClass && !$fromParseLoggerSettings) { if (isset($overrideArray['authenticationClass']) && $overrideArray['authenticationClass'] == 'SAMLAuthenticate') { unset($overrideArray['authenticationClass']); } } $overideString = "<?php\n/***CONFIGURATOR***/\n"; sugar_cache_put('sugar_config', $this->config); $GLOBALS['sugar_config'] = $this->config; //print_r($overrideArray); //Bug#53013: Clean the tpl cache if action menu style has been changed. if (isset($overrideArray['enable_action_menu']) && (!isset($this->previous_sugar_override_config_array['enable_action_menu']) || $overrideArray['enable_action_menu'] != $this->previous_sugar_override_config_array['enable_action_menu'])) { require_once 'modules/Administration/QuickRepairAndRebuild.php'; $repair = new RepairAndClear(); $repair->module_list = array(); $repair->clearTpls(); } foreach ($overrideArray as $key => $val) { if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key])) { if (strcmp("{$val}", 'true') == 0) { $val = true; $this->config[$key] = $val; } if (strcmp("{$val}", 'false') == 0) { $val = false; $this->config[$key] = false; } } $overideString .= override_value_to_string_recursive2('sugar_config', $key, $val); } $overideString .= '/***CONFIGURATOR***/'; $this->saveOverride($overideString); if (isset($this->config['logger']['level']) && $this->logger) { $this->logger->setLevel($this->config['logger']['level']); } }
/** * @param $data * @return bool */ public function run($data) { $this->job->runnable_ran = true; $this->job->runnable_data = $data; $data = json_decode($data, true); Activity::disable(); $ftsInstance = SugarSearchEngineFactory::getInstance(); $ftsInstance->setForceAsyncIndex(true); foreach ($data as $row) { /* @var $opp Opportunity */ $opp = BeanFactory::getBean('Opportunities', $row['id']); $opp->save(false); } $ftsInstance->setForceAsyncIndex(SugarConfig::getInstance()->get('search_engine.force_async_index', false)); Activity::enable(); $this->job->succeedJob(); $this->notifyAssignedUser(); return true; }
public function __construct($params = array()) { // Setup Elastica Client object $this->_config = $params; // this timeout can be overriden at $sugar_config['full_text_engine']['Elastic']['timeout'] if (empty($this->_config['timeout'])) { $this->_config['timeout'] = 15; } $this->setClient(new \Elastica\Client($this->_config)); // Setup index strategy $this->indexStrategy = SugarSearchEngineElasticIndexStrategyFactory::getinstance(); // Asynchronous indexing through fts_queue table $this->forceAsyncIndex = SugarConfig::getInstance()->get('search_engine.force_async_index', false); // Elastic mapping $mappingClass = SugarAutoLoader::customClass('SugarSearchEngineElasticMapping'); $this->mapper = new $mappingClass($this); // Facet handler $this->facetHandler = new FacetHandler(); parent::__construct(); }
/** * Notify the Assigned User that all the jobs have been completed * * @param Bool $notification Create a In-App Notification * @param Bool $email Send an Email */ protected function notifyAssignedUser($notification = true, $email = true) { if ($this->sendNotifications && $this->isJobGroupDone()) { $subject = $GLOBALS['app_strings'][$this->subjectLabel]; $body = $GLOBALS['app_strings'][$this->bodyLabel]; if ($this->includeHelpLink && !empty($this->helpModule)) { $body = $this->appendHelpLink($body); } // append the site url and then nl2br the text $site_url = SugarConfig::getInstance()->get('site_url'); $body .= "\n<a href=\"{$site_url}\">{$site_url}</a>"; $body = nl2br($body); if ($notification) { $this->createNotification($subject, $body); } if ($email) { // send an email $this->sendEmail($subject, $body); } } }
public function test() { global $cal_strings, $current_language; $cal_strings = return_module_language($current_language, 'Calendar'); if (empty($_REQUEST['view'])) { $_REQUEST['view'] = SugarConfig::getInstance()->get('calendar.default_view', 'week'); } $cal = new Calendar($_REQUEST['view']); if (in_array($cal->view, array('day', 'week', 'month'))) { $cal->add_activities($GLOBALS['current_user']); } else { if ($cal->view == 'shared') { $cal->init_shared(); global $shared_user; $shared_user = new User(); foreach ($cal->shared_ids as $member) { $shared_user->retrieve($member); $cal->add_activities($shared_user); } } } if (in_array($cal->view, array("day", "week", "month", "shared"))) { $cal->load_activities(); } if (!empty($_REQUEST['print']) && $_REQUEST['print'] == 'true') { $cal->setPrint(true); } /* $_REQUEST['year']='2014'; $_REQUEST['month']='12'; $_REQUEST['day']='8';*/ //var_dump($_REQUEST); $display = new CalendarDisplay($cal); echo "<div style='width:448px'>"; $display->display_calendar_header(false); $display->display(); echo "</div>"; }
function handleOverride($fromParseLoggerSettings = false) { global $sugar_config, $sugar_version; $sc = SugarConfig::getInstance(); $overrideArray = $this->readOverride(); $this->previous_sugar_override_config_array = $overrideArray; $diffArray = deepArrayDiff($this->config, $sugar_config); $overrideArray = sugarArrayMergeRecursive($overrideArray, $diffArray); // To remember checkbox state if (!$this->useAuthenticationClass && !$fromParseLoggerSettings) { if (isset($overrideArray['authenticationClass']) && $overrideArray['authenticationClass'] == 'SAMLAuthenticate') { unset($overrideArray['authenticationClass']); } } $overideString = "<?php\n/***CONFIGURATOR***/\n"; sugar_cache_put('sugar_config', $this->config); $GLOBALS['sugar_config'] = $this->config; //print_r($overrideArray); foreach ($overrideArray as $key => $val) { if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key])) { if (strcmp("{$val}", 'true') == 0) { $val = true; $this->config[$key] = $val; } if (strcmp("{$val}", 'false') == 0) { $val = false; $this->config[$key] = false; } } $overideString .= override_value_to_string_recursive2('sugar_config', $key, $val); } $overideString .= '/***CONFIGURATOR***/'; $this->saveOverride($overideString); if (isset($this->config['logger']['level']) && $this->logger) { $this->logger->setLevel($this->config['logger']['level']); } }
/** * Check if list limit passed to API less or greater than allowed predefined value. * If max limit is not defined it returns passed value without changes. * * @param int $limit List limit passed to API * @return int */ public function checkMaxListLimit($limit) { $maxListLimit = SugarConfig::getInstance()->get('max_list_limit'); if ($maxListLimit && ($limit < 1 || $limit > $maxListLimit)) { return $maxListLimit; } return $limit; }
/** * Called from process(). This method will display the footer on the page. */ public function displayFooter() { if (empty($this->responseTime)) { $this->_calculateFooterMetrics(); } global $sugar_config; global $app_strings; global $mod_strings; $themeObject = SugarThemeRegistry::current(); //decide whether or not to show themepicker, default is to show $showThemePicker = true; if (isset($sugar_config['showThemePicker'])) { $showThemePicker = $sugar_config['showThemePicker']; } echo "<!-- crmprint -->"; $jsalerts = new jsAlerts(); if (!isset($_SESSION['isMobile'])) { echo $jsalerts->getScript(); } $ss = new Sugar_Smarty(); $ss->assign("AUTHENTICATED", isset($_SESSION["authenticated_user_id"])); $ss->assign('MOD', return_module_language($GLOBALS['current_language'], 'Users')); $bottomLinkList = array(); if (isset($this->action) && $this->action != "EditView") { $bottomLinkList['print'] = array($app_strings['LNK_PRINT'] => getPrintLink()); } $bottomLinkList['backtotop'] = array($app_strings['LNK_BACKTOTOP'] => 'javascript:SUGAR.util.top();'); $bottomLinksStr = ""; foreach ($bottomLinkList as $key => $value) { foreach ($value as $text => $link) { $href = $link; if (substr($link, 0, 11) == "javascript:") { $onclick = " onclick=\"" . substr($link, 11) . "\""; $href = "javascript:void(0)"; } else { $onclick = ""; } $imageURL = SugarThemeRegistry::current()->getImageURL($key . '.gif'); $bottomLinksStr .= "<a href=\"{$href}\""; $bottomLinksStr .= isset($onclick) ? $onclick : ""; $bottomLinksStr .= "><img src='{$imageURL}' alt=''>"; //keeping alt blank on purpose for 508 (text will be read instead) $bottomLinksStr .= " " . $text . "</a>"; } } $ss->assign("BOTTOMLINKS", $bottomLinksStr); if (SugarConfig::getInstance()->get('calculate_response_time', false)) { $ss->assign('STATISTICS', $this->_getStatistics()); } // Under the License referenced above, you are required to leave in all copyright statements in both // the code and end-user application. $copyright = '© 2004-2012 SugarCRM Inc. The Program is provided AS IS, without warranty. Licensed under <a href="LICENSE.txt" target="_blank" class="copyRightLink">AGPLv3</a>.<br>This program is free software; you can redistribute it and/or modify it under the terms of the <br><a href="LICENSE.txt" target="_blank" class="copyRightLink"> GNU Affero General Public License version 3</a> as published by the Free Software Foundation, including the additional permission set forth in the source code header.<br>'; // The interactive user interfaces in modified source and object code // versions of this program must display Appropriate Legal Notices, as // required under Section 5 of the GNU General Public License version // 3. In accordance with Section 7(b) of the GNU General Public License // version 3, these Appropriate Legal Notices must retain the display // of the "Powered by SugarCRM" logo. If the display of the logo is // not reasonably feasible for technical reasons, the Appropriate // Legal Notices must display the words "Powered by SugarCRM". $attribLinkImg = "<img style='margin-top: 2px' border='0' width='120' height='34' src='include/images/poweredby_sugarcrm_65.png' alt='Powered By SugarCRM'>\n"; // handle resizing of the company logo correctly on the fly $companyLogoURL = $themeObject->getImageURL('company_logo.png'); $companyLogoURL_arr = explode('?', $companyLogoURL); $companyLogoURL = $companyLogoURL_arr[0]; $company_logo_attributes = sugar_cache_retrieve('company_logo_attributes'); if (!empty($company_logo_attributes)) { $ss->assign("COMPANY_LOGO_MD5", $company_logo_attributes[0]); $ss->assign("COMPANY_LOGO_WIDTH", $company_logo_attributes[1]); $ss->assign("COMPANY_LOGO_HEIGHT", $company_logo_attributes[2]); } else { // Always need to md5 the file $ss->assign("COMPANY_LOGO_MD5", md5_file($companyLogoURL)); list($width, $height) = getimagesize($companyLogoURL); if ($width > 212 || $height > 40) { $resizePctWidth = ($width - 212) / 212; $resizePctHeight = ($height - 40) / 40; if ($resizePctWidth > $resizePctHeight) { $resizeAmount = $width / 212; } else { $resizeAmount = $height / 40; } $ss->assign("COMPANY_LOGO_WIDTH", round($width * (1 / $resizeAmount))); $ss->assign("COMPANY_LOGO_HEIGHT", round($height * (1 / $resizeAmount))); } else { $ss->assign("COMPANY_LOGO_WIDTH", $width); $ss->assign("COMPANY_LOGO_HEIGHT", $height); } // Let's cache the results sugar_cache_put('company_logo_attributes', array($ss->get_template_vars("COMPANY_LOGO_MD5"), $ss->get_template_vars("COMPANY_LOGO_WIDTH"), $ss->get_template_vars("COMPANY_LOGO_HEIGHT"))); } $ss->assign("COMPANY_LOGO_URL", getJSPath($companyLogoURL) . "&logo_md5=" . $ss->get_template_vars("COMPANY_LOGO_MD5")); // Bug 38594 - Add in Trademark wording $copyright .= 'SugarCRM is a trademark of SugarCRM, Inc. All other company and product names may be trademarks of the respective companies with which they are associated.<br />'; //rrs bug: 20923 - if this image does not exist as per the license, then the proper image will be displayed regardless, so no need //to display an empty image here. if (file_exists('include/images/poweredby_sugarcrm_65.png')) { $copyright .= $attribLinkImg; } // End Required Image $ss->assign('COPYRIGHT', $copyright); // here we allocate the help link data $help_actions_blacklist = array('Login'); // we don't want to show a context help link here if (!in_array($this->action, $help_actions_blacklist)) { $url = 'javascript:void(window.open(\'index.php?module=Administration&action=SupportPortal&view=documentation&version=' . $GLOBALS['sugar_version'] . '&edition=' . $GLOBALS['sugar_flavor'] . '&lang=' . $GLOBALS['current_language'] . '&help_module=' . $this->module . '&help_action=' . $this->action . '&key=' . $GLOBALS['server_unique_key'] . '\'))'; $label = (isset($GLOBALS['app_list_strings']['moduleList'][$this->module]) ? $GLOBALS['app_list_strings']['moduleList'][$this->module] : $this->module) . ' ' . $app_strings['LNK_HELP']; $ss->assign('HELP_LINK', SugarThemeRegistry::current()->getLink($url, $label, "id='help_link_two'", 'help-dashlet.png', 'class="icon"', null, null, '', 'left')); } // end $ss->display(SugarThemeRegistry::current()->getTemplate('footer.tpl')); }
/** * load settings popup template */ protected function load_settings_template(&$ss) { list($d_start_hour, $d_start_min) = explode(":", $this->cal->day_start_time); list($d_end_hour, $d_end_min) = explode(":", $this->cal->day_end_time); require_once "include/utils.php"; global $app_strings, $app_list_strings, $beanList; global $timedate; $user_default_date_start = $timedate->asUser($timedate->getNow()); if (!isset($time_separator)) { $time_separator = ":"; } $date_format = $timedate->get_cal_date_format(); $time_format = $timedate->get_user_time_format(); $TIME_FORMAT = $time_format; $t23 = strpos($time_format, '23') !== false ? '%H' : '%I'; if (!isset($match[2]) || $match[2] == '') { $CALENDAR_FORMAT = $date_format . ' ' . $t23 . $time_separator . "%M"; } else { $pm = $match[2] == "pm" ? "%P" : "%p"; $CALENDAR_FORMAT = $date_format . ' ' . $t23 . $time_separator . "%M" . $pm; } $hours_arr = array(); $num_of_hours = 24; $start_at = 0; $TIME_MERIDIEM = ""; $time_pref = $timedate->get_time_format(); $start_m = ""; if (strpos($time_pref, 'a') || strpos($time_pref, 'A')) { $num_of_hours = 12; $start_at = 1; $start_m = 'am'; if ($d_start_hour == 0) { $d_start_hour = 12; $start_m = 'am'; } else { if ($d_start_hour == 12) { $start_m = 'pm'; } } if ($d_start_hour > 12) { $d_start_hour = $d_start_hour - 12; $start_m = 'pm'; } $end_m = 'am'; if ($d_end_hour == 0) { $d_end_hour = 12; $end_m = 'am'; } else { if ($d_end_hour == 12) { $end_m = 'pm'; } } if ($d_end_hour > 12) { $d_end_hour = $d_end_hour - 12; $end_m = 'pm'; } if (strpos($time_pref, 'A')) { $start_m = strtoupper($start_m); $end_m = strtoupper($end_m); } $options = strpos($time_pref, 'a') ? $app_list_strings['dom_meridiem_lowercase'] : $app_list_strings['dom_meridiem_uppercase']; $TIME_START_MERIDIEM = get_select_options_with_id($options, $start_m); $TIME_END_MERIDIEM = get_select_options_with_id($options, $end_m); $TIME_START_MERIDIEM = "<select id='day_start_meridiem' name='day_start_meridiem' tabindex='2'>" . $TIME_START_MERIDIEM . "</select>"; $TIME_END_MERIDIEM = "<select id='day_end_meridiem' name='day_end_meridiem' tabindex='2'>" . $TIME_END_MERIDIEM . "</select>"; } else { $TIME_START_MERIDIEM = $TIME_END_MERIDIEM = ""; } for ($i = $start_at; $i <= $num_of_hours; $i++) { $i = $i . ""; if (strlen($i) == 1) { $i = "0" . $i; } $hours_arr[$i] = $i; } $TIME_START_HOUR_OPTIONS = get_select_options_with_id($hours_arr, $d_start_hour); $TIME_START_MINUTES_OPTIONS = get_select_options_with_id(array('0' => '00', '15' => '15', '30' => '30', '45' => '45'), $d_start_min); $TIME_END_HOUR_OPTIONS = get_select_options_with_id($hours_arr, $d_end_hour); $TIME_END_MINUTES_OPTIONS = get_select_options_with_id(array('0' => '00', '15' => '15', '30' => '30', '45' => '45'), $d_end_min); $displayTimeslots = $GLOBALS['current_user']->getPreference('calendar_display_timeslots'); if (is_null($displayTimeslots)) { $displayTimeslots = SugarConfig::getInstance()->get('calendar.display_timeslots', true); } $shared_calendar_separate = $GLOBALS['current_user']->getPreference('calendar_display_shared_separate'); if (is_null($shared_calendar_separate)) { $shared_calendar_separate = SugarConfig::getInstance()->get('calendar.calendar_display_shared_separate', true); } $ss->assign('week', $_REQUEST['week']); $ss->assign('activity', $this->checkActivity($this->activity_colors)); $ss->assign('display_timeslots', $displayTimeslots); $ss->assign('shared_calendar_separate', $shared_calendar_separate); $ss->assign('show_calls', $this->cal->show_calls); $ss->assign('show_tasks', $this->cal->show_tasks); $ss->assign('show_completed', $this->cal->show_completed); $ss->assign('TIME_START_HOUR_OPTIONS', $TIME_START_HOUR_OPTIONS); $ss->assign('TIME_START_MINUTES_OPTIONS', $TIME_START_MINUTES_OPTIONS); $ss->assign('TIME_START_MERIDIEM', $TIME_START_MERIDIEM); $ss->assign('TIME_END_HOUR_OPTIONS', $TIME_END_HOUR_OPTIONS); $ss->assign('TIME_END_MINUTES_OPTIONS', $TIME_END_MINUTES_OPTIONS); $ss->assign('TIME_END_MERIDIEM', $TIME_END_MERIDIEM); }
public function tearDown() { $config = SugarConfig::getInstance(); $config->clearCache(); $GLOBALS['sugar_config'] = $this->_old_sugar_config; }