/** * EditView constructor * This is the EditView constructor responsible for processing the new * Meta-Data framework * * @param $module String value of module this Edit view is for * @param $focus An empty sugarbean object of module * @param $id The record id to retrieve and populate data for * @param $metadataFile String value of file location to use in overriding default metadata file * @param tpl String value of file location to use in overriding default Smarty template * @param createFocus bool value to tell whether to create a new bean if we do not have one with an id, this is used from ConvertLead * */ function setup($module, $focus = null, $metadataFile = null, $tpl = 'include/EditView/EditView.tpl', $createFocus = true) { $this->th = $this->getTemplateHandler(); $this->th->ss = $this->ss; $this->tpl = $tpl; $this->module = $module; $this->focus = $focus; //this logic checks if the focus has an id and if it does not then it will create a new instance of the focus bean //but in convert lead we do not want to create a new instance and do not want to populate id. if ($createFocus) { $this->createFocus(); } if (empty($GLOBALS['sugar_config']['showDetailData'])) { $this->showDetailData = false; } $this->metadataFile = $metadataFile; if (isset($GLOBALS['sugar_config']['disable_vcr'])) { $this->showVCRControl = !$GLOBALS['sugar_config']['disable_vcr']; } if (!empty($this->metadataFile) && SugarAutoLoader::existing($this->metadataFile)) { include $this->metadataFile; } $this->defs = $viewdefs[$this->module][$this->view]; $this->isDuplicate = isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true' && $this->focus->aclAccess('edit'); }
/** * return the singleton of the SugarField * * @param string $field Field type * @param boolean $returnNullIfBase * @return SugarFieldBase */ static function getSugarField($field, $returnNullIfBase = false) { static $sugarFieldObjects = array(); $field = self::fixupFieldType($field); $field = ucfirst($field); if (!isset($sugarFieldObjects[$field])) { //check custom directory $file = SugarAutoLoader::existingCustomOne("include/SugarFields/Fields/{$field}/SugarField{$field}.php"); if ($file) { $type = $field; } else { // No direct class, check the directories to see if they are defined if ($returnNullIfBase && !SugarAutoLoader::existing('include/SugarFields/Fields/' . $field)) { return null; } $file = 'include/SugarFields/Fields/Base/SugarFieldBase.php'; $type = 'Base'; } require_once $file; $class = SugarAutoLoader::customClass('SugarField' . $type); //could be a custom class check it $sugarFieldObjects[$field] = new $class($field); } return $sugarFieldObjects[$field]; }
static function getList() { if (is_null(self::$list)) { if (SugarAutoLoader::existing('custom/workflow/plugins/plugin_list.php')) { require 'custom/workflow/plugins/plugin_list.php'; self::$list = $plugin_list; } else { self::$list = array(); } } return self::$list; }
function display() { if (SugarAutoLoader::existing('modules/' . $this->module . '/Popup_picker.php')) { require_once 'modules/' . $this->module . '/Popup_picker.php'; } else { require_once 'include/Popups/Popup_picker.php'; } $popup = new Popup_Picker(); $popup->_hide_clear_button = true; if (!empty($_REQUEST['html'])) { $method = $_REQUEST['html']; if (method_exists($popup, $method)) { echo $popup->{$method}(); return; } } echo $popup->process_page(); }
public function __construct() { //here we should check if anything exists in custom/Tracker dir. if (SugarAutoLoader::existing('custom/modules/Trackers/tracker_reporter.php')) { require_once 'custom/modules/Trackers/tracker_reporter.php'; //merge queries from custom file $all_queries = array_merge_recursive($this->default_queries, $queries); //merge functions from custom file as well. $this->included_methods = $this->getFileMethods('custom/modules/Trackers/tracker_reporter.php'); } else { $all_queries = $this->default_queries; } if (!empty($all_queries[$GLOBALS['db']->dbType])) { $this->queries = array_merge($all_queries['all'], $all_queries[$GLOBALS['db']->dbType]); } else { $this->queries = $all_queries['all']; } }
function display() { global $popupMeta, $mod_strings; if ($this->bean instanceof SugarBean && !$this->bean->ACLAccess('list')) { ACLController::displayNoAccess(); sugar_cleanup(true); } if (isset($_REQUEST['metadata']) && strpos($_REQUEST['metadata'], "..") !== false) { ACLController::displayNoAccess(); sugar_cleanup(true); } $popupMeta = SugarAutoLoader::loadPopupMeta($this->module, isset($_REQUEST['metadata']) ? $_REQUEST['metadata'] : null); $defs = $this->loadWithPopup('listviewdefs'); if (is_array($defs)) { $listViewDefs[$this->module] = $defs; } elseif (!empty($defs)) { require $defs; } $defs = $this->loadWithPopup('searchdefs'); if (is_array($defs)) { $searchdefs[$this->module]['layout']['advanced_search'] = $defs; } elseif (!empty($defs)) { require $defs; } if (!empty($this->bean) && isset($_REQUEST[$this->module . '2_' . strtoupper($this->bean->object_name) . '_offset'])) { //if you click the pagination button, it will populate the search criteria here if (!empty($_REQUEST['current_query_by_page'])) { $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount', 'lvso', 'sortOrder', 'orderBy', 'request_data', 'current_query_by_page'); $current_query_by_page = unserialize(base64_decode($_REQUEST['current_query_by_page'])); foreach ($current_query_by_page as $search_key => $search_value) { if ($search_key != $this->module . '2_' . strtoupper($this->bean->object_name) . '_offset' && !in_array($search_key, $blockVariables)) { $_REQUEST[$search_key] = $GLOBALS['db']->quote($search_value); } } } } foreach (SugarAutoLoader::existing('modules/' . $this->module . '/Popup_picker.php', 'include/Popups/Popup_picker.php') as $file) { require_once $file; break; } $popup = new Popup_Picker(); $popup->_hide_clear_button = true; echo $popup->process_page(); }
protected function callLegacyCode() { if (strtolower($this->do_action) == 'convertlead') { if (SugarAutoLoader::existing('modules/Leads/ConvertLead.php') && !SugarAutoLoader::existing('custom/modules/Leads/metadata/convertdefs.php')) { if (!empty($_REQUEST['emailAddressWidget'])) { foreach ($_REQUEST as $key => $value) { if (preg_match('/^Leads.*?emailAddress[\\d]+$/', $key)) { $_REQUEST['Leads_email_widget_id'] = 0; break; } } } $this->action_default(); $this->_processed = true; } else { $this->view = 'convertlead'; $this->_processed = true; } } else { parent::callLegacyCode(); } }
/** * Process all of the workflow alerts in the session for this bean * @param focus - the bean to use in the alert * @param alerts - the alerts that were saved in the session * */ function process_alerts(&$focus, $alerts) { //Confirm we are not running populating seed data if (isset($_SESSION['disable_workflow'])) { return; } //Now just include the modules workflow from this bean foreach (SugarAutoLoader::existing("custom/modules/" . $focus->module_dir . "/workflow/workflow.php") as $workflow_path) { include_once $workflow_path; $target_class = $focus->module_dir . "_workflow"; $workflow_class = new $target_class(); if (!empty($focus->emailAddress) && isset($focus->emailAddress->addresses)) { //addresses maybe cleared $old_addresses = $focus->emailAddress->addresses; } $focus->retrieve($focus->id); //This will lose all changes to emailaddress if (!empty($focus->emailAddress) && isset($old_addresses)) { $focus->emailAddress->addresses = $old_addresses; $focus->emailAddress->populateLegacyFields($focus); } // Bug 45142 - dates need to be converted to DB format for // workflow alerts to work properly in Alerts then Actions // situations - rgonzalez $focus->fixUpFormatting(); // End Bug 45142 foreach (SugarAutoLoader::existing("custom/modules/" . $focus->module_dir . "/workflow/workflow_alerts.php") as $file) { include_once $file; foreach ($alerts as $alert) { $alert_target_class = $focus->module_dir . "_alerts"; if (class_exists($alert_target_class)) { $alert_class = new $alert_target_class(); $function_name = "process_wflow_" . $alert; $alert_class->{$function_name}($focus); } } } } }
$beanFiles['Subscription'] = 'modules/ActivityStream/Subscriptions/Subscription.php'; $modInvisList[] = 'Subscriptions'; $beanList['Filters'] = 'Filters'; $beanFiles['Filters'] = 'modules/Filters/Filters.php'; $modInvisList[] = 'Filters'; $beanList['Dashboards'] = 'Dashboard'; $beanFiles['Dashboard'] = 'modules/Dashboards/Dashboard.php'; $modInvisList[] = 'Dashboards'; //Object list is only here to correct for modules that break //the bean class name == dictionary entry/object name convention //No future module should need an entry here. $objectList = array(); $objectList['Cases'] = 'Case'; $objectList['Groups'] = 'User'; $objectList['Users'] = 'User'; $objectList['ActivityStream/Activities'] = 'Activities'; $objectList['TrackerSessions'] = 'tracker_sessions'; $objectList['TrackerPerfs'] = 'tracker_perf'; $objectList['TrackerQueries'] = 'tracker_queries'; $objectList['TeamNotices'] = 'TeamNotices'; $beanList['PdfManager'] = 'PdfManager'; $beanFiles['PdfManager'] = 'modules/PdfManager/PdfManager.php'; $modInvisList[] = 'PdfManager'; $adminOnlyList['PdfManager'] = array('all' => 1); // TODO: this definition should be grouped with all the others definitions like $beanList, $beanFiles and so on $bwcModules = array('ACLFields', 'ACLRoles', 'ACLActions', 'Administration', 'Audit', 'Calendar', 'CampaignLog', 'Campaigns', 'CampaignTrackers', 'Charts', 'Configurator', 'Contracts', 'ContractTypes', 'Connectors', 'Currencies', 'CustomQueries', 'DataSets', 'DocumentRevisions', 'Documents', 'EAPM', 'EmailAddresses', 'EmailMarketing', 'EmailMan', 'Emails', 'EmailTemplates', 'Employees', 'Exports', 'Expressions', 'Groups', 'History', 'Holidays', 'iCals', 'Import', 'InboundEmail', 'KBContents', 'KBDocuments', 'KBDocumentRevisions', 'KBTags', 'KBDocumentKBTags', 'KBContents', 'Manufacturers', 'MergeRecords', 'ModuleBuilder', 'MySettings', 'OAuthKeys', 'OAuthTokens', 'OptimisticLock', 'OutboundEmailConfiguration', 'PdfManager', 'ProductBundleNotes', 'ProductBundles', 'ProductTypes', 'Project', 'ProjectResources', 'ProjectTask', 'Quotas', 'Quotes', 'QueryBuilder', 'Relationships', 'Releases', 'ReportMaker', 'Reports', 'Roles', 'SavedSearch', 'Schedulers', 'SchedulersJobs', 'Shippers', 'SNIP', 'Studio', 'SugarFavorites', 'TaxRates', 'Teams', 'TeamMemberships', 'TeamSets', 'TeamSetModules', 'TeamNotices', 'TimePeriods', 'Trackers', 'TrackerSessions', 'TrackerPerfs', 'TrackerQueries', 'UserPreferences', 'UserSignatures', 'Users', 'vCals', 'vCards', 'Versions', 'WorkFlow', 'WorkFlowActions', 'WorkFlowActionShells', 'WorkFlowAlerts', 'WorkFlowAlertShells', 'WorkFlowTriggerShells'); // this module doesn't need a Bean $modInvisList[] = 'Feedbacks'; foreach (SugarAutoLoader::existing('include/modules_override.php', SugarAutoLoader::loadExtension("modules")) as $modExtFile) { include $modExtFile; }
/** * Builds the theme registry */ public static function buildRegistry() { self::$_themes = array(); // check for a default themedef file $themedefDefault = array(); if (SugarAutoLoader::existing("custom/themes/default/themedef.php")) { $themedef = array(); require "custom/themes/default/themedef.php"; $themedefDefault = $themedef; } foreach (SugarAutoLoader::getFilesCustom("themes", true) as $file) { if (SugarAutoLoader::existing("{$file}/themedef.php")) { $themedef = array(); require "{$file}/themedef.php"; $themedef = array_merge($themedef, $themedefDefault); $themedef['dirName'] = basename($file); if (self::exists($themedef['dirName'])) { $existingTheme = self::get($themedef['dirName']); foreach (SugarTheme::getThemeDefFields() as $field) { if (!isset($themedef[$field])) { $themedef[$field] = $existingTheme->{$field}; } } self::remove($themedef['dirName']); } if (isset($themedef['name'])) { self::add($themedef); } } } // default to setting the default theme as the current theme if (!isset($GLOBALS['sugar_config']['default_theme']) || !self::set($GLOBALS['sugar_config']['default_theme'])) { if (count(self::availableThemes()) == 0) { sugar_die('No valid themes are found on this instance'); } else { self::set(self::getDefaultThemeKey()); } } }
die('Not A Valid Entry Point'); } /* * Your installation or use of this SugarCRM file is subject to the applicable * terms available at * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/. * If you do not agree to all of the applicable terms or do not have the * authority to bind the entity as an authorized representative, then do not * install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ $mod_strings = return_module_language($current_language, $_REQUEST['target_module']); $target_module = $_REQUEST['target_module']; // target class if (SugarAutoLoader::existing('modules/' . $_REQUEST['target_module'] . '/EditView.php')) { $tpl = $_REQUEST['tpl']; if (SugarAutoLoader::requireWithCustom('modules/' . $target_module . '/' . $target_module . 'QuickCreate.php')) { // if there is a quickcreate override $editviewClass = SugarAutoLoader::customClass($target_module . 'QuickCreate'); // eg. OpportunitiesQuickCreate $editview = new $editviewClass($target_module, 'modules/' . $target_module . '/tpls/' . $tpl); $editview->viaAJAX = true; } else { // else use base class require_once 'include/EditView/EditViewQuickCreate.php'; $editview = new EditViewQuickCreate($target_module, 'modules/' . $target_module . '/tpls/' . $tpl); } $editview->process(); echo $editview->display(); } else {
/** * Meant to handle old views e.g. DetailView.php. * */ protected function callLegacyCode() { $file = self::getActionFilename($this->do_action); if (isset($this->action_view_map[strtolower($this->do_action)])) { $action = $this->action_view_map[strtolower($this->do_action)]; } else { $action = $this->do_action; } // index actions actually maps to the view.list.php view if ($action == 'index') { $action = 'list'; } $action = strtolower($action); if (SugarAutoLoader::existing("modules/{$this->module}/{$file}.php") && !SugarAutoLoader::existing("modules/{$this->module}/views/view.{$action}.php") || SugarAutoLoader::existing("custom/modules/{$this->module}/{$file}.php") && !SugarAutoLoader::existing("custom/modules/{$this->module}/views/view.{$action}.php")) { // A 'classic' module, using the old pre-MVC display files // We should now discard the bean we just obtained for tracking as the pre-MVC module will instantiate its own unset($GLOBALS['FOCUS']); $GLOBALS['log']->debug('Module:' . $this->module . ' using file: ' . $file); $this->action_default(); $this->_processed = true; } }
/** * Search for bwc modules which are not related to core bwc modules * * @return array */ protected function getNotCoreBwcModules() { // Because of 6_ScanModules.php we should find core BWC modules in some specific way. $bwcModules = array(); include 'include/modules.php'; $coreBwcModules = $bwcModules; foreach (SugarAutoLoader::existing('include/modules_override.php', SugarAutoLoader::loadExtension("modules")) as $modExtFile) { $bwcModules = array(); include $modExtFile; foreach ($bwcModules as $module) { $key = array_search($module, $coreBwcModules); if ($key !== false) { unset($coreBwcModules[$key]); } } } return array_diff($GLOBALS['bwcModules'], $coreBwcModules); }
/** * Loads the module shortcuts menu * * @param $module string optional, can specify module to retrieve menu for if not the current one * @return array module menu */ public function getMenu($module = null, $mod_strings_override = false) { global $current_language, $current_user, $app_strings, $module_menu, $mod_strings; if (empty($module)) { $module = $this->module; } //Need to make sure the mod_strings match the requested module or Menus may fail $curr_mod_strings = $mod_strings; if ($mod_strings_override !== false) { $mod_strings = $mod_strings_override; } else { $mod_strings = return_module_language($current_language, $module); } $module_menu = array(); $menus = SugarAutoLoader::existing('modules/' . $module . '/Menu.php', SugarAutoLoader::loadExtension("menus", $module)); foreach ($menus as $file) { require $file; } if (empty($menus) && !empty($GLOBALS['mod_strings']['LNK_NEW_RECORD'])) { $module_menu[] = array("index.php?module={$module}&action=EditView&return_module={$module}&return_action=DetailView", $GLOBALS['mod_strings']['LNK_NEW_RECORD'], "{$GLOBALS['app_strings']['LBL_CREATE_BUTTON_LABEL']}{$module}", $module); $module_menu[] = array("index.php?module={$module}&action=index", $GLOBALS['mod_strings']['LNK_LIST'], $module, $module); if ($this->bean instanceof SugarBean && !empty($this->bean->importable)) { if (!empty($mod_strings['LNK_IMPORT_' . strtoupper($module)])) { $module_menu[] = array("index.php?module=Import&action=Step1&import_module={$module}&return_module={$module}&return_action=index", $mod_strings['LNK_IMPORT_' . strtoupper($module)], "Import", $module); } else { $module_menu[] = array("index.php?module=Import&action=Step1&import_module={$module}&return_module={$module}&return_action=index", $app_strings['LBL_IMPORT'], "Import", $module); } } } if ($this->base_menu) { require $this->base_menu; } $mod_strings = $curr_mod_strings; $builtModuleMenu = $module_menu; unset($module_menu); return $builtModuleMenu; }
/** * Loads a specific client file's contents * * @param string $type The type of the client data (view/layout/field) * @param string $name The name of the client data (record/history/list) * @param string $platform The platform to search for the client data (defaults to base) * * @return array Contents of the metadata file */ public static function loadSingleClientMetadata($type, $name, $platform = 'base') { $fileList = array(); $platforms = array(); if ($platform != 'base') { $platforms[] = $platform; } $platforms[] = 'base'; foreach ($platforms as $platform) { $fileToCheck = "clients/{$platform}/{$type}s/{$name}/{$name}.php"; $fileList['custom/' . $fileToCheck] = $platform; $fileList[$fileToCheck] = $platform; } foreach ($fileList as $file => $platform) { if (SugarAutoLoader::existing($file)) { require $file; if (isset($viewdefs[$platform][$type][$name])) { return $viewdefs[$platform][$type][$name]; } } } return null; }
<?php if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } /* * Your installation or use of this SugarCRM file is subject to the applicable * terms available at * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/. * If you do not agree to all of the applicable terms or do not have the * authority to bind the entity as an authorized representative, then do not * install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ //Used for custom plugins if (!empty($_REQUEST['plugin_action']) && $_REQUEST['plugin_action'] != "" && !empty($_REQUEST['plugin_module']) && $_REQUEST['plugin_module'] != "") { if (SugarAutoLoader::existing('custom/workflow/plugins/' . $_REQUEST['plugin_module'] . '/' . $_REQUEST['plugin_action'] . '.php')) { include_once 'custom/workflow/plugins/' . $_REQUEST['plugin_module'] . '/' . $_REQUEST['plugin_action'] . '.php'; } else { echo "custom plugin file not found"; } } else { echo "A custom plugin step 2 was not specified"; }
/** * getUnifiedSearchModulesDisplay * * Returns the value of the $unified_search_modules_display variable which is based on the $unified_search_modules * entries that have been selected to be allowed for searching. * * @return $unified_search_modules_display Array value of modules that have enabled for searching */ public function getUnifiedSearchModulesDisplay() { if (!SugarAutoLoader::existing('custom/modules/unified_search_modules_display.php')) { $unified_search_modules = $this->getUnifiedSearchModules(); $unified_search_modules_display = array(); if (!empty($unified_search_modules)) { foreach ($unified_search_modules as $module => $data) { $unified_search_modules_display[$module]['visible'] = isset($data['default']) && $data['default'] ? true : false; } } $this->writeUnifiedSearchModulesDisplayFile($unified_search_modules_display); } include 'custom/modules/unified_search_modules_display.php'; return $unified_search_modules_display; }
/** * This method saves a subpanels override defintion * * @param object $panel the subpanel * @param var $subsection * @param string $override the override string */ function saveSubPanelDefOverride($panel, $subsection, $override) { $layoutPath = "custom/Extension/modules/{$panel->parent_bean->module_dir}/Ext/Layoutdefs/"; $layoutDefsName = "layout_defs['{$panel->parent_bean->module_dir}']['subpanel_setup']['" . strtolower($panel->name) . "']"; $layoutDefsExtName = "layoutdefs"; $moduleInstallerMethod = "rebuild_layoutdefs"; //bug 42262 (filename with $panel->_instance_properties['get_subpanel_data'] can create problem if had word "function" in it) $overrideValue = $filename = $panel->parent_bean->object_name . "_subpanel_" . $panel->name; $overrideName = 'override_subpanel_name'; //save the new subpanel $name = "subpanel_layout['list_fields']"; //bugfix: load looks for moduleName/metadata/subpanels, not moduleName/subpanels $path = 'custom/modules/' . $panel->_instance_properties['module'] . '/metadata/subpanels'; //bug# 40171: "Custom subpanels not working as expected" //each custom subpanel needs to have a unique custom def file $oldName1 = '_override' . $panel->parent_bean->object_name . $panel->_instance_properties['module'] . $panel->_instance_properties['subpanel_name']; $oldName2 = '_override' . $panel->parent_bean->object_name . $panel->_instance_properties['get_subpanel_data']; if (file_exists("{$layoutPath}/{$oldName1}.php")) { @unlink("{$layoutPath}/{$oldName1}.php"); } if (file_exists("{$layoutPath}/{$oldName2}.php")) { @unlink("{$layoutPath}/{$oldName2}.php"); } $extname = '_override' . $filename; //end of bug# 40171 mkdir_recursive($path, true); write_array_to_file($name, $override, $path . '/' . $filename . '.php'); //save the override for the layoutdef //tyoung 10.12.07 pushed panel->name to lowercase to match case in subpaneldefs.php files - //gave error on bad index 'module' as this override key didn't match the key in the subpaneldefs $newValue = override_value_to_string($layoutDefsName, $overrideName, $overrideValue); mkdir_recursive($layoutPath, true); $fp = sugar_fopen("{$layoutPath}/{$extname}.php", 'w'); fwrite($fp, "<?php\n//auto-generated file DO NOT EDIT\n{$newValue}\n?>"); fclose($fp); require_once 'ModuleInstall/ModuleInstaller.php'; $moduleInstaller = new ModuleInstaller(); $moduleInstaller->silent = true; // make sure that the ModuleInstaller->log() function doesn't echo while rebuilding the layoutdefs $moduleInstaller->{$moduleInstallerMethod}(); SugarAutoLoader::buildCache(); foreach (SugarAutoLoader::existing('modules/' . $panel->parent_bean->module_dir . '/layout_defs.php', SugarAutoLoader::loadExtension($layoutDefsExtName, $panel->parent_bean->module_dir)) as $file) { include $file; } }
public function display() { global $popupMeta, $mod_strings; if ($this->bean instanceof SugarBean && !$this->bean->ACLAccess('list')) { ACLController::displayNoAccess(); sugar_cleanup(true); } if (isset($_REQUEST['metadata']) && strpos($_REQUEST['metadata'], "..") !== false) { ACLController::displayNoAccess(); sugar_cleanup(true); } $popupMeta = SugarAutoLoader::loadPopupMeta($this->module, isset($_REQUEST['metadata']) ? $_REQUEST['metadata'] : null); $defs = $this->loadWithPopup('listviewdefs'); if (is_array($defs)) { $listViewDefs[$this->module] = $defs; } elseif (!empty($defs)) { require $defs; } $defs = $this->loadWithPopup('searchdefs'); if (is_array($defs)) { $searchdefs[$this->module]['layout']['advanced_search'] = $defs; } elseif (!empty($defs)) { require $defs; } //if you click the pagination button, it will populate the search criteria here if (!empty($this->bean) && isset($_REQUEST[$this->module . '2_' . strtoupper($this->bean->object_name) . '_offset'])) { if (!empty($_REQUEST['current_query_by_page'])) { $blockVariables = array('mass', 'uid', 'massupdate', 'delete', 'merge', 'selectCount', 'sortOrder', 'orderBy', 'request_data', 'current_query_by_page'); $current_query_by_page = unserialize(base64_decode($_REQUEST['current_query_by_page'])); foreach ($current_query_by_page as $search_key => $search_value) { if ($search_key != $this->module . '2_' . strtoupper($this->bean->object_name) . '_offset' && !in_array($search_key, $blockVariables)) { if (!is_array($search_value)) { $_REQUEST[$search_key] = securexss($search_value); } else { foreach ($search_value as $key => &$val) { $val = securexss($val); } $_REQUEST[$search_key] = $search_value; } } } } } if (!empty($listViewDefs) && !empty($searchdefs)) { $displayColumns = array(); $filter_fields = array(); $popup = $this->getPopupSmarty($this->bean, $this->module); $this->bean->ACLFilterFieldList($listViewDefs[$this->module], array("owner_override" => true)); foreach ($listViewDefs[$this->module] as $col => $params) { $filter_fields[strtolower($col)] = true; if (!empty($params['related_fields'])) { foreach ($params['related_fields'] as $field) { //id column is added by query construction function. This addition creates duplicates //and causes issues in oracle. #10165 if ($field != 'id') { $filter_fields[$field] = true; } } } if (!empty($params['default']) && $params['default']) { $displayColumns[$col] = $params; } } $popup->displayColumns = $displayColumns; $popup->filter_fields = $filter_fields; $popup->mergeDisplayColumns = true; //check to see if popupdefs contains searchdefs $popup->_popupMeta = $popupMeta; $popup->listviewdefs = $listViewDefs; $popup->searchdefs = $searchdefs; if (isset($_REQUEST['query'])) { $popup->searchForm->populateFromRequest(); } $massUpdateData = ''; if (isset($_REQUEST['mass'])) { foreach (array_unique($_REQUEST['mass']) as $record) { $massUpdateData .= "<input style='display: none' checked type='checkbox' name='mass[]' value='{$record}'>\n"; } } $popup->massUpdateData = $massUpdateData; $tpl = 'include/Popups/tpls/PopupGeneric.tpl'; if (file_exists($this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupGeneric.tpl"))) { $tpl = $this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupGeneric.tpl"); } if (file_exists($this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupHeader.tpl"))) { $popup->headerTpl = $this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupHeader.tpl"); } if (file_exists($this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupFooter.tpl"))) { $popup->footerTpl = $this->getCustomFilePathIfExists("modules/{$this->module}/tpls/popupFooter.tpl"); } $popup->setup($tpl); //We should at this point show the header and javascript even if to_pdf is true. //The insert_popup_header javascript is incomplete and shouldn't be relied on. if (isset($this->options['show_all']) && $this->options['show_all'] == false) { unset($this->options['show_all']); $this->options['show_javascript'] = true; $this->options['show_header'] = true; $this->_displayJavascript(); } insert_popup_header(null, false); if (isset($this->override_popup['template_data']) && is_array($this->override_popup['template_data'])) { $popup->th->ss->assign($this->override_popup['template_data']); } echo $popup->display(); } else { if (SugarAutoLoader::existing('modules/' . $this->module . '/Popup_picker.php')) { require_once 'modules/' . $this->module . '/Popup_picker.php'; } else { require_once 'include/Popups/Popup_picker.php'; } $popup = new Popup_Picker(); $popup->_hide_clear_button = true; echo $popup->process_page(); } }
*/ function print_layout($layout) { global $mod_strings; global $layouts; if (!isset($layouts[$layout])) { $GLOBALS['log']->fatal("quote layout is not registered in modules/Quotes/Layouts.php"); sugar_die("quote layout is not registered in modules/Quotes/Layouts.php"); } elseif (!is_file($layouts[$layout])) { $GLOBALS['log']->fatal("quote layout file does not exist: " . $layouts[$layout]); sugar_die("quote layout file does not exist: " . $layouts[$layout]); } else { include_once $layouts[$layout]; } } foreach (SugarAutoLoader::existing('modules/Quotes/Layouts.override.php', 'custom/modules/Quotes/Layouts.php') as $file) { include_once $file; } if (isset($_REQUEST['email_action']) && $_REQUEST['email_action'] == "EmailLayout") { //check to make sure the layout is set if (isset($_REQUEST['layout'])) { include_once 'modules/Quotes/EmailPDF.php'; $email_id = email_layout($_REQUEST['layout']); } //redirect if ($email_id == "") { //Redirect to quote, since something went wrong echo "There was an error with your request"; exit; //end if email id is blank } else {
<?php if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } /* * Your installation or use of this SugarCRM file is subject to the applicable * terms available at * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/. * If you do not agree to all of the applicable terms or do not have the * authority to bind the entity as an authorized representative, then do not * install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ //include any group of products in these stages for the standard pdf template //Does not need to be translated this is just for the keys $in_total_group_stages = $GLOBALS['app_list_strings']['in_total_group_stages']; $pdf_group_subtotal = true; if (SugarAutoLoader::existing('custom/modules/Quotes/config.php')) { include_once 'custom/modules/Quotes/config.php'; }
/** This function retrieves a theme's language file and returns the array of strings included. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc. * All Rights Reserved. * Contributor(s): ______________________________________.. */ function return_theme_language($language, $theme) { global $mod_strings, $sugar_config, $current_language; $language_used = $language; $default_language = !empty($sugar_config['default_language']) ? $sugar_config['default_language'] : $language; $path = SugarThemeRegistry::get($theme)->getFilePath(); foreach (SugarAutoLoader::existing($path . "/language/{$current_language}.lang.php", $path . "/language/{$current_language}.lang.override.php", $path . "/language/{$current_language}.lang.php.override") as $file) { include $file; } if (!isset($theme_strings)) { $GLOBALS['log']->warn("Unable to find the theme file for language: " . $language . " and theme: " . $theme); require SugarThemeRegistry::get($theme)->getFilePath() . "/language/{$default_language}.lang.php"; $language_used = $default_language; } if (!isset($theme_strings)) { $GLOBALS['log']->fatal("Unable to load the theme({$theme}) language file for the selected language({$language}) or the default language({$default_language})"); return null; } // If we are in debug mode for translating, turn on the prefix now! if ($sugar_config['translation_string_prefix']) { foreach ($theme_strings as $entry_key => $entry_value) { $theme_strings[$entry_key] = $language_used . ' ' . $entry_value; } } return $theme_strings; }
global $app_strings, $current_user; global $sugar_config, $sugar_version, $sugar_flavor, $server_unique_key, $current_language, $action; if (!isset($global_control_links)) { $global_control_links = array(); $sub_menu = array(); } if (isset($sugar_config['disc_client']) && $sugar_config['disc_client']) { require_once 'modules/Sync/headermenu.php'; } if (SugarThemeRegistry::current()->name != 'Classic') { $global_control_links['profile'] = array('linkinfo' => array($app_strings['LBL_PROFILE'] => 'index.php?module=Users&action=EditView&record=' . $GLOBALS['current_user']->id), 'submenu' => ''); } $global_control_links['employees'] = array('linkinfo' => array($app_strings['LBL_EMPLOYEES'] => 'index.php?module=Employees&action=index&query=true'), 'submenu' => ''); if (is_admin($current_user) || $current_user->isDeveloperForAnyModule()) { $global_control_links['admin'] = array('linkinfo' => array($app_strings['LBL_ADMIN'] => 'index.php?module=Administration&action=index'), 'submenu' => ''); } /* no longer goes in the menubar - now implemented in the bottom bar. $global_control_links['training'] = array( 'linkinfo' => array($app_strings['LBL_TRAINING'] => 'javascript:void(window.open(\'http://support.sugarcrm.com\'))'), 'submenu' => '' ); $global_control_links['help'] = array( 'linkinfo' => array($app_strings['LNK_HELP'] => ' javascript:void window.open(\'index.php?module=Administration&action=SupportPortal&view=documentation&version='.$sugar_version.'&edition='.$sugar_flavor.'&lang='.$current_language.'&help_module='.$GLOBALS['module'].'&help_action='.$action.'&key='.$server_unique_key.'\')'), 'submenu' => '' ); */ $global_control_links['users'] = array('linkinfo' => array($app_strings['LBL_LOGOUT'] => 'index.php?module=Users&action=Logout'), 'submenu' => ''); $global_control_links['about'] = array('linkinfo' => array($app_strings['LNK_ABOUT'] => 'index.php?module=Home&action=About'), 'submenu' => ''); foreach (SugarAutoLoader::existing('custom/include/globalControlLinks.php', SugarAutoLoader::loadExtension("links")) as $file) { include $file; }
function loadLayoutDefs() { global $layout_defs; if (empty($this->layout_def)) { foreach (SugarAutoLoader::existing("modules/{$this->module_dir}/layout_defs.php", "custom/modules/{$this->module_dir}/Ext/Layoutdefs/layoutdefs.ext.php") as $file) { require $file; } if (empty($layout_defs[get_class($this)])) { $GLOBALS['log']->fatal("\$layout_defs[" . get_class($this) . "]; does not exist"); $this->layout_def = array(); } else { $this->layout_def = $layout_defs[get_class($this)]; } } }
protected function loadCustomMetadata() { foreach (SugarAutoLoader::existing('custom/modules/' . $this->seedBean->module_dir . '/metadata/dashletviewdefs.php') as $customMetadate) { require $customMetadate; $this->searchFields = $dashletData[$this->seedBean->module_dir . 'Dashlet']['searchFields']; foreach ($this->searchFields as $key => $def) { if ($key == 'assigned_user_name') { $this->searchFields['assigned_user_id'] = $def; unset($this->searchFields['assigned_user_name']); break; } } $this->columns = $dashletData[$this->seedBean->module_dir . 'Dashlet']['columns']; } }
/** * Create objects from createdef definitions * Example definition: * <code> * $createdef['*****@*****.**']['Contacts'] = array( * 'fields' => array( * 'email1' => '{from_addr}', * 'last_name' => '{from_name}', * 'description' => 'created from {subject}', * 'lead_source' => 'Email', * ), * ); * </code> * Supported variables: * - from * - from_addr * - from_name * - subject * - date * - description * - description_html * - message_id * - email_id * @param Email $email */ protected function createObject($email) { if (!SugarAutoLoader::existing('custom/modules/SNIP/createdefs.php')) { return false; } $createdef = array(); include 'custom/modules/SNIP/createdefs.php'; $emaildata = array(); foreach (array("subject", "description", "description_html", "message_id", "from_addr", "from_name") as $prop) { $emaildata["{" . $prop . "}"] = $email->{$prop}; } $emaildata["{from}"] = to_html($email->from_addr_name); $emaildata["{date}"] = $email->date_sent; $emaildata["{email_id}"] = $email->id; foreach ($email->all_addrs as $cleanaddr) { if (!isset($createdef[$cleanaddr])) { continue; } foreach ($createdef[$cleanaddr] as $module => $data) { // $obj = BeanFactory::getBean($module); if (!$obj) { $GLOBALS['log']->error("Unable to create bean for module {$module}"); continue; } // instantiate the data foreach ($data["fields"] as $key => $value) { $obj->{$key} = str_replace(array_keys($emaildata), array_values($emaildata), $value); } // special case for Opportunity if ($obj instanceof Opportunity && empty($obj->date_closed)) { $obj->date_closed = TimeDate::getInstance()->getNow()->asDbDate(); } // save $obj->save(); // associate email to new object if (empty($obj->id)) { continue; } // save failed $mod = strtolower($module); $rel = array_key_exists($mod, $email->field_defs) ? $mod : $mod . "_activities_emails"; //Custom modules rel name if ($email->load_relationship($rel)) { $email->{$rel}->add($obj->id); } } } return true; }
function getDashlets($category = '') { global $app_strings, $current_language, $mod_strings; require_once $GLOBALS['sugar_config']['cache_dir'] . 'dashlets/dashlets.php'; $categories = array('module' => 'Module Views', 'portal' => 'Portal', 'charts' => 'Charts', 'tools' => 'Tools', 'misc' => 'Miscellaneous', 'web' => 'Web'); $dashletStrings = array(); $dashletsList = array(); if (!empty($category)) { $dashletsList[$categories[$category]] = array(); } else { $dashletsList['Module Views'] = array(); $dashletsList['Charts'] = array(); $dashletsList['Tools'] = array(); $dashletsList['Web'] = array(); } asort($dashletsFiles); foreach ($dashletsFiles as $className => $files) { if (!empty($files['meta']) && SugarAutoLoader::fileExists($files['meta'])) { require_once $files['meta']; // get meta file $directory = substr($files['meta'], 0, strrpos($files['meta'], '/') + 1); foreach (SugarAutoLoader::existing($directory . $files['class'] . '.' . $current_language . '.lang.php', $directory . $files['class'] . '.en_us.lang.php') as $file) { require $file; } // try to translate the string if (empty($dashletStrings[$files['class']][$dashletMeta[$files['class']]['title']])) { $title = $dashletMeta[$files['class']]['title']; } else { $title = $dashletStrings[$files['class']][$dashletMeta[$files['class']]['title']]; } // try to translate the string if (empty($dashletStrings[$files['class']][$dashletMeta[$files['class']]['description']])) { $description = $dashletMeta[$files['class']]['description']; } else { $description = $dashletStrings[$files['class']][$dashletMeta[$files['class']]['description']]; } // generate icon if (!empty($dashletMeta[$files['class']]['icon'])) { // here we'll support image inheritance if the supplied image has a path in it // i.e. $dashletMeta[$files['class']]['icon'] = 'themes/default/images/dog.gif' // in this case, we'll strip off the path information to check for the image existing // in the current theme. $imageName = SugarThemeRegistry::current()->getImageURL(basename($dashletMeta[$files['class']]['icon']), false); if (!empty($imageName)) { if (sugar_is_file($imageName)) { $icon = '<img src="' . $imageName . '" alt="" border="0" align="absmiddle" />'; } else { $icon = ''; } } } else { if (empty($dashletMeta[$files['class']]['module'])) { $icon = get_dashlets_dialog_icon('default'); } else { if (!in_array($dashletMeta[$files['class']]['module'], $GLOBALS['moduleList']) && !in_array($dashletMeta[$files['class']]['module'], $GLOBALS['modInvisList']) && !in_array('Activities', $GLOBALS['moduleList'])) { unset($dashletMeta[$files['class']]); continue; } else { $icon = get_dashlets_dialog_icon($dashletMeta[$files['class']]['module']); } } } // determine whether to display if (!empty($dashletMeta[$files['class']]['hidden']) && $dashletMeta[$files['class']]['hidden'] === true) { $displayDashlet = false; } elseif (!empty($dashletMeta[$files['class']]['module']) && (!in_array($dashletMeta[$files['class']]['module'], $GLOBALS['moduleList']) && !in_array($dashletMeta[$files['class']]['module'], $GLOBALS['modInvisList'])) && !in_array('Activities', $GLOBALS['moduleList'])) { $displayDashlet = false; } else { $displayDashlet = true; //check ACL ACCESS if (!empty($dashletMeta[$files['class']]['module'])) { if (!SugarACL::checkAccess($dashletMeta[$files['class']]['module'], 'view', array('owner_override' => true))) { $displayDashlet = false; } if (!SugarACL::checkAccess($dashletMeta[$files['class']]['module'], 'list', array('owner_override' => true))) { $displayDashlet = false; } } } if ($dashletMeta[$files['class']]['category'] == 'Charts') { $type = 'predefined_chart'; } else { $type = 'module'; } if ($displayDashlet && isset($dashletMeta[$files['class']]['dynamic_hide']) && $dashletMeta[$files['class']]['dynamic_hide']) { if (SugarAutoLoader::fileExists($files['file'])) { require_once $files['file']; if (class_exists($files['class'])) { $dashletClassName = $files['class']; $displayDashlet = call_user_func(array($files['class'], 'shouldDisplay')); } } } if ($displayDashlet) { $cell = array('title' => $title, 'description' => $description, 'onclick' => 'return SUGAR.mySugar.addDashlet(\'' . $className . '\', \'' . $type . '\', \'' . (!empty($dashletMeta[$files['class']]['module']) ? $dashletMeta[$files['class']]['module'] : '') . '\');', 'icon' => $icon, 'id' => $files['class'] . '_select'); if (!empty($category) && $dashletMeta[$files['class']]['category'] == $categories[$category]) { array_push($dashletsList[$categories[$category]], $cell); } else { if (empty($category)) { array_push($dashletsList[$dashletMeta[$files['class']]['category']], $cell); } } } } } if (!empty($category)) { asort($dashletsList[$categories[$category]]); } else { foreach ($dashletsList as $key => $value) { asort($dashletsList[$key]); } } $this->dashlets = $dashletsList; }
<?php if (!defined('sugarEntry') || !sugarEntry) { die('Not A Valid Entry Point'); } /* * Your installation or use of this SugarCRM file is subject to the applicable * terms available at * http://support.sugarcrm.com/06_Customer_Center/10_Master_Subscription_Agreements/. * If you do not agree to all of the applicable terms or do not have the * authority to bind the entity as an authorized representative, then do not * install or use this SugarCRM file. * * Copyright (C) SugarCRM Inc. All rights reserved. */ $chartsStrings = return_module_language($GLOBALS['current_language'], 'Charts'); $chartDefs = array('pipeline_by_sales_stage_funnel' => array('type' => 'code', 'id' => 'Chart_pipeline_by_sales_stage', 'label' => $chartsStrings['LBL_CHART_PIPELINE_BY_SALES_STAGE_FUNNEL'], 'chartUnits' => $chartsStrings['LBL_OPP_SIZE'] . ' $1' . $chartsStrings['LBL_OPP_THOUSANDS'], 'chartType' => 'funnel chart 3D', 'groupBy' => array('sales_stage', 'user_name'), 'base_url' => array('module' => 'Opportunities', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search'), 'url_params' => array('assigned_user_id', 'sales_stage', 'date_start', 'date_closed')), 'pipeline_by_sales_stage' => array('type' => 'code', 'id' => 'Chart_pipeline_by_sales_stage', 'label' => $chartsStrings['LBL_CHART_PIPELINE_BY_SALES_STAGE'], 'chartUnits' => $chartsStrings['LBL_OPP_SIZE'] . ' $1' . $chartsStrings['LBL_OPP_THOUSANDS'], 'chartType' => 'horizontal group by chart', 'groupBy' => array('sales_stage', 'user_name'), 'base_url' => array('module' => 'Opportunities', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search'), 'url_params' => array('assigned_user_id', 'sales_stage', 'date_start', 'date_closed')), 'lead_source_by_outcome' => array('type' => 'code', 'id' => 'Chart_lead_source_by_outcome', 'label' => $chartsStrings['LBL_CHART_LEAD_SOURCE_BY_OUTCOME'], 'chartUnits' => '', 'chartType' => 'horizontal group by chart', 'groupBy' => array('lead_source', 'sales_stage'), 'base_url' => array('module' => 'Opportunities', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search'), 'url_params' => array('lead_source', 'sales_stage', 'date_start', 'date_closed')), 'outcome_by_month' => array('type' => 'code', 'id' => 'Chart_outcome_by_month', 'label' => $chartsStrings['LBL_CHART_OUTCOME_BY_MONTH'], 'chartUnits' => $chartsStrings['LBL_OPP_SIZE'] . ' $1' . $chartsStrings['LBL_OPP_THOUSANDS'], 'chartType' => 'stacked group by chart', 'groupBy' => array('m', 'sales_stage'), 'base_url' => array('module' => 'Opportunities', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search'), 'url_params' => array('sales_stage', 'date_closed')), 'pipeline_by_lead_source' => array('type' => 'code', 'id' => 'Chart_pipeline_by_lead_source', 'label' => $chartsStrings['LBL_CHART_PIPELINE_BY_LEAD_SOURCE'], 'chartUnits' => $chartsStrings['LBL_OPP_SIZE'] . ' $1' . $chartsStrings['LBL_OPP_THOUSANDS'], 'chartType' => 'pie chart', 'groupBy' => array('lead_source'), 'base_url' => array('module' => 'Opportunities', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search'), 'url_params' => array('lead_source')), 'opportunities_this_quarter' => array('type' => 'code', 'id' => 'opportunities_this_quarter', 'label' => $chartsStrings['LBL_CHART_OPPORTUNITIES_THIS_QUARTER'], 'chartType' => 'gauge chart', 'chartUnits' => 'Number of Opportunities', 'groupBy' => array(), 'gaugeTarget' => 200, 'base_url' => array('module' => 'Opportunities', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search')), 'my_modules_used_last_30_days' => array('type' => 'code', 'id' => 'my_modules_used_last_30_days', 'label' => $chartsStrings['LBL_CHART_MY_MODULES_USED_30_DAYS'], 'chartType' => 'horizontal bar chart', 'chartUnits' => $chartsStrings['LBL_MY_MODULES_USED_SIZE'], 'groupBy' => array('module_name'), 'base_url' => array('module' => 'Trackers', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search')), 'my_team_modules_used_last_30_days' => array('type' => 'code', 'id' => 'my_team_modules_used_last_30_days', 'label' => $chartsStrings['LBL_CHART_MODULES_USED_DIRECT_REPORTS_30_DAYS'], 'chartType' => 'horizontal group by chart', 'chartUnits' => $chartsStrings['LBL_MY_MODULES_USED_SIZE'], 'groupBy' => array('user_name', 'module_name'), 'base_url' => array('module' => 'Trackers', 'action' => 'index', 'query' => 'true', 'searchFormTab' => 'advanced_search'))); if (SugarAutoLoader::existing('custom/Charts/chartDefs.ext.php')) { include_once 'custom/Charts/chartDefs.ext.php'; }
public function loadHooks($module_dir) { $hook_array = array(); if (!empty($module_dir)) { $custom = "custom/modules/{$module_dir}"; } else { $custom = "custom/modules"; } foreach (SugarAutoLoader::existing("{$custom}/logic_hooks.php", SugarAutoLoader::loadExtension("logichooks", empty($module_dir) ? "application" : $module_dir)) as $file) { if (isset($GLOBALS['log'])) { $GLOBALS['log']->debug('Including hook file: ' . $file); } include $file; } return $hook_array; }
function process_workflow(&$focus, $logic_hook) { //Now just include the modules workflow from this bean if ($logic_hook == "BeforeSave") { foreach (SugarAutoLoader::existing("custom/modules/" . $focus->module_dir . "/workflow/workflow.php") as $workflow_path) { include_once $workflow_path; process_wflow_triggers($focus); } } }