コード例 #1
0
 /**
  * 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];
 }
コード例 #2
0
ファイル: EditView2.php プロジェクト: jglaine/sugar761-ent
 /**
  * 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');
 }
コード例 #3
0
 /**
  * getInstance
  * This method returns a formatter instance for the given source name and
  * formatter name.  If no formatter name is specified, the default formatter
  * for the source is used.
  *
  * @param $source_name The data source name to retreive formatter for
  * @param $formatter_name Optional formatter name to use
  * @param $wrapper_name Optional wrapper name to use
  * @return $instance The formatter instance
  */
 public static function getInstance($source_name, $formatter_name = '')
 {
     require_once 'include/connectors/formatters/default/formatter.php';
     $key = $source_name . $formatter_name;
     if (empty(self::$formatter_map[$key])) {
         if (empty($formatter_name)) {
             $formatter_name = $source_name;
         }
         $dir = str_replace('_', '/', $formatter_name);
         $parts = explode("/", $dir);
         $file = array_pop($parts);
         if (ConnectorFactory::load($formatter_name, 'formatters')) {
             $formatter_name .= '_formatter';
         } else {
             //if there is no override wrapper, use the default.
             $formatter_name = 'default_formatter';
         }
         $component = ConnectorFactory::getInstance($source_name);
         $formatter = new $formatter_name();
         $formatter->setComponent($component);
         $tpl = SugarAutoLoader::existingCustomOne("modules/Connectors/connectors/formatters/{$dir}/tpls/{$file}.tpl");
         if (!empty($tpl)) {
             $formatter->setTplFileName($tpl);
         }
         self::$formatter_map[$key] = $formatter;
     }
     //if
     return self::$formatter_map[$key];
 }
コード例 #4
0
 protected function fixRollupFormulas()
 {
     $oldFormula = 'rollupCurrencySum($revenuelineitems, "{{field}}")';
     $newFormula = 'rollupConditionalSum($revenuelineitems, "{{field}}", "sales_stage", forecastSalesStages(true, false))';
     // the field set we need
     $fields = array('best_case' => 'best_case', 'amount' => 'likely_case', 'worst_case' => 'worst_case');
     // get the get_widget helper and the StandardField Helper
     SugarAutoLoader::load('modules/DynamicFields/FieldCases.php');
     SugarAutoLoader::load('modules/ModuleBuilder/parsers/StandardField.php');
     // we are working with opportunities
     $bean = BeanFactory::getBean('Opportunities');
     // loop over each field
     foreach ($fields as $field => $rollup_field) {
         // get the field defs
         $field_defs = $bean->getFieldDefinition($field);
         // load the field type up
         $f = get_widget($field_defs['type']);
         // populate the row from the vardefs that were loaded
         $f->populateFromRow($field_defs);
         if ($f->formula == str_replace('{{field}}', $rollup_field, $oldFormula)) {
             $f->formula = str_replace('{{field}}', $rollup_field, $newFormula);
             // now lets save, since these are OOB field, we use StandardField
             $df = new StandardField($bean->module_name);
             $df->setup($bean);
             $f->module = $bean;
             $f->save($df);
         }
     }
     // lets fix up the data now to excluded closed lost
     $this->fixRollupAmountsToExcludeClosedLostValues();
 }
コード例 #5
0
 static function buildActionCache($silent = true)
 {
     if (!is_dir(ActionFactory::$action_directory)) {
         return false;
     }
     // First get a list of all the files in this directory.
     $entries = array();
     $actions = array();
     $javascript = "";
     foreach (SugarAutoLoader::getFilesCustom(ActionFactory::$action_directory) as $path) {
         $entry = basename($path);
         if (strtolower(substr($entry, -4)) != ".php" || in_array($entry, ActionFactory::$exclude_files)) {
             continue;
         }
         require_once $path;
         $className = substr($entry, 0, strlen($entry) - 4);
         $actionName = call_user_func(array($className, "getActionName"));
         $actions[$actionName] = array('class' => $className, 'file' => $path);
         $javascript .= call_user_func(array($className, "getJavascriptClass"));
         if (!$silent) {
             echo "added action {$actionName} <br/>";
         }
     }
     if (empty($actions)) {
         return "";
     }
     create_cache_directory("Expressions/actions_cache.php");
     write_array_to_file('actions', $actions, sugar_cached('Expressions/actions_cache.php'));
     ActionFactory::$loaded_actions = $actions;
     return $javascript;
 }
コード例 #6
0
 function canAddSession()
 {
     $this->archiveInactiveSessions();
     //we may not even have to check b/c the license could have the
     //license_enforce_portal_user_limit set to 0
     if ($this->getEnforcePortalUserLimit()) {
         $num_active = $this->getNumActiveSessions();
         $num_users = $this->getNumPortalUsers();
         $num = $num_users;
         $config = SugarAutoLoader::existingCustomOne('modules/Administration/ncc_config.php');
         if ($config) {
             require $config;
             $num = $ncc_config['value'];
         }
         if (!isset($num)) {
             $num = 1.2;
         }
         $num = $num * $num_users;
         $GLOBALS['log']->debug("Number of valid concurrent sessions: " . $num);
         if ($num_active < $num) {
             return true;
         } else {
             return false;
         }
     } else {
         //if we are not enforcing the portal user limit then
         //do not worry about how many active sessions we can have, just assume we can add one.
         return true;
     }
 }
コード例 #7
0
 /**
  * This function will load the meta-data based on a given file path
  *
  * Dashlet Meta Data Loading Process
  * 1. Check if a user customized version exists in user preferences (convert the file path to a guid) and load that one if availble
  * 2. Check if a system customized version exists in custom/$dashletMetaDataFile and load that one
  * 3. Otherwise load the provided file path
  *
  * If the file path is not found or if the meta-data is invalid it will throw an error and return false
  *
  * @param string $filePath path to the meta data
  * @return bool success or failure of load
  */
 public function load($filePath)
 {
     $filePath = SugarAutoLoader::existingCustomOne($filePath);
     $dashletdefs = array();
     include $filePath;
     $this->dashletdefs = $dashletdefs;
 }
コード例 #8
0
 public function display()
 {
     require_once "modules/Calendar/CalendarUtils.php";
     $module = $this->view_object_map['currentModule'];
     $_REQUEST['module'] = $module;
     $base = 'modules/' . $module . '/metadata/';
     $source = SugarAutoLoader::existingCustomOne($base . 'editviewdefs.php', $base . 'quickcreatedefs.php');
     $GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], $module);
     $tpl = SugarAutoLoader::existingCustomOne('include/EditView/EditView.tpl');
     $this->ev = new EditView();
     $this->ev->view = "QuickCreate";
     $this->ev->ss = new Sugar_Smarty();
     $this->ev->formName = "CalendarEditView";
     $this->ev->setup($module, $this->bean, $source, $tpl);
     $this->ev->defs['templateMeta']['form']['headerTpl'] = "modules/Calendar/tpls/editHeader.tpl";
     $this->ev->defs['templateMeta']['form']['footerTpl'] = "modules/Calendar/tpls/empty.tpl";
     $this->ev->process(false, "CalendarEditView");
     if (!empty($this->bean->id)) {
         require_once 'include/json_config.php';
         $jsonConfig = new json_config();
         $grJavascript = $jsonConfig->getFocusData($module, $this->bean->id);
     } else {
         $grJavascript = "";
     }
     $jsonArr = array('access' => 'yes', 'module_name' => $this->bean->module_dir, 'record' => $this->bean->id, 'edit' => $this->editable, 'html' => $this->ev->display(false, true), 'gr' => $grJavascript, 'acl' => array('delete' => $this->bean->aclAccess('delete')));
     if (!empty($this->view_object_map['repeatData'])) {
         $jsonArr = array_merge($jsonArr, array("repeat" => $this->view_object_map['repeatData']));
     }
     ob_clean();
     echo json_encode($jsonArr);
 }
コード例 #9
0
ファイル: view.spot.php プロジェクト: jglaine/sugar761-ent
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     $offset = -1;
     $modules = array();
     if (!empty($_REQUEST['zoom'])) {
         $modules = array($_REQUEST['zoom']);
         if (isset($_REQUEST['offset'])) {
             $offset = $_REQUEST['offset'];
         }
     }
     $limit = !empty($GLOBALS['sugar_config']['max_spotresults_initial']) ? $GLOBALS['sugar_config']['max_spotresults_initial'] : 5;
     if ($offset !== -1) {
         $limit = !empty($GLOBALS['sugar_config']['max_spotresults_more']) ? $GLOBALS['sugar_config']['max_spotresults_more'] : 20;
     }
     $options = array('current_module' => $this->module, 'modules' => $modules);
     $searchEngine = SugarSearchEngineFactory::getInstance('', array(), true);
     $trimmed_query = trim($_REQUEST['q']);
     $rs = $searchEngine->search($trimmed_query, $offset, $limit, $options);
     $formattedResults = $this->formatSearchResultsToDisplay($rs, $offset, $trimmed_query);
     $query_encoded = urlencode($trimmed_query);
     $displayMoreForModule = $formattedResults['displayMoreForModule'];
     $displayResults = $formattedResults['displayResults'];
     $ss = new Sugar_Smarty();
     $ss->assign('displayResults', $displayResults);
     $ss->assign('displayMoreForModule', $displayMoreForModule);
     $ss->assign('appStrings', $GLOBALS['app_strings']);
     $ss->assign('appListStrings', $GLOBALS['app_list_strings']);
     $ss->assign('queryEncoded', $query_encoded);
     $ss->assign('test', "#bwc/index.php?module=Home&action=UnifiedSearch&search_form=false&advanced=false&query_string=" . $query_encoded);
     echo $ss->fetch(SugarAutoLoader::existingCustomOne('include/SearchForm/tpls/SugarSpot.tpl'));
 }
コード例 #10
0
 /**
  * @static
  * @param string $name
  * @param array $config
  * @return mixed (bool|SugarSearchEngineInterface)
  */
 protected static function setupEngine($name = '', $config = array())
 {
     // if name is empty set name and config
     if (empty($name) && !empty($GLOBALS['sugar_config']['full_text_engine'])) {
         $name = self::getFTSEngineNameFromConfig();
         $config = $GLOBALS['sugar_config']['full_text_engine'][$name];
     }
     // if config is empty set config
     if (empty($config) && !empty($GLOBALS['sugar_config']['full_text_engine'][$name])) {
         $config = $GLOBALS['sugar_config']['full_text_engine'][$name];
     }
     $paths = array("include/SugarSearchEngine/{$name}/SugarSearchEngine{$name}.php" => $name, "include/SugarSearchEngine/SugarSearchEngine.php" => '');
     // object loader using custom override
     foreach ($paths as $path => $baseClass) {
         if (SugarAutoLoader::requireWithCustom($path, true)) {
             $engineClass = SugarAutoLoader::customClass("SugarSearchEngine{$baseClass}");
             $engineInstance = new $engineClass($config);
             if ($engineInstance instanceof SugarSearchEngineInterface) {
                 $GLOBALS['log']->info("Found Sugar Search Engine: " . get_class($engineInstance));
                 return $engineInstance;
             }
         }
     }
     return false;
 }
コード例 #11
0
    public function run()
    {
        $path = 'custom/Extension/application/Ext';
        $file_name = 'project_unhide.php';
        if (version_compare($this->to_version, '7.2.2.0', '=') && SugarAutoLoader::fileExists($path . '/Include/' . $file_name)) {
            $file_contents = '
<?php
// WARNING: The contents of this file are auto-generated.

$moduleList[] = \'Project\';
$moduleList[] = \'ProjectTask\';

if (isset($modInvisList) && is_array($modInvisList)) {
    foreach($modInvisList as $key => $mod) {
        if($mod == \'Project\' || $mod == \'ProjectTask\') {
            unset($modInvisList[$key]);
        }
    }
}
';
            // enable the project module in the upgrade instance
            global $moduleList, $modInvisList;
            $moduleList[] = 'ProjectTask';
            foreach ($modInvisList as $key => $mod) {
                if ($mod == 'Project' || $mod == 'ProjectTask') {
                    unset($modInvisList[$key]);
                }
            }
            sugar_file_put_contents($path . '/Include/' . $file_name, $file_contents);
        }
    }
コード例 #12
0
ファイル: autoloader.php プロジェクト: samus-aran/SuiteCRM
 /**
  * @param $class
  * @return bool
  */
 public static function autoload($class)
 {
     $uclass = ucfirst($class);
     if (!empty(self::$noAutoLoad[$class])) {
         return false;
     }
     if (!empty(self::$map[$uclass])) {
         require_once self::$map[$uclass];
         return true;
     }
     if (empty(self::$moduleMap)) {
         if (isset($GLOBALS['beanFiles'])) {
             self::$moduleMap = $GLOBALS['beanFiles'];
         } else {
             include 'include/modules.php';
             self::$moduleMap = $beanFiles;
         }
     }
     if (!empty(self::$moduleMap[$class]) && file_exists(self::$moduleMap[$class])) {
         require_once self::$moduleMap[$class];
         return true;
     }
     $viewPath = self::getFilenameForViewClass($class);
     if (!empty($viewPath)) {
         require_once $viewPath;
         return true;
     }
     $reportWidget = self::getFilenameForSugarWidget($class);
     if (!empty($reportWidget)) {
         require_once $reportWidget;
         return true;
     }
     return false;
 }
コード例 #13
0
 public function export(ServiceBase $api, $args = array())
 {
     ob_start();
     // Load up a seed bean
     $seed = BeanFactory::getBean('ForecastWorksheets');
     if (!$seed->ACLAccess('list')) {
         throw new SugarApiExceptionNotAuthorized('No access to view records for module: ' . $seed->object_name);
     }
     $args['timeperiod_id'] = isset($args['timeperiod_id']) ? $args['timeperiod_id'] : TimePeriod::getCurrentId();
     $args['user_id'] = isset($args['user_id']) ? $args['user_id'] : $api->user->id;
     if (!isset($args['filters'])) {
         $args['filters'] = array();
     } elseif (!is_array($args['filters'])) {
         $args['filters'] = array($args['filters']);
     }
     // don't allow encoding to html for data used in export
     $args['encode_to_html'] = false;
     // base file and class name
     $file = 'include/SugarForecasting/Export/Individual.php';
     $klass = 'SugarForecasting_Export_Individual';
     // check for a custom file exists
     SugarAutoLoader::requireWithCustom($file);
     $klass = SugarAutoLoader::customClass($klass);
     // create the class
     /* @var $obj SugarForecasting_Export_AbstractExport */
     $obj = new $klass($args);
     $content = $obj->process($api);
     ob_end_clean();
     return $this->doExport($api, $obj->getFilename(), $content);
 }
コード例 #14
0
ファイル: view.edit.php プロジェクト: jglaine/sugar761-ent
 /**
  * @see SugarView::preDisplay()
  */
 public function preDisplay()
 {
     $metadataFile = $this->getMetaDataFile();
     $this->ev = $this->getEditView();
     $this->ev->ss = $this->ss;
     $this->ev->setup($this->module, $this->bean, $metadataFile, SugarAutoLoader::existingCustomOne('include/EditView/EditView.tpl'));
 }
コード例 #15
0
 function EmailSugarFieldTeamsetCollection($bean, $field_defs, $customMethod = "", $form_name = 'EditView')
 {
     parent::ViewSugarFieldTeamsetCollection(false);
     $this->tpl_path = SugarAutoLoader::existingCustomOne('include/SugarFields/Fields/Teamset/TeamsetCollectionEmailView.tpl');
     //$this->module_dir = $module;
     $this->bean_id = $bean->id;
     $this->form_name = $form_name;
     $this->customMethod = $customMethod;
     $this->bean = $bean;
     if (empty($this->bean)) {
         echo "Unable to load module {$module}";
         return;
     }
     //Initialize displayParams
     $this->displayParams['formName'] = $this->form_name;
     $this->displayParams['primaryChecked'] = true;
     $this->vardef = $field_defs['team_name'];
     $this->name = $this->vardef['name'];
     $this->related_module = 'Teams';
     $this->value_name = 'team_set_id_values';
     $this->numFields = 1;
     $this->ss = new Sugar_Smarty();
     $this->extra_var = array();
     $this->field_to_name_array = array();
 }
コード例 #16
0
ファイル: Individual.php プロジェクト: jglaine/sugar761-ent
 public function process()
 {
     // fetch the data from the filter end point
     $file = 'modules/ForecastWorksheets/clients/base/api/ForecastWorksheetsFilterApi.php';
     $klass = 'ForecastWorksheetsFilterApi';
     SugarAutoLoader::requireWithCustom('include/api/RestService.php');
     SugarAutoLoader::requireWithCustom($file);
     $klass = SugarAutoLoader::customClass($klass);
     /* @var $obj ForecastWorksheetsFilterApi */
     $obj = new $klass();
     $api = new RestService();
     $api->user = $GLOBALS['current_user'];
     $data = $obj->forecastWorksheetsGet($api, array('module' => 'ForecastWorksheets', 'timeperiod_id' => $this->getArg('timeperiod_id'), 'user_id' => $this->getArg('user_id')));
     $fields_array = array('date_closed' => 'date_closed', 'sales_stage' => 'sales_stage', 'name' => 'name', 'commit_stage' => 'commit_stage', 'probability' => 'probability');
     $admin = BeanFactory::getBean('Administration');
     $settings = $admin->getConfigForModule('Forecasts');
     if ($settings['show_worksheet_best']) {
         $fields_array['best_case'] = 'best_case';
     }
     if ($settings['show_worksheet_likely']) {
         $fields_array['likely_case'] = 'likely_case';
     }
     if ($settings['show_worksheet_worst']) {
         $fields_array['worst_case'] = 'worst_case';
     }
     $seed = BeanFactory::getBean('ForecastWorksheets');
     return $this->getContent($data['records'], $seed, $fields_array, 'commit_stage', $this->getArg('filters'));
 }
コード例 #17
0
 function build()
 {
     //we will assume that if the ListView.html file exists we will want to use that one
     if (SugarAutoLoader::fileExists('modules/' . $this->module . '/ListView.html')) {
         $this->type = 1;
         $this->lv = new ListView();
         $this->template = 'modules/' . $this->module . '/ListView.html';
     } else {
         $metadataFile = SugarAutoLoader::loadWithMetafiles($this->module, 'listviewdefs');
         if ($metadataFile) {
             require $metadataFile;
         }
         SugarACL::listFilter($this->module, $listViewDefs[$this->module], array("owner_override" => true));
         $this->lv = new ListViewSmarty();
         $displayColumns = array();
         if (!empty($_REQUEST['displayColumns'])) {
             foreach (explode('|', $_REQUEST['displayColumns']) as $num => $col) {
                 if (!empty($listViewDefs[$this->module][$col])) {
                     $displayColumns[$col] = $listViewDefs[$this->module][$col];
                 }
             }
         } else {
             if (isset($listViewDefs[$this->module])) {
                 foreach ($listViewDefs[$this->module] as $col => $params) {
                     if (!empty($params['default']) && $params['default']) {
                         $displayColumns[$col] = $params;
                     }
                 }
             }
         }
         $this->lv->displayColumns = $displayColumns;
         $this->type = 2;
         $this->template = 'include/ListView/ListViewGeneric.tpl';
     }
 }
コード例 #18
0
ファイル: Localization.php プロジェクト: jglaine/sugar761-ent
 /**
  * Method to get Localization object
  *
  * @return Localization
  */
 public static function getObject()
 {
     $class = __CLASS__;
     if (SugarAutoLoader::load('custom/include/Localization/Localization.php')) {
         $class = SugarAutoLoader::customClass($class);
     }
     return new $class();
 }
コード例 #19
0
 public function __construct()
 {
     global $dictionary;
     if (isset($this->module_dir) && isset($this->object_name) && !isset($dictionary[$this->object_name])) {
         require SugarAutoLoader::existingCustomOne('metadata/workflow_schedulesMetaData.php');
     }
     parent::__construct();
 }
コード例 #20
0
 /**
  * Returns a list of banned modules for PdfManager
  *
  * @return array
  */
 public static function getBannnedModules()
 {
     $bannedPdfManagerModules = array();
     foreach (SugarAutoLoader::existingCustom('modules/PdfManager/metadata/pdfmanagermodulesdefs.php') as $file) {
         include $file;
     }
     return $bannedPdfManagerModules;
 }
コード例 #21
0
 /**
  * include a source class file.
  * @param string $class a class file to include.
  */
 public static function loadClass($class, $type)
 {
     $dir = str_replace('_', '/', $class);
     $parts = explode("/", $dir);
     $file = "{$type}/{$dir}/" . $parts[count($parts) - 1] . '.php';
     if (!SugarAutoLoader::requireWithCustom("modules/Connectors/connectors/{$file}")) {
         return SugarAutoLoader::requireWithCustom("connectors/{$file}");
     }
     return true;
 }
コード例 #22
0
ファイル: logic_utils.php プロジェクト: jglaine/sugar761-ent
function write_logic_file($module_name, $contents)
{
    $file = "modules/" . $module_name . '/logic_hooks.php';
    $file = create_custom_directory($file);
    $fp = sugar_fopen($file, 'wb');
    fwrite($fp, $contents);
    fclose($fp);
    SugarAutoLoader::addToMap($file);
    //end function write_logic_file
}
コード例 #23
0
ファイル: view.classic.php プロジェクト: jglaine/sugar761-ent
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     // Call SugarController::getActionFilename to handle case sensitive file names
     $file = SugarController::getActionFilename($this->action);
     $classic = SugarAutoLoader::existingCustomOne('modules/' . $this->module . '/' . $file . '.php');
     if ($classic) {
         $this->includeClassicFile($classic);
         return true;
     }
     return false;
 }
コード例 #24
0
 /**
  * getQuickSearchDefaults
  *
  * This is a static function to get an instance of QuickSearchDefaults object
  *
  * @param array $lookup Array with custom files and class names for custom QuickSearchDefaults classes, optional
  * @return QuickSearchDefaults
  */
 public static function getQuickSearchDefaults(array $lookup = array())
 {
     $lookup['custom/include/QuickSearchDefaults.php'] = 'QuickSearchDefaultsCustom';
     foreach ($lookup as $file => $klass) {
         if (SugarAutoLoader::fileExists($file)) {
             require_once $file;
             return new $klass();
         }
     }
     return new QuickSearchDefaults();
 }
コード例 #25
0
 public function testloadAll()
 {
     //execute the method and check if it works and doesn't throws an exception
     //this method only includes file so there is no output to test.
     try {
         SugarAutoLoader::loadAll();
         $this->assertTrue(true);
     } catch (Exception $e) {
         $this->fail();
     }
 }
コード例 #26
0
 public static function retrieveReportsSearchDefs()
 {
     $searchdefs = array();
     $searchFields = array();
     $defs = SugarAutoLoader::loadWithMetafiles('Reports', 'searchdefs');
     if ($defs) {
         require $defs;
     }
     $searchFields = SugarAutoLoader::loadSearchFields('Reports');
     return array('searchdefs' => $searchdefs, 'searchFields' => $searchFields);
 }
コード例 #27
0
ファイル: plugin_utils.php プロジェクト: jglaine/sugar761-ent
 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;
 }
コード例 #28
0
    function getJavascript()
    {
        global $action;
        if (!ACLController::moduleSupportsACL($this->module)) {
            return '';
        }
        $script = "<SCRIPT>\n//BEGIN ACL JAVASCRIPT\n";
        if ($action == 'DetailView') {
            if (!ACLController::checkAccess($this->module, 'edit', $this->is_owner)) {
                $script .= <<<EOQ
\t\t\t\t\t\tif(typeof(document.DetailView) != 'undefined'){
\t\t\t\t\t\t\tif(typeof(document.DetailView.elements['Edit']) != 'undefined'){
\t\t\t\t\t\t\t\tdocument.DetailView.elements['Edit'].disabled = 'disabled';
\t\t\t\t\t\t\t}
\t\t\t\t\t\t\tif(typeof(document.DetailView.elements['Duplicate']) != 'undefined'){
\t\t\t\t\t\t\t\tdocument.DetailView.elements['Duplicate'].disabled = 'disabled';
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
EOQ;
            }
            if (!ACLController::checkAccess($this->module, 'delete', $this->is_owner)) {
                $script .= <<<EOQ
\t\t\t\t\t\tif(typeof(document.DetailView) != 'undefined'){
\t\t\t\t\t\t\tif(typeof(document.DetailView.elements['Delete']) != 'undefined'){
\t\t\t\t\t\t\t\tdocument.DetailView.elements['Delete'].disabled = 'disabled';
\t\t\t\t\t\t\t}
\t\t\t\t\t\t}
EOQ;
            }
        }
        if (SugarAutoLoader::fileExists('modules/' . $this->module . '/metadata/acldefs.php')) {
            include 'modules/' . $this->module . '/metadata/acldefs.php';
            foreach ($acldefs[$this->module]['forms'] as $form_name => $form) {
                foreach ($form as $field_name => $field) {
                    if ($field['app_action'] == $action) {
                        switch ($form_name) {
                            case 'by_id':
                                $script .= $this->getFieldByIdScript($field_name, $field);
                                break;
                            case 'by_name':
                                $script .= $this->getFieldByNameScript($field_name, $field);
                                break;
                            default:
                                $script .= $this->getFieldByFormScript($form_name, $field_name, $field);
                                break;
                        }
                    }
                }
            }
        }
        $script .= '</SCRIPT>';
        return $script;
    }
コード例 #29
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     require_once 'include/connectors/utils/ConnectorUtils.php';
     $source = $_REQUEST['source_id'];
     $sources = ConnectorUtils::getConnectors();
     $modules_sources = ConnectorUtils::getDisplayConfig();
     $enabled_modules = array();
     $disabled_modules = array();
     //Find all modules this source has been enabled for
     foreach ($modules_sources as $module => $mapping) {
         foreach ($modules_sources[$module] as $entry) {
             if ($entry == $source) {
                 $enabled_modules[$module] = isset($GLOBALS['app_list_strings']['moduleList'][$module]) ? $GLOBALS['app_list_strings']['moduleList'][$module] : $module;
             }
         }
     }
     global $moduleList, $beanList;
     //Do filtering here?
     $count = 0;
     global $current_user;
     $access = $current_user->getDeveloperModules();
     foreach (SugarAutoLoader::getDirFiles("modules", true) as $e) {
         //Strip the 'modules/' portion out from beginning of $e
         $e = substr($e, 8);
         if (empty($enabled_modules[$e]) && SugarAutoLoader::existingCustomOne("modules/{$e}/metadata/studio.php") && SugarAutoLoader::fileExists('modules/' . $e . '/metadata/detailviewdefs.php') && isset($GLOBALS['beanList'][$e]) && (in_array($e, $access) || is_admin($current_user))) {
             $disabled_modules[$e] = isset($GLOBALS['app_list_strings']['moduleList'][$e]) ? $GLOBALS['app_list_strings']['moduleList'][$e] : $e;
         }
     }
     $s = SourceFactory::getSource($source);
     // Not all sources can be connected to all modules
     $enabled_modules = $s->filterAllowedModules($enabled_modules);
     $disabled_modules = $s->filterAllowedModules($disabled_modules);
     asort($enabled_modules);
     asort($disabled_modules);
     //$enabled = $json->encode($enabled_modules);
     //$disabled = $json->encode($disabled_modules);
     //$script = "addTable('{$module}', '{$enabled}', '{$disabled}', '{$source}', '{$GLOBALS['theme']}');\n";
     //$this->ss->assign('new_modules_sources', $modules_sources);
     //$this->ss->assign('dynamic_script', $script);
     $this->ss->assign('enabled_modules', $enabled_modules);
     $this->ss->assign('disabled_modules', $disabled_modules);
     $this->ss->assign('source_id', $source);
     $this->ss->assign('mod', $GLOBALS['mod_strings']);
     $this->ss->assign('APP', $GLOBALS['app_strings']);
     $this->ss->assign('theme', $GLOBALS['theme']);
     $this->ss->assign('external', !empty($sources[$source]['eapm']));
     $this->ss->assign('externalOnly', !empty($sources[$source]['eapm']['only']));
     // We don't want to tell the user to set the properties of the connector if there aren't any
     $fields = $s->getRequiredConfigFields();
     $this->ss->assign('externalHasProperties', !empty($fields));
     $this->ss->assign('externalChecked', !empty($sources[$source]['eapm']['enabled']) ? " checked" : "");
     echo $this->ss->fetch($this->getCustomFilePathIfExists('modules/Connectors/tpls/display_properties.tpl'));
 }
コード例 #30
0
ファイル: Helper.php プロジェクト: jglaine/sugar761-ent
 /**
  * Helper method to load SugarMetric_Manager
  *
  * SugarAutoLoader is not available only in case of entryPoint = "getYUIComboFile"
  * @see include/preDispatch.php
  */
 public static function loadManagerClass()
 {
     if (class_exists('SugarAutoLoader')) {
         SugarAutoLoader::requireWithCustom('include/SugarMetric/Manager.php');
     } else {
         if (file_exists('custom/include/SugarMetric/Manager.php')) {
             require_once 'custom/include/SugarMetric/Manager.php';
         } elseif (file_exists('include/SugarMetric/Manager.php')) {
             require_once 'include/SugarMetric/Manager.php';
         }
     }
 }