/**
  * BreadCrumbStack
  * Constructor for BreadCrumbStack that builds list of breadcrumbs using tracker table
  * 
  * @param $user_id String value of user id to get bread crumb items for
  * @param $modules mixed value of module name(s) to provide extra filtering
  */
 public function BreadCrumbStack($user_id, $modules = '')
 {
     $this->stack = array();
     $this->stackMap = array();
     $admin = Administration::getSettings('tracker');
     $this->deleteInvisible = !empty($admin->settings['tracker_Tracker']);
     $db = DBManagerFactory::getInstance();
     $module_query = '';
     if (!empty($modules)) {
         $history_max_viewed = 10;
         $module_query = is_array($modules) ? ' AND module_name IN (\'' . implode("','", $modules) . '\')' : ' AND module_name = \'' . $modules . '\'';
     } else {
         $history_max_viewed = !empty($GLOBALS['sugar_config']['history_max_viewed']) ? $GLOBALS['sugar_config']['history_max_viewed'] : 50;
     }
     $query = 'SELECT distinct item_id AS item_id, id, item_summary, module_name, monitor_id, date_modified FROM tracker WHERE user_id = \'' . $user_id . '\' AND deleted = 0 AND visible = 1 ' . $module_query . ' ORDER BY date_modified DESC';
     $result = $db->limitQuery($query, 0, $history_max_viewed);
     $items = array();
     while ($row = $db->fetchByAssoc($result)) {
         $items[] = $row;
     }
     $items = array_reverse($items);
     foreach ($items as $item) {
         $this->push($item);
     }
 }
 /**
  * Sends $info to heartbeat server
  *
  * @param $info
  * @return bool
  */
 protected function sendHeartbeat($info)
 {
     $license = Administration::getSettings('license');
     $client = $this->getClient();
     $client->sugarHome($license->settings['license_key'], $info);
     return !$client->getError();
 }
 /**
  * Creates lead records
  * @param $apiServiceBase The API class of the request, used in cases where the API changes how the fields are pulled from the args array.
  * @param $args array The arguments array passed in from the API
  * @return array properties on lead bean formatted for display
  */
 public function createLeadRecord($api, $args)
 {
     // Bug 54647 Lead registration can create empty leads
     if (!isset($args['last_name'])) {
         throw new SugarApiExceptionMissingParameter();
     }
     /**
      *
      * Bug56194: This API can be hit without logging into Sugar, but the creation of a Lead SugarBean
      * uses messages that require the use of the app strings.
      *
      **/
     global $app_list_strings;
     global $current_language;
     if (!isset($app_list_strings)) {
         $app_list_strings = return_app_list_strings_language($current_language);
     }
     $bean = BeanFactory::newBean('Leads');
     // we force team and teamset because there is no current user to get them from
     $fields = array('team_set_id' => '1', 'team_id' => '1', 'lead_source' => 'Support Portal User Registration');
     $admin = Administration::getSettings();
     if (isset($admin->settings['portal_defaultUser']) && !empty($admin->settings['portal_defaultUser'])) {
         $fields['assigned_user_id'] = json_decode(html_entity_decode($admin->settings['portal_defaultUser']));
     }
     $fieldList = array('first_name', 'last_name', 'phone_work', 'email', 'primary_address_country', 'primary_address_state', 'account_name', 'title', 'preferred_language');
     foreach ($fieldList as $fieldName) {
         if (isset($args[$fieldName])) {
             $fields[$fieldName] = $args[$fieldName];
         }
     }
     $id = $this->updateBean($bean, $api, $fields);
     return $id;
 }
Beispiel #4
0
function process_workflow_alerts(&$target_module, $alert_user_array, $alert_shell_array, $check_for_bridge = false)
{
    $admin = Administration::getSettings();
    /*
    	What is shadow module for? - Shadow module is when you are using this function to process invites for
    	meetings and calls.  This is down via child module (bridge), however we still use the parent base_module
    	to gather our recipients, since this is how our UI handles it.
    When shadow module is set, we should use that as the target module.
    */
    if (!empty($target_module->bridge_object) && $check_for_bridge == true) {
        $temp_target_module = $target_module->bridge_object;
    } else {
        $temp_target_module = $target_module;
    }
    $alert_msg = $alert_shell_array['alert_msg'];
    $address_array = array();
    $address_array['to'] = array();
    $address_array['cc'] = array();
    $address_array['bcc'] = array();
    //loop through get each users token information
    if (!empty($alert_user_array)) {
        foreach ($alert_user_array as $user_meta_array) {
            get_user_alert_details($temp_target_module, $user_meta_array, $address_array);
            //end foreach alert_user_array
        }
    }
    //now you have the bucket so you can send out the alert to all the recipients
    send_workflow_alert($target_module, $address_array, $alert_msg, $admin, $alert_shell_array, $check_for_bridge, $alert_user_array);
    //end function process_workflow_alerts
}
 /**
  * Initiate the FTS indexer.  Once initiated, all work will be done by the FTS consumers which will be invoked
  * by the job queue system.
  *
  * @param array $modules             Modules to index
  * @param bool  $deleteExistingData Remove existing index
  * @param bool  $runNow             Run indexing jobs immediately instead of placing them in job queue
  * @return SugarSearchEngineFullIndexer
  */
 public function initiateFTSIndexer(array $modules = array(), $deleteExistingData = true, $runNow = false)
 {
     $startTime = microtime(true);
     $GLOBALS['log']->info("Populating Full System Index Queue at {$startTime}");
     if (!$this->SSEngine instanceof SugarSearchEngineAbstractBase) {
         $GLOBALS['log']->info("No FTS engine enabled, not doing anything");
         return false;
     }
     $allModules = !empty($modules) ? $modules : array_keys(SugarSearchEngineMetadataHelper::retrieveFtsEnabledFieldsForAllModules());
     // Create the index on the server side
     $this->SSEngine->createIndex($deleteExistingData, $allModules);
     // Clear the existing queue
     $this->clearFTSIndexQueue($allModules);
     // clear flag
     $admin = Administration::getSettings();
     if (!empty($admin->settings['info_fts_index_done'])) {
         $admin->saveSetting('info', 'fts_index_done', 0);
     }
     $totalCount = 0;
     foreach ($allModules as $module) {
         $totalCount += $this->populateIndexQueueForModule($module, $runNow);
     }
     $totalTime = number_format(round(microtime(true) - $startTime, 2), 2);
     $this->results['totalTime'] = $totalTime;
     $GLOBALS['log']->info("Total time to populate full system index queue: {$totalTime} (s)");
     $avgRecs = $totalCount != 0 && $totalTime != 0 ? number_format(round($totalCount / $totalTime, 2), 2) : 0;
     $GLOBALS['log']->info("Total number of modules queued: {$totalCount} , modules per sec. {$avgRecs}");
     return $this;
 }
Beispiel #6
0
 function display()
 {
     $admin = Administration::getSettings();
     if (isset($admin->settings['portal_on']) && $admin->settings['portal_on']) {
         $this->ss->assign("PORTAL_ENABLED", true);
     }
     parent::display();
 }
 /**
  * Get Settings from the Config Table.
  */
 public function loadConfigArgs()
 {
     /* @var $admin Administration */
     $admin = Administration::getSettings();
     $settings = $admin->getConfigForModule('Forecasts');
     // decode and json decode the settings from the administration to set the sales stages for closed won and closed lost
     $this->setArg('sales_stage_won', $settings["sales_stage_won"]);
     $this->setArg('sales_stage_lost', $settings["sales_stage_lost"]);
 }
 /**
  * @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 = Administration::getSettings();
     $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', true, true));
     $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');
 }
 /** 
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_strings;
     $admin = Administration::getSettings();
     require 'modules/Trackers/config.php';
     ///////////////////////////////////////////////////////////////////////////////
     ////	HANDLE CHANGES
     if (isset($_POST['process'])) {
         if ($_POST['process'] == 'true') {
             foreach ($tracker_config as $entry) {
                 if (isset($entry['bean'])) {
                     //If checkbox is unchecked, we add the entry into the config table; otherwise delete it
                     if (empty($_POST[$entry['name']])) {
                         $admin->saveSetting('tracker', $entry['name'], 1);
                     } else {
                         $db = DBManagerFactory::getInstance();
                         $db->query("DELETE FROM config WHERE category = 'tracker' and name = '" . $entry['name'] . "'");
                     }
                 }
             }
             //foreach
             //save the tracker prune interval
             if (!empty($_POST['tracker_prune_interval'])) {
                 $admin->saveSetting('tracker', 'prune_interval', $_POST['tracker_prune_interval']);
             }
             //save log slow queries and slow query interval
             $configurator = new Configurator();
             $configurator->saveConfig();
         }
         //if
         header('Location: index.php?module=Administration&action=index');
     }
     echo getClassicModuleTitle("Administration", array("<a href='index.php?module=Administration&action=index'>" . translate('LBL_MODULE_NAME', 'Administration') . "</a>", translate('LBL_TRACKER_SETTINGS', 'Administration')), false);
     $trackerManager = TrackerManager::getInstance();
     $disabledMonitors = $trackerManager->getDisabledMonitors();
     $trackerEntries = array();
     foreach ($tracker_config as $entry) {
         if (isset($entry['bean'])) {
             $disabled = !empty($disabledMonitors[$entry['name']]);
             $trackerEntries[$entry['name']] = array('label' => $mod_strings['LBL_' . strtoupper($entry['name']) . '_DESC'], 'helpLabel' => $mod_strings['LBL_' . strtoupper($entry['name']) . '_HELP'], 'disabled' => $disabled);
         }
     }
     $configurator = new Configurator();
     $this->ss->assign('config', $configurator->config);
     $config_strings = return_module_language($GLOBALS['current_language'], 'Configurator');
     $mod_strings['LOG_SLOW_QUERIES'] = $config_strings['LOG_SLOW_QUERIES'];
     $mod_strings['SLOW_QUERY_TIME_MSEC'] = $config_strings['SLOW_QUERY_TIME_MSEC'];
     $this->ss->assign('mod', $mod_strings);
     $this->ss->assign('app', $app_strings);
     $this->ss->assign('trackerEntries', $trackerEntries);
     $this->ss->assign('tracker_prune_interval', !empty($admin->settings['tracker_prune_interval']) ? $admin->settings['tracker_prune_interval'] : 30);
     $this->ss->display('modules/Trackers/tpls/TrackerSettings.tpl');
 }
 /**
  * After the notification is displayed, clear the fts flags
  * @return null
  */
 protected function clearFTSFlags()
 {
     if (is_admin($GLOBALS['current_user'])) {
         $admin = Administration::getSettings();
         if (!empty($settings->settings['info_fts_index_done'])) {
             $admin->saveSetting('info', 'fts_index_done', 0);
         }
         // remove notification disabled notification
         $cfg = new Configurator();
         $cfg->config['fts_disable_notification'] = false;
         $cfg->handleOverride();
     }
 }
Beispiel #11
0
 /**
  * setup
  * This is a private method used to load the configuration settings whereby
  * monitors may be disabled via the Admin settings interface
  *
  */
 private function setup($skip_setup = false)
 {
     if (!empty($this->metadata) && empty($GLOBALS['installing']) && empty($skip_setup)) {
         $admin = Administration::getSettings('tracker');
         foreach ($this->metadata as $key => $entry) {
             if (isset($entry['bean'])) {
                 if (!empty($admin->settings['tracker_' . $entry['name']])) {
                     $this->disabledMonitors[$entry['name']] = true;
                 }
             }
         }
     }
 }
Beispiel #12
0
 /**
  * Sets the proxy options
  * @param array $curlOptions
  * @return array $curlOptions
  */
 public function setProxyOptions($curlOptions)
 {
     //detects if the sugar proxy setting is on
     //if yes we need to append it to the curlOptions
     /* CURL SET PROXY CONFIG USING SUGAR SYSTEM SETTINGS */
     $proxy_config = Administration::getSettings('proxy');
     if (!empty($proxy_config) && !empty($proxy_config->settings['proxy_on']) && $proxy_config->settings['proxy_on'] === 1) {
         $curlOptions[CURLOPT_PROXY] = $proxy_config->settings['proxy_host'];
         $curlOptions[CURLOPT_PROXYPORT] = $proxy_config->settings['proxy_port'];
         if (!empty($proxy_settings['proxy_auth'])) {
             $curlOptions[CURLOPT_PROXYUSERPWD] = $proxy_settings['proxy_username'] . ':' . $proxy_settings['proxy_password'];
         }
     }
     return $curlOptions;
 }
 /**
  * This function loads portal config vars from db and sets them for the view
  * @see SugarView::display() for more info
  */
 function display()
 {
     $portalFields = array('appStatus' => 'offline', 'logoURL' => '', 'maxQueryResult' => '20', 'maxSearchQueryResult' => '5', 'defaultUser' => '');
     $userList = get_user_array();
     $userList[''] = '';
     require_once "modules/MySettings/TabController.php";
     $controller = new TabController();
     $disabledModulesFlag = false;
     $disabledModules = array_diff($controller->getAllPortalTabs(), $controller->getPortalTabs());
     if (!empty($disabledModules)) {
         $disabledModulesFlag = true;
         array_walk($disabledModules, function (&$item) {
             $item = translate($item);
         });
     }
     $admin = Administration::getSettings();
     $portalConfig = $admin->getConfigForModule('portal', 'support', true);
     $portalConfig['appStatus'] = !empty($portalConfig['on']) ? 'online' : 'offline';
     $smarty = new Sugar_Smarty();
     $smarty->assign('disabledDisplayModulesList', $disabledModules);
     $smarty->assign('disabledDisplayModules', $disabledModulesFlag);
     foreach ($portalFields as $fieldName => $fieldDefault) {
         if (isset($portalConfig[$fieldName])) {
             $smarty->assign($fieldName, html_entity_decode($portalConfig[$fieldName]));
         } else {
             $smarty->assign($fieldName, $fieldDefault);
         }
     }
     $smarty->assign('userList', $userList);
     $smarty->assign('welcome', $GLOBALS['mod_strings']['LBL_SYNCP_WELCOME']);
     $smarty->assign('mod', $GLOBALS['mod_strings']);
     $smarty->assign('siteURL', $GLOBALS['sugar_config']['site_url']);
     if (isset($_REQUEST['label'])) {
         $smarty->assign('label', $_REQUEST['label']);
     }
     $options = !empty($GLOBALS['system_config']->settings['system_portal_url']) ? $GLOBALS['system_config']->settings['system_portal_url'] : 'https://';
     $smarty->assign('options', $options);
     $ajax = new AjaxCompose();
     $ajax->addCrumb(translate('LBL_SUGARPORTAL', 'ModuleBuilder'), 'ModuleBuilder.main("sugarportal")');
     $ajax->addCrumb(ucwords(translate('LBL_PORTAL_CONFIGURE')), '');
     $ajax->addSection('center', translate('LBL_SUGARPORTAL', 'ModuleBuilder'), $smarty->fetch('modules/ModuleBuilder/tpls/portalconfig.tpl'));
     $GLOBALS['log']->debug($smarty->fetch('modules/ModuleBuilder/tpls/portalconfig.tpl'));
     echo $ajax->getJavascript();
 }
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings;
     global $app_list_strings;
     global $app_strings;
     global $current_user;
     echo $this->getModuleTitle(false);
     global $currentModule, $sugar_config;
     $focus = Administration::getSettings();
     //retrieve all admin settings.
     $GLOBALS['log']->info("Mass Emailer(EmailMan) ConfigureSettings view");
     $this->ss->assign("MOD", $mod_strings);
     $this->ss->assign("APP", $app_strings);
     $this->ss->assign("THEME", SugarThemeRegistry::current()->__toString());
     $this->ss->assign("RETURN_MODULE", "Administration");
     $this->ss->assign("RETURN_ACTION", "index");
     $this->ss->assign("MODULE", $currentModule);
     $this->ss->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
     if (isset($focus->settings['massemailer_campaign_emails_per_run']) && !empty($focus->settings['massemailer_campaign_emails_per_run'])) {
         $this->ss->assign("EMAILS_PER_RUN", $focus->settings['massemailer_campaign_emails_per_run']);
     } else {
         $this->ss->assign("EMAILS_PER_RUN", 500);
     }
     if (!isset($focus->settings['massemailer_tracking_entities_location_type']) or empty($focus->settings['massemailer_tracking_entities_location_type']) or $focus->settings['massemailer_tracking_entities_location_type'] == '1') {
         $this->ss->assign("default_checked", "checked");
         $this->ss->assign("TRACKING_ENTRIES_LOCATION_STATE", "disabled");
         $this->ss->assign("TRACKING_ENTRIES_LOCATION", $mod_strings['TRACKING_ENTRIES_LOCATION_DEFAULT_VALUE']);
     } else {
         $this->ss->assign("userdefined_checked", "checked");
         $this->ss->assign("TRACKING_ENTRIES_LOCATION", $focus->settings["massemailer_tracking_entities_location"]);
     }
     $this->ss->assign("SITEURL", $sugar_config['site_url']);
     // Change the default campaign to not store a copy of each message.
     if (!empty($focus->settings['massemailer_email_copy']) and $focus->settings['massemailer_email_copy'] == '1') {
         $this->ss->assign("yes_checked", "checked='checked'");
     } else {
         $this->ss->assign("no_checked", "checked='checked'");
     }
     $email = BeanFactory::getBean('Emails');
     $this->ss->assign('ROLLOVER', $email->rolloverStyle);
     $this->ss->assign("JAVASCRIPT", get_validate_record_js());
     $this->ss->display("modules/EmailMan/tpls/campaignconfig.tpl");
 }
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     require_once 'modules/Home/UnifiedSearchAdvanced.php';
     $usa = new UnifiedSearchAdvanced();
     global $mod_strings, $app_strings, $app_list_strings, $current_user;
     $sugar_smarty = new Sugar_Smarty();
     $sugar_smarty->assign('APP', $app_strings);
     $sugar_smarty->assign('MOD', $mod_strings);
     $sugar_smarty->assign('moduleTitle', $this->getModuleTitle(false));
     $modules = $usa->retrieveEnabledAndDisabledModules();
     $sugar_smarty->assign('enabled_modules', json_encode($modules['enabled']));
     $sugar_smarty->assign('disabled_modules', json_encode($modules['disabled']));
     $defaultEngine = SugarSearchEngineFactory::getFTSEngineNameFromConfig();
     $config = $GLOBALS['sugar_config']['full_text_engine'][$defaultEngine];
     $justRequestedAScheduledIndex = !empty($_REQUEST['sched']) ? true : false;
     $hide_fts_config = isset($GLOBALS['sugar_config']['hide_full_text_engine_config']) ? $GLOBALS['sugar_config']['hide_full_text_engine_config'] : false;
     $showSchedButton = $defaultEngine != '' && $this->isFTSConnectionValid() ? true : false;
     $sugar_smarty->assign("showSchedButton", $showSchedButton);
     $sugar_smarty->assign("hide_fts_config", $hide_fts_config);
     $sugar_smarty->assign("fts_type", get_select_options_with_id($app_list_strings['fts_type'], $defaultEngine));
     $sugar_smarty->assign("fts_host", $config['host']);
     $sugar_smarty->assign("fts_port", $config['port']);
     $sugar_smarty->assign("fts_scheduled", !empty($schedulerID) && !$schedulerCompleted);
     $sugar_smarty->assign('justRequestedAScheduledIndex', $justRequestedAScheduledIndex);
     //End FTS
     if (is_admin($current_user)) {
         if (!empty($GLOBALS['sugar_config']['fts_disable_notification'])) {
             displayAdminError(translate('LBL_FTS_DISABLED', 'Administration'));
         }
         // if fts indexing is done, show the notification to admin
         $admin = Administration::getSettings();
         if (!empty($admin->settings['info_fts_index_done'])) {
             displayAdminError(translate('LBL_FTS_INDEXING_DONE', 'Administration'));
             // reset flag
             $admin->saveSetting('info', 'fts_index_done', 0);
         }
     }
     echo $sugar_smarty->fetch(SugarAutoLoader::existingCustomOne('modules/Administration/templates/GlobalSearchSettings.tpl'));
 }
 /**
  * Migrates portal tab settings previously stored as:
  * `category` = 'portal', `platform` = 'support', `name` = 'displayModules'
  * to:
  * `category` = 'MySettings', `platform` = 'portal', `name` = 'tab'
  */
 public function updatePortalTabsSetting()
 {
     $admin = Administration::getSettings();
     $portalConfig = $admin->getConfigForModule('portal', 'support', true);
     if (empty($portalConfig['displayModules'])) {
         return;
     }
     // If Home does not exist we push Home in front of the array
     if (!in_array('Home', $portalConfig['displayModules'])) {
         array_unshift($portalConfig['displayModules'], 'Home');
     }
     if ($admin->saveSetting('MySettings', 'tab', json_encode($portalConfig['displayModules']), 'portal')) {
         // Remove old config setting `displayModules`
         $query = "DELETE FROM config WHERE category='portal' AND platform='support' AND name='displayModules'";
         $this->db->query($query);
     } else {
         $log = 'Error upgrading portal config var displayModules, ';
         $log .= 'orig: ' . $portalConfig['displayModules'] . ', ';
         $log .= 'json:' . json_encode($portalConfig['displayModules']);
         $this->log($log);
     }
 }
Beispiel #17
0
 /**
  * @see SugarView::display()
  *
  * We are overridding the display method to manipulate the sectionPanels.
  * If portal is not enabled then don't show the Portal Information panel.
  */
 public function display()
 {
     $this->ev->process();
     if (!empty($_REQUEST['contact_name']) && !empty($_REQUEST['contact_id']) && $this->ev->fieldDefs['report_to_name']['value'] == '' && $this->ev->fieldDefs['reports_to_id']['value'] == '') {
         $this->ev->fieldDefs['report_to_name']['value'] = $_REQUEST['contact_name'];
         $this->ev->fieldDefs['reports_to_id']['value'] = $_REQUEST['contact_id'];
     }
     $admin = Administration::getSettings();
     if (empty($admin->settings['portal_on']) || !$admin->settings['portal_on']) {
         unset($this->ev->sectionPanels[strtoupper('lbl_portal_information')]);
     } else {
         if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
             $this->ev->fieldDefs['portal_name']['value'] = '';
             $this->ev->fieldDefs['portal_active']['value'] = '0';
             $this->ev->fieldDefs['portal_password']['value'] = '';
             $this->ev->fieldDefs['portal_password1']['value'] = '';
             $this->ev->fieldDefs['portal_name_verified'] = '0';
             $this->ev->focus->portal_name = '';
             $this->ev->focus->portal_password = '';
             $this->ev->focus->portal_acitve = 0;
         } else {
             if (!empty($this->ev->fieldDefs['portal_password']['value'])) {
                 $this->ev->fieldDefs['portal_password']['value'] = 'value_setvalue_setvalue_set';
                 $this->ev->fieldDefs['portal_password1']['value'] = 'value_setvalue_setvalue_set';
             } else {
                 $this->ev->fieldDefs['portal_password']['value'] = '';
                 $this->ev->fieldDefs['portal_password1']['value'] = '';
             }
         }
         echo getVersionedScript('modules/Contacts/Contact.js');
         echo '<script language="javascript">';
         echo 'addToValidateComparison(\'EditView\', \'portal_password\', \'varchar\', false, SUGAR.language.get(\'app_strings\', \'ERR_SQS_NO_MATCH_FIELD\') + SUGAR.language.get(\'Contacts\', \'LBL_PORTAL_PASSWORD\'), \'portal_password1\');';
         echo 'addToValidateVerified(\'EditView\', \'portal_name_verified\', \'bool\', false, SUGAR.language.get(\'app_strings\', \'ERR_EXISTING_PORTAL_USERNAME\'));';
         echo 'YAHOO.util.Event.onDOMReady(function() {YAHOO.util.Event.on(\'portal_name\', \'blur\', validatePortalName);YAHOO.util.Event.on(\'portal_name\', \'keydown\', handleKeyDown);});';
         echo '</script>';
     }
     echo $this->ev->display($this->showTitle);
 }
Beispiel #18
0
 /**
  * main method that runs reminding process
  * @return boolean
  */
 public function process()
 {
     $admin = Administration::getSettings();
     $meetings = $this->getMeetingsForRemind();
     foreach ($meetings as $id) {
         $recipients = $this->getRecipients($id, 'Meetings');
         $bean = BeanFactory::getBean('Meetings', $id);
         if ($this->sendReminders($bean, $admin, $recipients)) {
             $bean->email_reminder_sent = 1;
             $bean->save();
         }
     }
     $calls = $this->getCallsForRemind();
     foreach ($calls as $id) {
         $recipients = $this->getRecipients($id, 'Calls');
         $bean = BeanFactory::getBean('Calls', $id);
         if ($this->sendReminders($bean, $admin, $recipients)) {
             $bean->email_reminder_sent = 1;
             $bean->save();
         }
     }
     return true;
 }
Beispiel #19
0
 function action_saveadminwizard()
 {
     global $current_user;
     if (!is_admin($current_user)) {
         sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
     }
     $focus = Administration::getSettings();
     $focus->saveConfig();
     $configurator = new Configurator();
     $configurator->populateFromPost();
     $configurator->handleOverride();
     $configurator->parseLoggerSettings();
     $configurator->saveConfig();
     // Bug 37310 - Delete any existing currency that matches the one we've just set the default to during the admin wizard
     $currency = BeanFactory::getBean('Currencies');
     $currency->retrieve_id_by_name($_REQUEST['default_currency_name']);
     if (!empty($currency->id) && $currency->symbol == $_REQUEST['default_currency_symbol'] && $currency->iso4217 == $_REQUEST['default_currency_iso4217']) {
         $currency->deleted = 1;
         $currency->save();
     }
     SugarApplication::redirect('index.php?module=Users&action=Wizard&skipwelcome=1');
 }
Beispiel #20
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings;
     global $app_list_strings;
     global $app_strings;
     global $current_user;
     global $sugar_config;
     echo $this->getModuleTitle(false);
     global $currentModule;
     $focus = Administration::getSettings();
     //retrieve all admin settings.
     $GLOBALS['log']->info("Mass Emailer(EmailMan) ConfigureSettings view");
     $this->ss->assign("MOD", $mod_strings);
     $this->ss->assign("APP", $app_strings);
     $this->ss->assign("RETURN_MODULE", "Administration");
     $this->ss->assign("RETURN_ACTION", "index");
     $this->ss->assign("MODULE", $currentModule);
     $this->ss->assign("PRINT_URL", "index.php?" . $GLOBALS['request_string']);
     $this->ss->assign("HEADER", get_module_title("EmailMan", "{MOD.LBL_CONFIGURE_SETTINGS}", true));
     $this->ss->assign("notify_fromaddress", $focus->settings['notify_fromaddress']);
     $this->ss->assign("notify_send_from_assigning_user", isset($focus->settings['notify_send_from_assigning_user']) && !empty($focus->settings['notify_send_from_assigning_user']) ? "checked='checked'" : "");
     $this->ss->assign("notify_on", $focus->settings['notify_on'] ? "checked='checked'" : "");
     $this->ss->assign("notify_fromname", $focus->settings['notify_fromname']);
     $this->ss->assign("notify_allow_default_outbound_on", !empty($focus->settings['notify_allow_default_outbound']) && $focus->settings['notify_allow_default_outbound'] ? "checked='checked'" : "");
     $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_smtpauth_req", $focus->settings['mail_smtpauth_req'] ? "checked='checked'" : "");
     $this->ss->assign("mail_haspass", empty($focus->settings['mail_smtppass']) ? 0 : 1);
     $this->ss->assign("MAIL_SSL_OPTIONS", get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
     //Assign the current users email for the test send dialogue.
     $this->ss->assign("CURRENT_USER_EMAIL", $current_user->email1);
     $showSendMail = FALSE;
     $outboundSendTypeCSSClass = "yui-hidden";
     if (isset($sugar_config['allow_sendmail_outbound']) && $sugar_config['allow_sendmail_outbound']) {
         $showSendMail = TRUE;
         $app_list_strings['notifymail_sendtype']['sendmail'] = 'sendmail';
         $outboundSendTypeCSSClass = "";
     }
     $this->ss->assign("OUTBOUND_TYPE_CLASS", $outboundSendTypeCSSClass);
     $this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
     ///////////////////////////////////////////////////////////////////////////////
     ////	USER EMAIL DEFAULTS
     // editors
     $editors = $app_list_strings['dom_email_editor_option'];
     $newEditors = array();
     foreach ($editors as $k => $v) {
         if ($k != "") {
             $newEditors[$k] = $v;
         }
     }
     // preserve attachments
     $preserveAttachments = '';
     if (isset($sugar_config['email_default_delete_attachments']) && $sugar_config['email_default_delete_attachments'] == true) {
         $preserveAttachments = 'CHECKED';
     }
     $this->ss->assign('DEFAULT_EMAIL_DELETE_ATTACHMENTS', $preserveAttachments);
     ////	END USER EMAIL DEFAULTS
     ///////////////////////////////////////////////////////////////////////////////
     //setting to manage.
     //emails_per_run
     //tracking_entities_location_type default or custom
     //tracking_entities_location http://www.sugarcrm.com/track/
     //////////////////////////////////////////////////////////////////////////////
     ////	EMAIL SECURITY
     if (!isset($sugar_config['email_xss']) || empty($sugar_config['email_xss'])) {
         $sugar_config['email_xss'] = getDefaultXssTags();
     }
     foreach (unserialize(base64_decode($sugar_config['email_xss'])) as $k => $v) {
         $this->ss->assign($k . "Checked", 'CHECKED');
     }
     ////	END EMAIL SECURITY
     ///////////////////////////////////////////////////////////////////////////////
     require_once 'modules/Emails/Email.php';
     $email = BeanFactory::getBean('Emails');
     $this->ss->assign('ROLLOVER', $email->rolloverStyle);
     $this->ss->assign('THEME', $GLOBALS['theme']);
     $this->ss->assign("JAVASCRIPT", get_validate_record_js());
     $this->ss->display('modules/EmailMan/tpls/config.tpl');
 }
Beispiel #21
0
    function display()
    {
        global $current_user, $app_list_strings;
        //lets set the return values
        if (isset($_REQUEST['return_module'])) {
            $this->ss->assign('RETURN_MODULE', $_REQUEST['return_module']);
        }
        $this->ss->assign('IS_ADMIN', $current_user->is_admin ? true : false);
        //make sure we can populate user type dropdown.  This usually gets populated in predisplay unless this is a quickeditform
        if (!isset($this->fieldHelper)) {
            $this->fieldHelper = UserViewHelper::create($this->ss, $this->bean, 'EditView');
            $this->fieldHelper->setupAdditionalFields();
        }
        if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
            $this->ss->assign('RETURN_MODULE', $_REQUEST['return_module']);
            $this->ss->assign('RETURN_ACTION', $_REQUEST['return_action']);
            $this->ss->assign('RETURN_ID', $_REQUEST['record']);
            $this->bean->id = "";
            $this->bean->user_name = "";
            $this->ss->assign('ID', '');
        } else {
            if (isset($_REQUEST['return_module'])) {
                $this->ss->assign('RETURN_MODULE', $_REQUEST['return_module']);
            } else {
                $this->ss->assign('RETURN_MODULE', $this->bean->module_dir);
            }
            $return_id = isset($_REQUEST['return_id']) ? $_REQUEST['return_id'] : $this->bean->id;
            if (isset($return_id)) {
                $return_action = isset($_REQUEST['return_action']) ? $_REQUEST['return_action'] : 'DetailView';
                $this->ss->assign('RETURN_ID', $return_id);
                $this->ss->assign('RETURN_ACTION', $return_action);
            }
        }
        ///////////////////////////////////////////////////////////////////////////////
        ////	REDIRECTS FROM COMPOSE EMAIL SCREEN
        if (isset($_REQUEST['type']) && (isset($_REQUEST['return_module']) && $_REQUEST['return_module'] == 'Emails')) {
            $this->ss->assign('REDIRECT_EMAILS_TYPE', $_REQUEST['type']);
        }
        ////	END REDIRECTS FROM COMPOSE EMAIL SCREEN
        ///////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////
        ////	NEW USER CREATION ONLY
        if (empty($this->bean->id)) {
            $this->ss->assign('SHOW_ADMIN_CHECKBOX', 'height="30"');
            $this->ss->assign('NEW_USER', '1');
        } else {
            $this->ss->assign('NEW_USER', '0');
            $this->ss->assign('NEW_USER_TYPE', 'DISABLED');
            $this->ss->assign('REASSIGN_JS', "return confirmReassignRecords();");
        }
        ////	END NEW USER CREATION ONLY
        ///////////////////////////////////////////////////////////////////////////////
        global $sugar_flavor;
        $admin = Administration::getSettings();
        if (isset($sugar_flavor) && $sugar_flavor != null && ($sugar_flavor == 'CE' || isset($admin->settings['license_enforce_user_limit']) && $admin->settings['license_enforce_user_limit'] == 1)) {
            if (empty($this->bean->id)) {
                $license_users = $admin->settings['license_users'];
                if ($license_users != '') {
                    $license_seats_needed = count(get_user_array(false, "", "", false, null, " AND " . User::getLicensedUsersWhere(), false)) - $license_users;
                } else {
                    $license_seats_needed = -1;
                }
                if ($license_seats_needed >= 0) {
                    displayAdminError(translate('WARN_LICENSE_SEATS_USER_CREATE', 'Administration') . translate('WARN_LICENSE_SEATS2', 'Administration'));
                    if (isset($_SESSION['license_seats_needed'])) {
                        unset($_SESSION['license_seats_needed']);
                    }
                    //die();
                }
            }
        }
        // FIXME: Translate error prefix
        if (isset($_REQUEST['error_string'])) {
            $this->ss->assign('ERROR_STRING', '<span class="error">Error: ' . $_REQUEST['error_string'] . '</span>');
        }
        if (isset($_REQUEST['error_password'])) {
            $this->ss->assign('ERROR_PASSWORD', '<span id="error_pwd" class="error">Error: ' . $_REQUEST['error_password'] . '</span>');
        }
        // Build viewable versions of a few fields for non-admins
        if (!empty($this->bean->id)) {
            if (!empty($this->bean->status)) {
                $this->ss->assign('STATUS_READONLY', $app_list_strings['user_status_dom'][$this->bean->status]);
            }
            if (!empty($this->bean->employee_status)) {
                $this->ss->assign('EMPLOYEE_STATUS_READONLY', $app_list_strings['employee_status_dom'][$this->bean->employee_status]);
            }
            if (!empty($this->bean->reports_to_id)) {
                $reportsToUserField = "<input type='text' name='reports_to_name' id='reports_to_name' value='{$this->bean->reports_to_name}' disabled>\n";
                $reportsToUserField .= "<input type='hidden' name='reports_to_id' id='reports_to_id' value='{$this->bean->reports_to_id}'>";
                $this->ss->assign('REPORTS_TO_READONLY', $reportsToUserField);
            }
            if (!empty($this->bean->title)) {
                $this->ss->assign('TITLE_READONLY', $this->bean->title);
            }
            if (!empty($this->bean->department)) {
                $this->ss->assign('DEPT_READONLY', $this->bean->department);
            }
        }
        $processSpecial = false;
        $processFormName = '';
        if (isset($this->fieldHelper->usertype) && ($this->fieldHelper->usertype == 'GROUP' || $this->fieldHelper->usertype == 'PORTAL_ONLY')) {
            $this->ev->formName = 'EditViewGroup';
            $processSpecial = true;
            $processFormName = 'EditViewGroup';
        }
        //Bug#51609 Replace {php} code block in EditViewHeader.tpl
        $action_button = array();
        $APP = $this->ss->get_template_vars('APP');
        $PWDSETTINGS = $this->ss->get_template_vars('PWDSETTINGS');
        $REGEX = $this->ss->get_template_vars('REGEX');
        $CHOOSER_SCRIPT = $this->ss->get_template_vars('CHOOSER_SCRIPT');
        $REASSIGN_JS = $this->ss->get_template_vars('REASSIGN_JS');
        $RETURN_ACTION = $this->ss->get_template_vars('RETURN_ACTION');
        $RETURN_MODULE = $this->ss->get_template_vars('RETURN_MODULE');
        $RETURN_ID = $this->ss->get_template_vars('RETURN_ID');
        $minpwdlength = !empty($PWDSETTINGS['minpwdlength']) ? $PWDSETTINGS['minpwdlength'] : '';
        $maxpwdlength = !empty($PWDSETTINGS['maxpwdlength']) ? $PWDSETTINGS['maxpwdlength'] : '';
        $action_button_header[] = <<<EOD
                    <input type="button" id="SAVE_HEADER" title="{$APP['LBL_SAVE_BUTTON_TITLE']}" accessKey="{$APP['LBL_SAVE_BUTTON_KEY']}"
                          class="button primary" onclick="var _form = \$('#EditView')[0]; if (!set_password(_form,newrules('{$minpwdlength}','{$maxpwdlength}','{$REGEX}'))) return false; if (!Admin_check()) return false; _form.action.value='Save'; {$CHOOSER_SCRIPT} {$REASSIGN_JS} if(verify_data(EditView)) _form.submit();"
                          name="button" value="{$APP['LBL_SAVE_BUTTON_LABEL']}">
EOD;
        $action_button_header[] = <<<EOD
                    <input\ttitle="{$APP['LBL_CANCEL_BUTTON_TITLE']}" id="CANCEL_HEADER" accessKey="{$APP['LBL_CANCEL_BUTTON_KEY']}"
                              class="button" onclick="var _form = \$('#EditView')[0]; _form.action.value='{$RETURN_ACTION}'; _form.module.value='{$RETURN_MODULE}'; _form.record.value='{$RETURN_ID}'; _form.submit()"
                              type="button" name="button" value="{$APP['LBL_CANCEL_BUTTON_LABEL']}">
EOD;
        $action_button_header = array_merge($action_button_header, $this->ss->get_template_vars('BUTTONS_HEADER'));
        $this->ss->assign('ACTION_BUTTON_HEADER', $action_button_header);
        $action_button_footer[] = <<<EOD
                    <input type="button" id="SAVE_FOOTER" title="{$APP['LBL_SAVE_BUTTON_TITLE']}" accessKey="{$APP['LBL_SAVE_BUTTON_KEY']}"
                          class="button primary" onclick="var _form = \$('#EditView')[0]; if (!set_password(_form,newrules('{$minpwdlength}','{$maxpwdlength}','{$REGEX}'))) return false; if (!Admin_check()) return false; _form.action.value='Save'; {$CHOOSER_SCRIPT} {$REASSIGN_JS} if(verify_data(EditView)) _form.submit();"
                          name="button" value="{$APP['LBL_SAVE_BUTTON_LABEL']}">
EOD;
        $action_button_footer[] = <<<EOD
                    <input\ttitle="{$APP['LBL_CANCEL_BUTTON_TITLE']}" id="CANCEL_FOOTER" accessKey="{$APP['LBL_CANCEL_BUTTON_KEY']}"
                              class="button" onclick="var _form = \$('#EditView')[0]; _form.action.value='{$RETURN_ACTION}'; _form.module.value='{$RETURN_MODULE}'; _form.record.value='{$RETURN_ID}'; _form.submit()"
                              type="button" name="button" value="{$APP['LBL_CANCEL_BUTTON_LABEL']}">
EOD;
        $action_button_footer = array_merge($action_button_footer, $this->ss->get_template_vars('BUTTONS_FOOTER'));
        $this->ss->assign('ACTION_BUTTON_FOOTER', $action_button_footer);
        //if the request object has 'scrolltocal' set, then we are coming here from the tour window box and need to set flag to true
        // so that footer.tpl fires off script to scroll to calendar section
        if (!empty($_REQUEST['scrollToCal'])) {
            $this->ss->assign('scroll_to_cal', true);
        }
        $this->ev->process($processSpecial, $processFormName);
        echo $this->ev->display($this->showTitle);
    }
Beispiel #22
0
 /**
  *  Determine if the user is allowed to use the current system outbound connection.
  */
 function isAllowUserAccessToSystemDefaultOutbound()
 {
     $allowAccess = FALSE;
     // first check that a system default exists
     $q = "SELECT id FROM outbound_email WHERE type = 'system'";
     $r = $this->db->query($q);
     $a = $this->db->fetchByAssoc($r);
     if (!empty($a)) {
         // next see if the admin preference for using the system outbound is set
         $admin = Administration::getSettings('', TRUE);
         if (isset($admin->settings['notify_allow_default_outbound']) && $admin->settings['notify_allow_default_outbound'] == 2) {
             $allowAccess = TRUE;
         }
     }
     return $allowAccess;
 }
Beispiel #23
0
 function canAddUser($user_id)
 {
     $admin = Administration::getSettings('system');
     if (!isset($admin->settings['system_oc_active']) || $admin->settings['system_oc_active'] != 'true') {
         $user = BeanFactory::getBean('Users', $user_id);
         $status = $user->getPreference('OfflineClientStatus');
         return $status == 'Active';
     } else {
         return true;
     }
 }
Beispiel #24
0
 function save($check_notify = false)
 {
     $isUpdate = !empty($this->id) && !$this->new_with_id;
     // this will cause the logged in admin to have the licensed user count refreshed
     if (isset($_SESSION)) {
         unset($_SESSION['license_seats_needed']);
     }
     $query = "SELECT count(id) as total from users WHERE " . self::getLicensedUsersWhere();
     global $sugar_flavor;
     $admin = Administration::getSettings();
     if (isset($sugar_flavor) && $sugar_flavor != null && ($sugar_flavor == 'CE' || isset($admin->settings['license_enforce_user_limit']) && $admin->settings['license_enforce_user_limit'] == 1)) {
         // Begin Express License Enforcement Check
         // this will cause the logged in admin to have the licensed user count refreshed
         if (isset($_SESSION['license_seats_needed'])) {
             unset($_SESSION['license_seats_needed']);
         }
         if ($this->portal_only != 1 && $this->is_group != 1 && (empty($this->fetched_row) || $this->fetched_row['status'] == 'Inactive' || $this->fetched_row['status'] == '') && $this->status == 'Active') {
             global $sugar_flavor;
             //if((isset($sugar_flavor) && $sugar_flavor != null) && ($sugar_flavor=='CE')){
             $license_users = $admin->settings['license_users'];
             if ($license_users != '') {
                 global $db;
                 //$query = "SELECT count(id) as total from users WHERE status='Active' AND deleted=0 AND is_group=0 AND portal_only=0";
                 $result = $db->query($query, true, "Error filling in user array: ");
                 $row = $db->fetchByAssoc($result);
                 $license_seats_needed = $row['total'] - $license_users;
             } else {
                 $license_seats_needed = -1;
             }
             if ($license_seats_needed >= 0) {
                 // displayAdminError( translate('WARN_LICENSE_SEATS_MAXED', 'Administration'). ($license_seats_needed + 1) . translate('WARN_LICENSE_SEATS2', 'Administration')  );
                 if (isset($_REQUEST['action']) && $_REQUEST['action'] != 'MassUpdate' && $_REQUEST['action'] != 'Save') {
                     die(translate('WARN_LICENSE_SEATS_EDIT_USER', 'Administration') . ' ' . translate('WARN_LICENSE_SEATS2', 'Administration'));
                 } else {
                     if (isset($_REQUEST['action'])) {
                         // When this is not set, we're coming from the installer.
                         $sv = new SugarView();
                         $sv->init('Users');
                         $sv->renderJavascript();
                         $sv->displayHeader();
                         $sv->errors[] = translate('WARN_LICENSE_SEATS_EDIT_USER', 'Administration') . ' ' . translate('WARN_LICENSE_SEATS2', 'Administration');
                         $sv->displayErrors();
                         $sv->displayFooter();
                         die;
                     }
                 }
             }
             //}
         }
     }
     // End Express License Enforcement Check
     // wp: do not save user_preferences in this table, see user_preferences module
     $this->user_preferences = '';
     // if this is an admin user, do not allow is_group or portal_only flag to be set.
     if ($this->is_admin) {
         $this->is_group = 0;
         $this->portal_only = 0;
     }
     // set some default preferences when creating a new user
     $setNewUserPreferences = empty($this->id) || !empty($this->new_with_id);
     // If the 'Primary' team changed then the team widget has set 'team_id' to a new value and we should
     // assign the same value to default_team because User module uses it for setting the 'Primary' team
     if (!empty($this->team_id)) {
         $this->default_team = $this->team_id;
     }
     // track the current reports to id to be able to use it if it has changed
     $old_reports_to_id = isset($this->fetched_row['reports_to_id']) ? $this->fetched_row['reports_to_id'] : '';
     parent::save($check_notify);
     $GLOBALS['sugar_config']['disable_team_access_check'] = true;
     if ($this->status != 'Reserved' && !$this->portal_only) {
         // If this is not an update, then make sure the new user logic is executed.
         if (!$isUpdate) {
             // If this is a new user, make sure to add them to the appriate default teams
             if (!$this->team_exists) {
                 $team = BeanFactory::getBean('Teams');
                 $team->new_user_created($this);
             }
         } else {
             if (empty($GLOBALS['sugar_config']['noPrivateTeamUpdate'])) {
                 //if this is an update, then we need to ensure we keep the user's
                 //private team name and name_2 in sync with their name.
                 $team_id = $this->getPrivateTeamID();
                 if (!empty($team_id)) {
                     $team = BeanFactory::getBean('Teams', $team_id);
                     Team::set_team_name_from_user($team, $this);
                     $team->save();
                 }
             }
         }
     }
     // If reports to has changed, call update team memberships to correct the membership tree
     if ($old_reports_to_id != $this->reports_to_id) {
         $this->update_team_memberships($old_reports_to_id);
     }
     // set some default preferences when creating a new user
     if ($setNewUserPreferences) {
         $this->setPreference('reminder_time', 1800);
         if (!$this->getPreference('calendar_publish_key')) {
             $this->setPreference('calendar_publish_key', create_guid());
         }
     }
     $this->savePreferencesToDB();
     //CurrentUserApi needs a consistent timestamp/format of the data modified for hash purposes.
     $this->hashTS = $this->date_modified;
     // In case this new/updated user changes the system status, reload it here
     apiLoadSystemStatus(true);
     return $this->id;
 }
Beispiel #25
0
 /**
  * @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();
     $configurator->parseLoggerSettings();
     $focus = Administration::getSettings();
     /*
     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', true, true));
     $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');
     }
     $ini_session_val = ini_get('session.gc_maxlifetime');
     if (!empty($focus->settings['system_session_timeout'])) {
         $this->ss->assign("SESSION_TIMEOUT", $focus->settings['system_session_timeout']);
     } else {
         $this->ss->assign("SESSION_TIMEOUT", $ini_session_val);
     }
     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, ''));
     }
     if (isset($configurator->config['logger_visible'])) {
         $this->ss->assign('logger_visible', $configurator->config['logger_visible']);
     } else {
         $this->ss->assign('logger_visible', true);
     }
     $this->ss->assign('list_entries_per_listview_help', str_replace('{{listEntriesNum}}', '50', $mod_strings['TPL_LIST_ENTRIES_PER_LISTVIEW_HELP']));
     $this->ss->assign('list_entries_per_subpanel_help', str_replace('{{subpanelEntriesNum}}', '25', $mod_strings['TPL_LIST_ENTRIES_PER_SUBPANEL_HELP']));
     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, "");
     $javascript->addFieldRange("system_session_timeout", "int", $mod_strings['SESSION_TIMEOUT'], TRUE, "", 0, $ini_session_val);
     echo $javascript->getScript();
 }
 function preProcess()
 {
     $config = Administration::getSettings();
     if (!empty($_SESSION['authenticated_user_id'])) {
         if (isset($_SESSION['hasExpiredPassword']) && $_SESSION['hasExpiredPassword'] == '1') {
             if ($this->controller->action != 'Save' && $this->controller->action != 'Logout') {
                 $this->controller->module = 'Users';
                 $this->controller->action = 'ChangePassword';
                 $record = $GLOBALS['current_user']->id;
             } else {
                 $this->handleOfflineClient();
             }
         } elseif ($this->controller->action != 'AdminWizard' && $this->controller->action != 'EmailUIAjax' && $this->controller->action != 'Wizard' && $this->controller->action != 'SaveAdminWizard' && $this->controller->action != 'SaveUserWizard') {
             $this->handleOfflineClient();
         }
     }
     $this->handleAccessControl();
 }
 /**
  * Gets server information
  *
  * @return array of ServerInfo
  */
 public function getServerInfo()
 {
     $system_config = Administration::getSettings(false, true);
     $data['flavor'] = $GLOBALS['sugar_flavor'];
     $data['version'] = $GLOBALS['sugar_version'];
     $data['build'] = $GLOBALS['sugar_build'];
     // Product Name for Professional edition.
     $data['product_name'] = "SugarCRM Professional";
     // Product Name for Enterprise edition.
     $data['product_name'] = "SugarCRM Enterprise";
     if (file_exists('custom/version.php')) {
         include 'custom/version.php';
         $data['custom_version'] = $custom_version;
     }
     if (isset($system_config->settings['system_skypeout_on']) && $system_config->settings['system_skypeout_on'] == 1) {
         $data['system_skypeout_on'] = true;
     }
     if (isset($system_config->settings['system_tweettocase_on']) && $system_config->settings['system_tweettocase_on'] == 1) {
         $data['system_tweettocase_on'] = true;
     }
     $fts_enabled = SugarSearchEngineFactory::getFTSEngineNameFromConfig();
     if (!empty($fts_enabled) && $fts_enabled != 'SugarSearchEngine') {
         $data['fts'] = array('enabled' => true, 'type' => $fts_enabled);
     } else {
         $data['fts'] = array('enabled' => false);
     }
     //Adds the portal status to the server info collection.
     $admin = Administration::getSettings();
     //Property 'on' of category 'portal' must be a boolean.
     $data['portal_active'] = !empty($admin->settings['portal_on']);
     return $data;
 }
 /**
  * This function checks config to see if search engine is down.
  *
  * @return Boolean
  */
 public static function isSearchEngineDown()
 {
     $settings = Administration::getSettings();
     if (!empty($settings->settings['info_fts_down'])) {
         return true;
     }
     return false;
 }
Beispiel #29
0
$buttons = array("<input title='" . $app_strings['LBL_NEW_BUTTON_TITLE'] . "' class='button' type='submit' name='NewWorkFlowAlertShells' id='NewWorkFlowAlertShells' value='  " . $app_strings['LBL_NEW_BUTTON_LABEL'] . "  '>\n");
$button = "<form  action='index.php' method='post' name='form' id='form'>\n";
$button .= "<input type='hidden' name='module' value='WorkFlowAlertShells'>\n";
$button .= "<input type='hidden' name='module_tab' value='WorkFlow'>\n";
$button .= "<input type='hidden' name='workflow_id' value='{$focus->id}'>\n<input type='hidden' name='alert_name' value='{$focus->name}'>\n";
$button .= "<input type='hidden' name='return_module' value='" . $currentModule . "'>\n";
$button .= "<input type='hidden' name='return_action' value='" . $action . "'>\n";
$button .= "<input type='hidden' name='return_id' value='" . $focus->id . "'>\n";
$button .= "<input type='hidden' name='action' value='EditView';>\n";
require_once 'include/SugarSmarty/plugins/function.sugar_action_menu.php';
$button .= smarty_function_sugar_action_menu(array('id' => 'ACLRoles_EditView_action_menu', 'buttons' => $buttons), $xtpl);
//$button .= "<input title='".$current_module_strings['LBL_NEW_BUTTON_TITLE_ACTION']."' class='button' type='button' name='New' value='  ".$current_module_strings['LBL_NEW_BUTTON_LABEL_ACTION']."'";
//$button .= "LANGUAGE=javascript onclick='window.open(\"index.php?module=WorkFlowActionShells&action=CreateStep1&html=CreateStep1&form=ComponentView&form_submit=false&query=true&sugar_body_only=true&workflow_id=$focus->id\",\"new\",\"width=400,height=500,resizable=1,scrollbars=1\");'";
//$button .= ">\n";
$button .= "</form>";
$admin = Administration::getSettings();
$mail_server = trim($admin->settings['mail_smtpserver']);
if (empty($mail_server) && !empty($focus_alerts_list)) {
    echo "<BR><font color='red'><b>" . $mod_strings['LBL_LACK_OF_NOTIFICATIONS_ON'] . "</b></font><BR>";
}
//ALERT SUBPANEL
//$focus_alerts_list2 = array_merge($focus_alerts_list, $focus_actions_list);
$ListView = new ListView();
$header_text = '';
$ListView->initNewXTemplate('modules/WorkFlowAlertShells/SubPanelView.html', $current_module_strings);
$ListView->xTemplateAssign("WORKFLOW_ID", $focus->id);
$ListView->xTemplateAssign("RETURN_URL", "&return_module=" . $currentModule . "&return_action=DetailView&return_id={$_REQUEST['record']}");
$ListView->xTemplateAssign("EDIT_INLINE_PNG", SugarThemeRegistry::current()->getImage('edit_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_EDIT']));
$ListView->xTemplateAssign("DELETE_INLINE_PNG", SugarThemeRegistry::current()->getImage('delete_inline', 'align="absmiddle" border="0"', null, null, '.gif', $app_strings['LNK_REMOVE']));
$ListView->setHeaderTitle($current_module_strings['LBL_MODULE_NAME_COMBO'] . $header_text);
$ListView->setHeaderText($button);
Beispiel #30
0
function loadLicense($firstLogin = false)
{
    $GLOBALS['license'] = Administration::getSettings('license', $firstLogin);
}