/**
  * Examine the wireless_module_registry to determine which modules have been enabled for the mobile view.
  *
  * @param array $availModules An array of all the modules the user already has access to.
  * @return array Modules enalbed for mobile view.
  */
 function get_visible_mobile_modules($availModules)
 {
     foreach (SugarAutoLoader::existingCustom('include/MVC/Controller/wireless_module_registry.php') as $file) {
         require $file;
     }
     return $this->getModulesFromList($wireless_module_registry, $availModules);
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
 /**
  * Load the view_<view>_config.php file which holds options used by the view.
  */
 function _loadConfig(&$view, $type)
 {
     $view_config_custom = array();
     $view_config_module = array();
     $view_config_root_cstm = array();
     $view_config_root = array();
     $view_config_app = array();
     $config_file_name = 'view.' . $type . '.config.php';
     $view_config = sugar_cache_retrieve("VIEW_CONFIG_FILE_" . $view->module . "_TYPE_" . $type);
     if (!$view_config) {
         $view_config_all = array('actions' => array(), 'req_params' => array());
         foreach (SugarAutoLoader::existingCustom('include/MVC/View/views/view.config.php', 'include/MVC/View/views/' . $config_file_name, 'modules/' . $view->module . '/views/' . $config_file_name) as $file) {
             $view_config = array();
             require $file;
             if (!empty($view_config['actions'])) {
                 $view_config_all['actions'] = array_merge($view_config_all['actions'], $view_config['actions']);
             }
             if (!empty($view_config['req_params'])) {
                 $view_config_all['req_params'] = array_merge($view_config_all['req_params'], $view_config['req_params']);
             }
         }
         $view_config = $view_config_all;
         sugar_cache_put("VIEW_CONFIG_FILE_" . $view->module . "_TYPE_" . $type, $view_config);
     }
     $action = strtolower($view->action);
     $config = null;
     if (!empty($view_config['req_params'])) {
         //try the params first
         foreach ($view_config['req_params'] as $key => $value) {
             if (!empty($_REQUEST[$key]) && $_REQUEST[$key] == "false") {
                 $_REQUEST[$key] = false;
             }
             if (!empty($_REQUEST[$key])) {
                 if (!is_array($value['param_value'])) {
                     if ($value['param_value'] == $_REQUEST[$key]) {
                         $config = $value['config'];
                         break;
                     }
                 } else {
                     foreach ($value['param_value'] as $v) {
                         if ($v == $_REQUEST[$key]) {
                             $config = $value['config'];
                             break;
                         }
                     }
                 }
             }
         }
     }
     if ($config == null && !empty($view_config['actions']) && !empty($view_config['actions'][$action])) {
         $config = $view_config['actions'][$action];
     }
     if ($config != null) {
         $view->options = $config;
     }
 }
Ejemplo n.º 4
0
 /**
  * Return the list query used by the list views and export button. Next generation of create_new_list_query function.
  *
  * Override this function to return a custom query.
  *
  * @param string $order_by custom order by clause
  * @param string $where custom where clause
  * @param array $filter Optional
  * @param array $params Optional     *
  * @param int $show_deleted Optional, default 0, show deleted records is set to 1.
  * @param string $join_type
  * @param boolean $return_array Optional, default false, response as array
  * @param object $parentbean creating a subquery for this bean.
  * @param boolean $singleSelect Optional, default false.
  * @return String select query string, optionally an array value will be returned if $return_array= true.
  * @deprecated Use SugarQuery & $this->fetchFromQuery() instead
  */
 function create_new_list_query($order_by, $where, $filter = array(), $params = array(), $show_deleted = 0, $join_type = '', $return_array = false, $parentbean = null, $singleSelect = false, $ifListForExport = false)
 {
     $favorites = !empty($params['favorites']) ? $params['favorites'] : 0;
     global $beanFiles, $beanList;
     $selectedFields = array();
     $secondarySelectedFields = array();
     $ret_array = array();
     $distinct = '';
     $options = array('where_condition' => true);
     $this->addVisibilityWhere($where, $options);
     if (!empty($params['distinct'])) {
         $distinct = ' DISTINCT ';
     }
     if (empty($filter)) {
         $ret_array['select'] = " SELECT {$distinct} {$this->table_name}.* ";
     } else {
         $ret_array['select'] = " SELECT {$distinct} {$this->table_name}.id ";
     }
     $ret_array['from'] = " FROM {$this->table_name} ";
     $this->addVisibilityFrom($ret_array['from'], $options);
     $ret_array['from_min'] = $ret_array['from'];
     $ret_array['secondary_from'] = $ret_array['from'];
     $ret_array['where'] = '';
     $ret_array['order_by'] = '';
     //secondary selects are selects that need to be run after the primary query to retrieve additional info on main
     if ($singleSelect) {
         $ret_array['secondary_select'] =& $ret_array['select'];
         $ret_array['secondary_from'] =& $ret_array['from'];
     } else {
         $ret_array['secondary_select'] = '';
     }
     $custom_join = $this->getCustomJoin(empty($filter) ? true : $filter);
     if (!isset($params['include_custom_fields']) || $params['include_custom_fields']) {
         $ret_array['select'] .= $custom_join['select'];
     }
     $ret_array['from'] .= $custom_join['join'];
     // Bug 52490 - Captivea (Sve) - To be able to add custom fields inside where clause in a subpanel
     $ret_array['from_min'] .= $custom_join['join'];
     $jtcount = 0;
     //LOOP AROUND FOR FIXIN VARDEF ISSUES
     foreach (SugarAutoLoader::existingCustom('include/VarDefHandler/listvardefoverride.php') as $file) {
         require $file;
     }
     $joined_tables = array();
     if (!empty($params['joined_tables'])) {
         foreach ($params['joined_tables'] as $table) {
             $joined_tables[$table] = 1;
         }
     }
     if (!empty($filter)) {
         $filterKeys = array_keys($filter);
         if (is_numeric($filterKeys[0])) {
             $fields = array();
             foreach ($filter as $field) {
                 $field = strtolower($field);
                 if (isset($this->field_defs[$field])) {
                     $fields[$field] = $this->field_defs[$field];
                 } else {
                     $fields[$field] = array('force_exists' => true);
                 }
             }
         } else {
             $fields = $filter;
         }
         //remove out id field so we don't duplicate it
         if (isset($fields['id'])) {
             unset($fields['id']);
         }
         /* add mandatory fields */
         foreach ($this->field_defs as $field => $value) {
             if (!empty($value['force_exists'])) {
                 $fields[$field] = $value;
             }
         }
     } else {
         $fields = $this->field_defs;
     }
     $used_join_key = array();
     $relate_field_sort = array();
     foreach ($fields as $field => $value) {
         //alias is used to alias field names
         $alias = '';
         if (isset($value['alias'])) {
             $alias = ' as ' . $value['alias'] . ' ';
         }
         if (empty($this->field_defs[$field]) || !empty($value['force_blank'])) {
             if (!empty($filter) && isset($filter[$field]['force_exists']) && $filter[$field]['force_exists']) {
                 if (isset($filter[$field]['force_default'])) {
                     $ret_array['select'] .= ", {$filter[$field]['force_default']} {$field} ";
                 } else {
                     //spaces are a fix for length issue problem with unions.  The union only returns the maximum number of characters from the first select statement.
                     $ret_array['select'] .= ", '                                                                                                                                                                                                                                                              ' {$field} ";
                 }
             }
             continue;
         } else {
             $data = $this->field_defs[$field];
         }
         //ignore fields that are a part of the collection and a field has been removed as a result of
         //layout customization.. this happens in subpanel customizations, use case, from the contacts subpanel
         //in opportunities module remove the contact_role/opportunity_role field.
         $process_field = true;
         if (!empty($data['relationship_fields'])) {
             foreach ($data['relationship_fields'] as $field_name) {
                 if (!isset($fields[$field_name])) {
                     $process_field = false;
                 }
             }
         }
         if (!$process_field) {
             continue;
         }
         if ((!isset($data['source']) || $data['source'] == 'db') && (!empty($alias) || !empty($filter))) {
             $ret_array['select'] .= ", {$this->table_name}.{$field} {$alias}";
             $selectedFields["{$this->table_name}.{$field}"] = true;
         } else {
             if ((!isset($data['source']) || $data['source'] == 'custom_fields') && (!empty($alias) || !empty($filter))) {
                 //add this column only if it has NOT already been added to select statement string
                 $colPos = strpos($ret_array['select'], "{$this->table_name}" . "_cstm" . ".{$field}");
                 if (!$colPos || $colPos < 0) {
                     $ret_array['select'] .= ", {$this->table_name}" . "_cstm" . ".{$field} {$alias}";
                 }
                 $selectedFields["{$this->table_name}.{$field}"] = true;
             }
         }
         if ($data['type'] != 'relate' && isset($data['db_concat_fields'])) {
             $ret_array['select'] .= ", " . $this->db->concat($this->table_name, $data['db_concat_fields']) . " as {$field}";
             $selectedFields[$this->db->concat($this->table_name, $data['db_concat_fields'])] = true;
         }
         //Custom relate field or relate fields built in module builder which have no link field associated.
         if ($data['type'] == 'relate' && (isset($data['custom_module']) || isset($data['ext2']))) {
             $joinTableAlias = 'jt' . $jtcount;
             $withIdName = false;
             if (!empty($data['id_name'])) {
                 $tableName = isset($data['custom_module']) ? "{$this->table_name}_cstm" : $this->table_name;
                 if (strpos($ret_array['select'], "{$tableName}.{$data['id_name']}") === false) {
                     $withIdName = true;
                 }
             }
             $relateJoinInfo = $this->custom_fields->getRelateJoin($data, $joinTableAlias, $withIdName);
             $ret_array['select'] .= $relateJoinInfo['select'];
             $ret_array['from'] .= $relateJoinInfo['from'];
             //Replace any references to the relationship in the where clause with the new alias
             //If the link isn't set, assume that search used the local table for the field
             $searchTable = isset($data['link']) ? $relateJoinInfo['rel_table'] : $this->table_name;
             $field_name = $relateJoinInfo['rel_table'] . '.' . !empty($data['name']) ? $data['name'] : 'name';
             $where = preg_replace('/(^|[\\s(])' . $field_name . '/', '${1}' . $relateJoinInfo['name_field'], $where);
             $jtcount++;
         }
         //Parent Field
         if ($data['type'] == 'parent') {
             //See if we need to join anything by inspecting the where clause
             $match = preg_match('/(^|[\\s(])parent_(\\w+)_(\\w+)\\.name/', $where, $matches);
             if ($match) {
                 $joinTableAlias = 'jt' . $jtcount;
                 $joinModule = $matches[2];
                 $joinTable = $matches[3];
                 $localTable = $this->table_name;
                 if (!empty($data['custom_module'])) {
                     $localTable .= '_cstm';
                 }
                 $rel_mod = BeanFactory::getBean($joinModule);
                 $nameField = "{$joinTableAlias}.name";
                 if (isset($rel_mod->field_defs['name'])) {
                     $name_field_def = $rel_mod->field_defs['name'];
                     if (isset($name_field_def['db_concat_fields'])) {
                         $nameField = $this->db->concat($joinTableAlias, $name_field_def['db_concat_fields']);
                     }
                 }
                 $ret_array['select'] .= ", {$nameField} {$data['name']} ";
                 $ret_array['from'] .= " LEFT JOIN {$joinTable} {$joinTableAlias}\n                        ON {$localTable}.{$data['id_name']} = {$joinTableAlias}.id";
                 //Replace any references to the relationship in the where clause with the new alias
                 $where = preg_replace('/(^|[\\s(])parent_' . $joinModule . '_' . $joinTable . '\\.name/', '${1}' . $nameField, $where);
                 $jtcount++;
             }
         }
         if ($this->is_relate_field($field)) {
             $this->load_relationship($data['link']);
             if (!empty($this->{$data}['link'])) {
                 $params = array();
                 if (empty($join_type)) {
                     $params['join_type'] = ' LEFT JOIN ';
                 } else {
                     $params['join_type'] = $join_type;
                 }
                 if (isset($data['join_name'])) {
                     $params['join_table_alias'] = $data['join_name'];
                 } else {
                     $params['join_table_alias'] = 'jt' . $jtcount;
                 }
                 if (isset($data['join_link_name'])) {
                     $params['join_table_link_alias'] = $data['join_link_name'];
                 } else {
                     $params['join_table_link_alias'] = 'jtl' . $jtcount;
                 }
                 $join_primary = !isset($data['join_primary']) || $data['join_primary'];
                 $join = $this->{$data}['link']->getJoin($params, true);
                 $used_join_key[] = $join['rel_key'];
                 $table_joined = !empty($joined_tables[$params['join_table_alias']]) || !empty($joined_tables[$params['join_table_link_alias']]) && isset($data['link_type']) && $data['link_type'] == 'relationship_info';
                 //if rname is set to 'name', and bean files exist, then check if field should be a concatenated name
                 $rel_mod = $this->getRelatedBean($data['link']);
                 $rel_module = $rel_mod->module_name;
                 if (isset($data['rname']) && $data['rname'] === 'name' && !empty($rel_mod)) {
                     //if bean has first and last name fields, then name should be concatenated
                     if (isset($rel_mod->field_name_map['first_name']) && isset($rel_mod->field_name_map['last_name'])) {
                         $data['db_concat_fields'] = array(0 => 'first_name', 1 => 'last_name');
                     }
                 }
                 if ($join['type'] == 'many-to-many') {
                     if (empty($ret_array['secondary_select'])) {
                         $ret_array['secondary_select'] = " SELECT {$this->table_name}.id ref_id  ";
                         // TODO: The SC-2127 has been created to separate SugaBean and export feature.
                         if (!empty($rel_mod) && $join_primary && !$ifListForExport) {
                             if (isset($rel_mod->field_defs['assigned_user_id'])) {
                                 $ret_array['secondary_select'] .= " , " . $params['join_table_alias'] . ".assigned_user_id {$field}_owner, '{$rel_module}' {$field}_mod";
                             } else {
                                 if (isset($rel_mod->field_defs['created_by'])) {
                                     $ret_array['secondary_select'] .= " , " . $params['join_table_alias'] . ".created_by {$field}_owner , '{$rel_module}' {$field}_mod";
                                 }
                             }
                         }
                     }
                     $relate_query = $rel_mod->getRelateFieldQuery($data, $params['join_table_alias'], $secondarySelectedFields);
                     if ($relate_query['select'] && !isset($data['relationship_fields'])) {
                         $ret_array['secondary_select'] .= ', ' . $relate_query['select'];
                     }
                     if (!$singleSelect) {
                         $ret_array['select'] .= ", '                                                                                                                                                                                                                                                              ' {$field} ";
                     }
                     $count_used = 0;
                     foreach ($used_join_key as $used_key) {
                         if ($used_key == $join['rel_key']) {
                             $count_used++;
                         }
                     }
                     if ($count_used <= 1) {
                         //27416, the $ret_array['secondary_select'] should always generate, regardless the dbtype
                         // add rel_key only if it was not aready added
                         if (!$singleSelect && !isset($fields[$join['rel_key']])) {
                             $ret_array['select'] .= ", '                                    '  " . $join['rel_key'] . ' ';
                         }
                         $ret_array['secondary_select'] .= ', ' . $params['join_table_link_alias'] . '.' . $join['rel_key'] . ' ' . $join['rel_key'];
                         $secondarySelectedFields[$join['rel_key']] = true;
                     }
                     if (isset($data['relationship_fields'])) {
                         foreach ($data['relationship_fields'] as $r_name => $alias_name) {
                             if (!empty($secondarySelectedFields[$alias_name])) {
                                 continue;
                             }
                             $ret_array['secondary_select'] .= ', ' . $params['join_table_link_alias'] . '.' . $r_name . ' ' . $alias_name;
                             $secondarySelectedFields[$alias_name] = true;
                         }
                     }
                     if (!$table_joined) {
                         $ret_array['secondary_from'] .= ' ' . $join['join'] . ' AND ' . $params['join_table_alias'] . '.deleted=0';
                         if (isset($relate_query['join'])) {
                             $ret_array['secondary_from'] .= ' ' . $relate_query['join'];
                         }
                         if (isset($data['link_type']) && $data['link_type'] == 'relationship_info' && $parentbean instanceof SugarBean) {
                             $ret_array['secondary_where'] = $params['join_table_link_alias'] . '.' . $join['rel_key'] . "='" . $parentbean->id . "'";
                         }
                     }
                 } else {
                     $relate_query = $rel_mod->getRelateFieldQuery($data, $params['join_table_alias']);
                     $relate_field_sort[$field] = $relate_query['sort_fields'];
                     if ($relate_query['select']) {
                         $ret_array['select'] .= ', ' . $relate_query['select'];
                     }
                     if ($relate_query['join']) {
                         $join['join'] .= ' ' . $relate_query['join'];
                     }
                     if (isset($data['additionalFields'])) {
                         foreach ($data['additionalFields'] as $k => $v) {
                             if (!isset($fields[$v])) {
                                 $ret_array['select'] .= ' , ' . $params['join_table_alias'] . '.' . $k . ' ' . $v;
                             }
                         }
                     }
                     if (!$table_joined) {
                         $ret_array['from'] .= ' ' . $join['join'] . ' AND ' . $params['join_table_alias'] . '.deleted=0';
                         $rel_mod = BeanFactory::getBean($rel_module);
                         // TODO: The SC-2127 has been created to separate SugaBean and export feature.
                         if (!empty($rel_mod) && !$ifListForExport) {
                             if (isset($value['target_record_key']) && !empty($filter)) {
                                 $selectedFields[$this->table_name . '.' . $value['target_record_key']] = true;
                                 $ret_array['select'] .= " , {$this->table_name}.{$value['target_record_key']} ";
                             }
                             if (isset($rel_mod->field_defs['assigned_user_id'])) {
                                 $ret_array['select'] .= ' , ' . $params['join_table_alias'] . '.assigned_user_id ' . $field . '_owner';
                             } else {
                                 $ret_array['select'] .= ' , ' . $params['join_table_alias'] . '.created_by ' . $field . '_owner';
                             }
                             $ret_array['select'] .= "  , '" . $rel_module . "' " . $field . '_mod';
                         }
                     }
                 }
                 // To fix SOAP stuff where we are trying to retrieve all the accounts data where accounts.id = ..
                 // and this code changes accounts to jt4 as there is a self join with the accounts table.
                 //Martin fix #27494
                 if (isset($data['db_concat_fields'])) {
                     $buildWhere = false;
                     if (in_array('first_name', $data['db_concat_fields']) && in_array('last_name', $data['db_concat_fields'])) {
                         $exp = '/\\(\\s*?' . $data['name'] . '.*?\\%\'\\s*?\\)/';
                         if (preg_match($exp, $where, $matches)) {
                             $search_expression = $matches[0];
                             //Create three search conditions - first + last, first, last
                             $first_name_search = str_replace($data['name'], $params['join_table_alias'] . '.first_name', $search_expression);
                             $last_name_search = str_replace($data['name'], $params['join_table_alias'] . '.last_name', $search_expression);
                             $full_name_search = str_replace($data['name'], $this->db->concat($params['join_table_alias'], $data['db_concat_fields']), $search_expression);
                             $buildWhere = true;
                             $where = str_replace($search_expression, '(' . $full_name_search . ' OR ' . $first_name_search . ' OR ' . $last_name_search . ')', $where);
                         }
                     }
                     if (!$buildWhere) {
                         $db_field = $this->db->concat($params['join_table_alias'], $data['db_concat_fields']);
                         $where = preg_replace('/' . $data['name'] . '/', $db_field, $where);
                     }
                 } else {
                     $where = preg_replace('/(^|[\\s(])' . $data['name'] . '/', '${1}' . $params['join_table_alias'] . '.' . $data['rname'], $where);
                 }
                 if (!$table_joined) {
                     $joined_tables[$params['join_table_alias']] = 1;
                     $joined_tables[$params['join_table_link_alias']] = 1;
                 }
                 $jtcount++;
             }
         }
         if ($data['type'] == 'custom_query' && !empty($data['query_function'])) {
             $result = $this->callUserFunction($data['query_function'], $this, array($ret_array, $data));
             if (!empty($result)) {
                 $ret_array = $result;
                 $selectedFields[$field] = true;
             }
         }
     }
     if (!empty($filter)) {
         if (isset($this->field_defs['assigned_user_id']) && empty($selectedFields[$this->table_name . '.assigned_user_id'])) {
             $ret_array['select'] .= ", {$this->table_name}.assigned_user_id ";
         }
         if (isset($this->field_defs['created_by']) && empty($selectedFields[$this->table_name . '.created_by'])) {
             $ret_array['select'] .= ", {$this->table_name}.created_by ";
         }
         if (isset($this->field_defs['modified_user_id']) && empty($selectedFields[$this->table_name . '.modified_user_id'])) {
             $ret_array['select'] .= ", {$this->table_name}.modified_user_id ";
         }
         if (isset($this->field_defs['system_id']) && empty($selectedFields[$this->table_name . '.system_id'])) {
             $ret_array['select'] .= ", {$this->table_name}.system_id ";
         }
         if (isset($selectedFields[$this->table_name . '.team_id']) && isset($this->field_defs['team_set_id']) && empty($selectedFields[$this->table_name . '.team_set_id'])) {
             $ret_array['select'] .= ", {$this->table_name}.team_set_id ";
         }
     }
     if ($ifListForExport) {
         if (isset($this->field_defs['email1'])) {
             $ret_array['select'] .= ', email_addresses.email_address email1';
             $ret_array['select'] .= ', email_addresses.invalid_email';
             $ret_array['select'] .= ', email_addresses.opt_out email_opt_out';
             $ret_array['from'] .= " LEFT JOIN email_addr_bean_rel on {$this->table_name}.id = email_addr_bean_rel.bean_id and email_addr_bean_rel.bean_module='{$this->module_dir}' and email_addr_bean_rel.deleted=0 and email_addr_bean_rel.primary_address=1 LEFT JOIN email_addresses on email_addresses.id = email_addr_bean_rel.email_address_id ";
         }
     }
     if (!empty($favorites)) {
         $ret_array['select'] .= " , sfav.id my_favorite ";
         if ($favorites == 2) {
             $ret_array['from'] .= " INNER JOIN ";
         } else {
             $ret_array['from'] .= " LEFT JOIN ";
         }
         $ret_array['from'] .= " sugarfavorites sfav ON sfav.module ='{$this->module_dir}' AND sfav.record_id={$this->table_name}.id AND sfav.created_by='{$GLOBALS['current_user']->id}' AND sfav.deleted=0 ";
     }
     $where_auto = '1=1';
     if ($show_deleted == 0) {
         $where_auto = "{$this->table_name}.deleted=0";
     } else {
         if ($show_deleted == 1) {
             $where_auto = "{$this->table_name}.deleted=1";
         }
     }
     if ($where != "") {
         $ret_array['where'] = " where ({$where}) AND {$where_auto}";
     } else {
         $ret_array['where'] = " where {$where_auto}";
     }
     //make call to process the order by clause
     $order_by = $this->process_order_by($order_by, null, false, $relate_field_sort);
     if (!empty($order_by)) {
         $ret_array['order_by'] = " ORDER BY " . $order_by;
     }
     if ($singleSelect) {
         unset($ret_array['secondary_where']);
         unset($ret_array['secondary_from']);
         unset($ret_array['secondary_select']);
     }
     if ($return_array) {
         return $ret_array;
     }
     return $ret_array['select'] . $ret_array['from'] . $ret_array['where'] . $ret_array['order_by'];
 }
Ejemplo n.º 5
0
 /**
  * Generic load method to load mapping arrays.
  */
 private function loadMapping($var, $merge = false)
 {
     ${$var} = sugar_cache_retrieve("CONTROLLER_" . $var . "_" . $this->module);
     if (!${$var}) {
         if ($merge && !empty($this->{$var})) {
             ${$var} = $this->{$var};
         } else {
             ${$var} = array();
         }
         foreach (SugarAutoLoader::existingCustom("include/MVC/Controller/{$var}.php", "modules/{$this->module}/{$var}.php") as $file) {
             require $file;
         }
         $varname = str_replace(" ", "", ucwords(str_replace("_", " ", $var)));
         foreach (SugarAutoLoader::existing("custom/application/Ext/{$varname}/{$var}.ext.php", "custom/modules/{$this->module}/Ext/{$varname}/{$var}.ext.php") as $file) {
             require $file;
         }
         sugar_cache_put("CONTROLLER_" . $var . "_" . $this->module, ${$var});
     }
     $this->{$var} = ${$var};
 }
Ejemplo n.º 6
0
 * 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.
 */
global $current_user, $sugar_version, $sugar_config, $beanFiles;
require_once 'include/MySugar/MySugar.php';
// build dashlet cache file if not found
if (!is_file($cachefile = sugar_cached('dashlets/dashlets.php'))) {
    require_once 'include/Dashlets/DashletCacheBuilder.php';
    $dc = new DashletCacheBuilder();
    $dc->buildCache();
}
require_once $cachefile;
foreach (SugarAutoLoader::existingCustom('modules/Home/dashlets.php') as $file) {
    include $file;
}
$pages = $current_user->getPreference('pages', 'Home');
$dashlets = $current_user->getPreference('dashlets', 'Home');
$defaultHomepage = false;
// BEGIN fill in with default homepage and dashlet selections
$hasUserPreferences = !isset($pages) || empty($pages) || !isset($dashlets) || empty($dashlets) ? false : true;
if (!$hasUserPreferences) {
    // BEGIN 'My Sugar'
    $defaultHomepage = true;
    $dashlets = array();
    //list of preferences to move over and to where
    $prefstomove = array('mypbss_date_start' => 'MyPipelineBySalesStageDashlet', 'mypbss_date_end' => 'MyPipelineBySalesStageDashlet', 'mypbss_sales_stages' => 'MyPipelineBySalesStageDashlet', 'mypbss_chart_type' => 'MyPipelineBySalesStageDashlet', 'lsbo_lead_sources' => 'OpportunitiesByLeadSourceByOutcomeDashlet', 'lsbo_ids' => 'OpportunitiesByLeadSourceByOutcomeDashlet', 'pbls_lead_sources' => 'OpportunitiesByLeadSourceDashlet', 'pbls_ids' => 'OpportunitiesByLeadSourceDashlet', 'pbss_date_start' => 'PipelineBySalesStageDashlet', 'pbss_date_end' => 'PipelineBySalesStageDashlet', 'pbss_sales_stages' => 'PipelineBySalesStageDashlet', 'pbss_chart_type' => 'PipelineBySalesStageDashlet', 'obm_date_start' => 'OutcomeByMonthDashlet', 'obm_date_end' => 'OutcomeByMonthDashlet', 'obm_ids' => 'OutcomeByMonthDashlet');
    //upgrading from pre-5.0 homepage
    $old_columns = $current_user->getPreference('columns', 'home');
Ejemplo n.º 7
0
 /**
  * Gets a list of platforms found in the application.
  *
  * @return array
  */
 public static function getPlatformList()
 {
     $platforms = array();
     foreach (SugarAutoLoader::existingCustom('clients/platforms.php') as $file) {
         require $file;
     }
     return $platforms;
 }
Ejemplo n.º 8
0
 /**
  * Returns the URL for an image in the current theme. If not found in the current theme, will revert
  * to looking in the base theme.
  *
  * @param  string $jsFileName js file name
  * @param  bool   $returnURL if true, returns URL with unique image mark, otherwise returns path to the file
  * @return string path to js file
  */
 public function getJSURL($jsFileName, $returnURL = true)
 {
     if (isset($this->_jsCache[$jsFileName]) && sugar_is_file(sugar_cached($this->_jsCache[$jsFileName]))) {
         if ($returnURL) {
             return getJSPath("cache/" . $this->_jsCache[$jsFileName]);
         } else {
             return sugar_cached($this->_jsCache[$jsFileName]);
         }
     }
     $jsFileContents = '';
     $fullFileName = $this->getJSPath() . '/' . $jsFileName;
     $defaultFileName = $this->getDefaultJSPath() . '/' . $jsFileName;
     if (isset($this->parentTheme) && SugarThemeRegistry::get($this->parentTheme) instanceof SugarTheme && ($filename = SugarThemeRegistry::get($this->parentTheme)->getJSURL($jsFileName, false)) != '' && !in_array($jsFileName, $this->ignoreParentFiles)) {
         $jsFileContents .= file_get_contents($filename);
     } else {
         foreach (SugarAutoLoader::existingCustom($defaultFileName) as $jsFile) {
             $jsFileContents .= file_get_contents($jsFile);
         }
     }
     foreach (SugarAutoLoader::existingCustom($fullFileName) as $jsFile) {
         $jsFileContents .= file_get_contents($jsFile);
     }
     if (empty($jsFileContents)) {
         $GLOBALS['log']->warn("Javascript File {$jsFileName} not found");
         return false;
     }
     // create the cached file location
     $jsFilePath = create_cache_directory($fullFileName);
     // minify the js
     if (!inDeveloperMode() && !sugar_is_file(str_replace('.js', '-min.js', $jsFilePath))) {
         $jsFileContents = SugarMin::minify($jsFileContents);
         $jsFilePath = str_replace('.js', '-min.js', $jsFilePath);
         $fullFileName = str_replace('.js', '-min.js', $fullFileName);
     }
     // now write the js to cache
     sugar_file_put_contents($jsFilePath, $jsFileContents);
     $this->_jsCache[$jsFileName] = $fullFileName;
     if ($returnURL) {
         return getJSPath("cache/" . $fullFileName);
     }
     return sugar_cached($fullFileName);
 }
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     require_once 'modules/Administration/Forms.php';
     global $mod_strings;
     global $app_list_strings;
     global $app_strings;
     global $license;
     $configurator = new Configurator();
     $this->ss->assign('config', $configurator->config);
     $enabled_modules = array();
     $disabled_modules = array();
     // todo: should we move this config to another place?
     $wireless_not_supported_modules = array('Bugs', 'Campaigns', 'Contracts', 'KBDocuments', 'Prospects', 'Users', 'pmse_Business_Rules', 'pmse_Emails_Templates', 'pmse_Inbox', 'pmse_Project');
     // replicate the essential part of the behavior of the private loadMapping() method in SugarController
     foreach (SugarAutoLoader::existingCustom('include/MVC/Controller/wireless_module_registry.php') as $file) {
         require $file;
     }
     $moduleList = $GLOBALS['moduleList'];
     array_push($moduleList, 'Employees');
     foreach ($wireless_module_registry as $e => $def) {
         if (in_array($e, $moduleList) && !in_array($e, $wireless_not_supported_modules)) {
             $enabled_modules[$e] = empty($app_list_strings['moduleList'][$e]) ? $e : $app_list_strings['moduleList'][$e];
         }
     }
     // Employees should be in the mobile module list by default
     if (!empty($wireless_module_registry['Employees'])) {
         $enabled_modules['Employees'] = $app_strings['LBL_EMPLOYEES'];
     }
     require_once 'modules/ModuleBuilder/Module/StudioBrowser.php';
     $browser = new StudioBrowser();
     $browser->loadModules();
     foreach ($browser->modules as $e => $def) {
         if (empty($enabled_modules[$e]) && in_array($e, $GLOBALS['moduleList']) && !in_array($e, $wireless_not_supported_modules)) {
             $disabled_modules[$e] = empty($app_list_strings['moduleList'][$e]) ? $e : $app_list_strings['moduleList'][$e];
         }
     }
     if (empty($wireless_module_registry['Employees'])) {
         $disabled_modules['Employees'] = $app_strings['LBL_EMPLOYEES'];
     }
     // NOMAD-1793
     // Handling case when modules from initial wireless list are vanishing because they're not listed in studio browser.
     include 'include/MVC/Controller/wireless_module_registry.php';
     foreach ($wireless_module_registry as $moduleName => $def) {
         // not in any list
         if (empty($enabled_modules[$moduleName]) && empty($disabled_modules[$moduleName]) && !in_array($e, $wireless_not_supported_modules)) {
             // add module to disabled modules list
             $disabled_modules[$moduleName] = empty($app_list_strings['moduleList'][$moduleName]) ? $moduleName : $app_list_strings['moduleList'][$moduleName];
         }
     }
     $json_enabled = array();
     foreach ($enabled_modules as $mod => $label) {
         $json_enabled[] = array("module" => $mod, 'label' => $label);
     }
     $json_disabled = array();
     foreach ($disabled_modules as $mod => $label) {
         $json_disabled[] = array("module" => $mod, 'label' => $label);
     }
     // We need to grab the license key
     $key = $license->settings["license_key"];
     $this->ss->assign('url', $this->getMobileEdgeUrl($key));
     $this->ss->assign('enabled_modules', json_encode($json_enabled));
     $this->ss->assign('disabled_modules', json_encode($json_disabled));
     $this->ss->assign('mod', $GLOBALS['mod_strings']);
     $this->ss->assign('APP', $GLOBALS['app_strings']);
     echo getClassicModuleTitle("Administration", array("<a href='index.php?module=Administration&action=index'>{$mod_strings['LBL_MODULE_NAME']}</a>", translate('LBL_WIRELESS_MODULES_ENABLE')), false);
     echo $this->ss->fetch('modules/Administration/templates/enableWirelessModules.tpl');
 }
Ejemplo n.º 10
0
 /**
  * Called from process(). This method will display subpanels.
  */
 protected function _displaySubPanels()
 {
     if (!empty($this->bean->id) && (SugarAutoLoader::existingCustom('modules/' . $this->module . '/metadata/subpaneldefs.php') || SugarAutoLoader::loadExtension("layoutdefs", $this->module))) {
         $GLOBALS['focus'] = $this->bean;
         require_once 'include/SubPanel/SubPanelTiles.php';
         $subpanel = new SubPanelTiles($this->bean, $this->module);
         echo $subpanel->display();
     }
 }
Ejemplo n.º 11
0
 /**
  * Examine the wireless_module_registry to determine which modules have been enabled for the mobile view.
  *
  * @param array $availModules An array of all the modules the user already has access to.
  * @return array Modules enalbed for mobile view.
  */
 function get_visible_mobile_modules($availModules)
 {
     $enabled_modules = array();
     $availModulesKey = array_flip($availModules);
     foreach (SugarAutoLoader::existingCustom('include/MVC/Controller/wireless_module_registry.php') as $file) {
         require $file;
     }
     foreach ($wireless_module_registry as $e => $def) {
         if (isset($availModulesKey[$e])) {
             $enabled_modules[] = $e;
         }
     }
     return $enabled_modules;
 }
Ejemplo n.º 12
0
 /**
  * getConnectorStrings
  * This method returns the language Strings for a given connector instance
  *
  * @param String $source_id String value of the connector id to retrive language strings for
  * @param String $language optional String value for the language to use (defaults to $GLOBALS['current_language'])
  */
 public static function getConnectorStrings($source_id, $language = '')
 {
     global $locale;
     $dir = str_replace('_', '/', $source_id);
     $strings = array();
     $defaultLanguage = $GLOBALS['sugar_config']['default_language'] . '.lang.php';
     $files = array("modules/Connectors/connectors/sources/{$dir}/language/{$defaultLanguage}");
     if ($language != $defaultLanguage) {
         $currentLanguage = (empty($language) ? $locale->getAuthenticatedUserLanguage() : $language) . '.lang.php';
         $files[] = "modules/Connectors/connectors/sources/{$dir}/language/{$currentLanguage}";
     }
     foreach (SugarAutoLoader::existingCustom($files) as $file) {
         require $file;
         if (isset($connector_strings) && is_array($connector_strings)) {
             $strings = sugarLangArrayMerge($strings, $connector_strings);
         }
     }
     if (empty($strings)) {
         $GLOBALS['log']->error("Unable to locate language strings for source {$source_id}");
     }
     return $strings;
 }
Ejemplo n.º 13
0
 function prepareSearchForm()
 {
     $this->searchForm = null;
     //search
     $view = 'basic_search';
     if (!empty($_REQUEST['search_form_view']) && $_REQUEST['search_form_view'] == 'advanced_search') {
         $view = $_REQUEST['search_form_view'];
     }
     $this->headers = true;
     if (!empty($_REQUEST['search_form_only']) && $_REQUEST['search_form_only']) {
         $this->headers = false;
     } elseif (!isset($_REQUEST['search_form']) || $_REQUEST['search_form'] != 'false') {
         if (isset($_REQUEST['searchFormTab']) && $_REQUEST['searchFormTab'] == 'advanced_search') {
             $view = 'advanced_search';
         } else {
             $view = 'basic_search';
         }
     }
     $this->view = $view;
     $this->use_old_search = true;
     if (SugarAutoLoader::existingCustom('modules/' . $this->module . '/SearchForm.html') && !SugarAutoLoader::existingCustom('modules/' . $this->module . '/metadata/searchdefs.php')) {
         require_once 'include/SearchForm/SearchForm.php';
         $this->searchForm = new SearchForm($this->module, $this->seed);
     } else {
         $this->use_old_search = false;
         require_once 'include/SearchForm/SearchForm2.php';
         $searchMetaData = SearchForm::retrieveSearchDefs($this->module);
         $this->searchForm = $this->getSearchForm2($this->seed, $this->module, $this->action);
         $this->searchForm->setup($searchMetaData['searchdefs'], $searchMetaData['searchFields'], 'SearchFormGeneric.tpl', $view, $this->listViewDefs);
         $this->searchForm->lv = $this->lv;
     }
 }
Ejemplo n.º 14
0
 /**
  * Load config.php for this source
  */
 public function loadConfig()
 {
     $config = array();
     $dir = str_replace('_', '/', get_class($this));
     foreach (SugarAutoLoader::existingCustom("modules/Connectors/connectors/sources/{$dir}/config.php") as $file) {
         require $file;
     }
     $this->_config = $config;
     //If there are no required config fields specified, we will default them to all be required
     if (empty($this->_required_config_fields)) {
         foreach ($this->_config['properties'] as $id => $value) {
             $this->_required_config_fields[] = $id;
         }
     }
 }
Ejemplo n.º 15
0
 function _get_link_table_definition($table_name, $def_name)
 {
     global $dictionary;
     include_once 'modules/TableDictionary.php';
     // first check to see if already loaded - assumes hasn't changed in the meantime
     if (isset($dictionary[$table_name][$def_name])) {
         return $dictionary[$table_name][$def_name];
     }
     if (isset($dictionary[$this->_relationship_name][$def_name])) {
         return $dictionary[$this->_relationship_name][$def_name];
     }
     // custom metadata is found in custom/metadata (naturally) and the naming follows the convention $relationship_name_c, and $relationship_name = $table_name
     $relationshipName = preg_replace('/_c$/', '', $table_name);
     foreach (SugarAutoLoader::existingCustom("metadata/{$relationshipName}MetaData.php") as $file) {
         include $file;
     }
     if (isset($dictionary[$relationshipName][$def_name])) {
         return $dictionary[$relationshipName][$def_name];
     }
     // couldn't find the metadata for the table in either the standard or custom locations
     $GLOBALS['log']->debug('Error fetching field defs for join table ' . $table_name);
     return null;
 }
Ejemplo n.º 16
0
<?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.
 */
foreach (SugarAutoLoader::existingCustom('include/Sugarpdf/sugarpdf_default.php') as $file) {
    require $file;
}
// set alternative config file
if (!defined('K_TCPDF_EXTERNAL_CONFIG')) {
    /*
     *  Installation path of TCPDF
     */
    define("K_PATH_MAIN", $sugarpdf_default["K_PATH_MAIN"]);
    /**
     * URL path to tcpdf installation folder
     */
    define("K_PATH_URL", $sugarpdf_default["K_PATH_URL"]);
    /**
     * custom path for PDF fonts (Use for non core added fonts)
     */
Ejemplo n.º 17
0
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_strings, $app_list_strings;
     foreach (SugarAutoLoader::existingCustom("modules/Configurator/metadata/SugarpdfSettingsdefs.php") as $file) {
         include $file;
     }
     if (!empty($_POST['save'])) {
         // Save the logos
         $error = $this->checkUploadImage();
         if (empty($error)) {
             $focus = BeanFactory::getBean('Administration');
             foreach ($SugarpdfSettings as $k => $v) {
                 if ($v['type'] == 'password') {
                     if (isset($_POST[$k])) {
                         $_POST[$k] = blowfishEncode(blowfishGetKey($k), $_POST[$k]);
                     }
                 }
             }
             if (!empty($_POST["sugarpdf_pdf_class"]) && $_POST["sugarpdf_pdf_class"] != PDF_CLASS) {
                 // clear the cache for quotes detailview in order to switch the pdf class.
                 if (is_file($cachedfile = sugar_cached('modules/Quotes/DetailView.tpl'))) {
                     unlink($cachedfile);
                 }
             }
             $focus->saveConfig();
             header('Location: index.php?module=PdfManager&action=index');
         }
     }
     if (!empty($_POST['restore'])) {
         $focus = BeanFactory::getBean('Administration');
         foreach ($_POST as $key => $val) {
             $prefix = $focus->get_config_prefix($key);
             if (in_array($prefix[0], $focus->config_categories)) {
                 $result = $focus->db->query("SELECT count(*) AS the_count FROM config WHERE category = '{$prefix[0]}' AND name = '{$prefix[1]}'");
                 $row = $focus->db->fetchByAssoc($result);
                 if ($row['the_count'] != 0) {
                     $focus->db->query("DELETE FROM config WHERE category = '{$prefix[0]}' AND name = '{$prefix[1]}'");
                 }
             }
         }
         header('Location: index.php?module=Configurator&action=SugarpdfSettings');
     }
     echo getClassicModuleTitle("Administration", array("<a href='index.php?module=PdfManager&action=index'>" . translate('LBL_MODULE_NAME', 'PdfManager') . "</a>", $mod_strings['LBL_PDFMODULE_NAME']), false);
     $pdf_class = array("TCPDF" => "TCPDF", "EZPDF" => "EZPDF");
     $this->ss->assign('APP_LIST', $app_list_strings);
     $this->ss->assign("JAVASCRIPT", get_set_focus_js());
     $this->ss->assign("SugarpdfSettings", $SugarpdfSettings);
     $this->ss->assign("pdf_enable_ezpdf", PDF_ENABLE_EZPDF);
     if (PDF_ENABLE_EZPDF == "0" && PDF_CLASS == "EZPDF") {
         $error = "ERR_EZPDF_DISABLE";
         $this->ss->assign("selected_pdf_class", "TCPDF");
     } else {
         $this->ss->assign("selected_pdf_class", PDF_CLASS);
     }
     $this->ss->assign("pdf_class", $pdf_class);
     if (!empty($error)) {
         $this->ss->assign("error", $mod_strings[$error]);
     }
     if (!function_exists('imagecreatefrompng')) {
         $this->ss->assign("GD_WARNING", 1);
     } else {
         $this->ss->assign("GD_WARNING", 0);
     }
     $this->ss->display('modules/Configurator/tpls/SugarpdfSettings.tpl');
     require_once "include/javascript/javascript.php";
     $javascript = new javascript();
     $javascript->setFormName("ConfigureSugarpdfSettings");
     foreach ($SugarpdfSettings as $k => $v) {
         if (isset($v["required"]) && $v["required"] == true) {
             $javascript->addFieldGeneric($k, "varchar", $v['label'], TRUE, "");
         }
     }
     echo $javascript->getScript();
 }
Ejemplo n.º 18
0
 /**
  * Retrieve the subpanel definitions for a given SugarBean object. Unforunately we can't reuse
  * any of the SubPanelDefinion.php functions.
  *
  * @param  SugarBean $bean
  * @return array The subpanel definitions.
  */
 private function getSubpanelDefs($bean)
 {
     if (empty($bean->module_dir)) {
         return array();
     }
     $layout_defs = array();
     // Handle things differently for BWC modules
     if (isModuleBWC($bean->module_dir)) {
         foreach (SugarAutoLoader::existingCustom('modules/' . $bean->module_dir . '/metadata/subpaneldefs.php') as $file) {
             require $file;
         }
         $defs = SugarAutoLoader::loadExtension('layoutdefs', $bean->module_dir);
         if ($defs) {
             require $defs;
         }
     } else {
         // Handle things the new way
         foreach (SugarAutoLoader::existingCustom('modules/' . $bean->module_dir . '/clients/base/layouts/subpanels/subpanels.php') as $file) {
             require $file;
         }
         // Add in any studio customizations
         $ext = 'custom/modules/' . $bean->module_dir . '/Ext/clients/base/layouts/subpanels/subpanels.ext.php';
         if (SugarAutoLoader::fileExists($ext)) {
             require $ext;
         }
         // Massage defs to look like old style for use in the rename process
         if (isset($viewdefs[$bean->module_dir]['base']['layout']['subpanels']['components'])) {
             $layout_defs = $this->getSidecarSubpanelDefsAsLegacy($viewdefs[$bean->module_dir]['base']['layout']['subpanels']['components'], $bean);
         }
     }
     return isset($layout_defs[$bean->module_dir]['subpanel_setup']) ? $layout_defs[$bean->module_dir]['subpanel_setup'] : $layout_defs;
 }
Ejemplo n.º 19
0
if (!$GLOBALS['current_user']->isAdminForModule('Users')) {
    sugar_die($app_strings['EXCEPTION_NOT_AUTHORIZED']);
}
global $locale, $dictionary;
$db = DBManagerFactory::getInstance();
$return_module = isset($_REQUEST['return_module']) ? $_REQUEST['return_module'] : '';
$return_action = isset($_REQUEST['return_action']) ? $_REQUEST['return_action'] : '';
$return_id = isset($_REQUEST['return_id']) ? $_REQUEST['return_id'] : '';
if (!empty($return_module)) {
    $cancel_location = "index.php?module={$return_module}&action={$return_action}&record={$return_id}";
} else {
    $cancel_location = "index.php?module=Users&action=index";
}
echo "<h2 class='moduleTitle' style=\"margin-bottom:0px;\">{$mod_strings_users['LBL_REASS_SCRIPT_TITLE']}</h2>";
// Include Metadata for processing
foreach (SugarAutoLoader::existingCustom('modules/Users/metadata/reassignScriptMetadata.php', 'modules/Users/reassignScriptMetadata_override.php') as $file) {
    include $file;
}
if (!empty($_GET['record'])) {
    unset($_SESSION['reassignRecords']);
    $_SESSION['reassignRecords']['fromuser'] = $_GET['record'];
}
if (!isset($_POST['fromuser']) && !isset($_GET['execute'])) {
    ///////////////////// BEGIN STEP 1 - Select users/modules /////////////////////////
    $exclude_modules = array("ImportMap", "UsersLastImport", "Dashboard", "SavedSearch", "UserPreference", "SugarFavorites", 'OAuthKey', 'OAuthToken');
    if (isset($_GET['clear']) && $_GET['clear'] == 'true') {
        unset($_SESSION['reassignRecords']);
    }
    ?>
<form method=post action="index.php?module=Users&action=reassignUserRecords" name='EditView' id='EditView'>
<table cellspacing='1' cellpadding='1' border='0'>
Ejemplo n.º 20
0
/**
 * Gets the list of required dropdown list items, keyed on dropdown list name
 *
 * @return array List of all required dropdown list items
 */
function getRequiredDropdownListItems()
{
    $required = array();
    $files = SugarAutoLoader::existingCustom('include/required_list_items.php');
    foreach ($files as $file) {
        require $file;
        if (isset($app_list_strings_required)) {
            $required = array_merge($required, $app_list_strings_required);
        }
    }
    return $required;
}
Ejemplo n.º 21
0
/**
 * Helper function for this file.
 */
function getAllowedReportModules(&$local_modListHeader, $skipCache = false)
{
    static $reports_mod = null;
    if (isset($reports_mod) && !$skipCache) {
        return $reports_mod;
    }
    require_once "modules/MySettings/TabController.php";
    $controller = new TabController();
    $tabs = $controller->get_tabs_system();
    $all_modules = array_merge($tabs[0], $tabs[1]);
    if (!is_array($all_modules)) {
        return array();
    }
    global $report_map, $beanList, $report_include_modules;
    if (empty($beanList)) {
        require 'include/modules.php';
    }
    $report_modules = array();
    $subModuleCheckArray = array("Tasks", "Calls", "Meetings", "Notes");
    $subModuleProjectArray = array("ProjectTask");
    foreach ($beanList as $key => $value) {
        if (isset($all_modules[$key])) {
            $report_modules[$key] = $value;
        }
        //need to include subpanel only modules
        if (!empty($report_include_modules[$key])) {
            $report_modules[$key] = $value;
        }
        if (in_array($key, $subModuleCheckArray) && (array_key_exists("Calendar", $all_modules) || array_key_exists("Activities", $all_modules))) {
            $report_modules[$key] = $value;
        }
        if (in_array($key, $subModuleProjectArray) && array_key_exists("Project", $all_modules)) {
            $report_modules[$key] = $value;
        }
        if ($key == 'Users' || $key == 'Teams' || $key == 'EmailAddresses') {
            $report_modules[$key] = $value;
        }
        if ($key == 'Releases' || $key == 'CampaignLog' || $key == 'Manufacturers') {
            $report_modules[$key] = $value;
        }
    }
    global $beanFiles;
    // Bug 38864 - Parse the reportmoduledefs.php file for a list of modules we should include or disclude from this list
    //             Provides contents of $exemptModules and $additionalModules arrays
    $exemptModules = array();
    $additionalModules = array();
    foreach (SugarAutoLoader::existingCustom('modules/Reports/metadata/reportmodulesdefs.php') as $file) {
        include $file;
    }
    foreach ($report_modules as $module => $class_name) {
        if (!isset($beanFiles[$class_name]) || in_array($module, $exemptModules)) {
            unset($report_modules[$module]);
        }
    }
    foreach ($additionalModules as $module) {
        if (isset($beanList[$module])) {
            $report_modules[$module] = $beanList[$module];
        }
    }
    if (should_hide_iframes() && isset($report_modules['iFrames'])) {
        unset($report_modules['iFrames']);
    }
    return $report_modules;
}
Ejemplo n.º 22
0
 /**
  * Load the modules from the metadata file and include in a custom one if it exists
  *
  * @return array
  */
 protected function _loadQuickCreateModules()
 {
     $QCAvailableModules = array();
     $QCModules = array();
     foreach (SugarAutoLoader::existingCustom('modules/Emails/metadata/qcmodulesdefs.php') as $file) {
         include $file;
     }
     foreach ($QCModules as $module) {
         $seed = BeanFactory::getBean($module);
         if ($seed instanceof SugarBean && $seed->ACLAccess('edit')) {
             $QCAvailableModules[] = $module;
         }
     }
     return $QCAvailableModules;
 }
Ejemplo n.º 23
0
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.
 */
global $mod_strings;
global $current_user;
$actions = array('ModifyProperties', 'ModifyDisplay', 'ModifySearch', 'ModifyMapping', 'ConnectorSettings');
if (in_array($GLOBALS['action'], $actions)) {
    $module_menu[] = array("index.php?module=Connectors&action=ConnectorSettings", $mod_strings['LBL_ADMINISTRATION_MAIN'], "icon_Connectors");
    $module_menu[] = array("index.php?module=Connectors&action=ModifyProperties", $mod_strings['LBL_MODIFY_PROPERTIES_TITLE'], "icon_ConnectorConfig_16");
    $module_menu[] = array("index.php?module=Connectors&action=ModifyDisplay", $mod_strings['LBL_MODIFY_DISPLAY_TITLE'], "icon_ConnectorEnable_16");
    $module_menu[] = array("index.php?module=Connectors&action=ModifyMapping", $mod_strings['LBL_MODIFY_MAPPING_TITLE'], "icon_ConnectorMap_16");
    $module_menu[] = array("index.php?module=Connectors&action=ModifySearch", $mod_strings['LBL_MODIFY_SEARCH_TITLE'], "icon_ConnectorSearchFields_16");
}
if (!empty($_REQUEST['merge_module']) && ($GLOBALS['action'] == 'Step1' || $GLOBALS['action'] == 'Step2')) {
    $merge_module = $_REQUEST['merge_module'];
    $GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], $merge_module);
    foreach (SugarAutoLoader::existingCustom("modules/{$merge_module}/Menu.php") as $file) {
        require $file;
    }
    $GLOBALS['mod_strings'] = return_module_language($GLOBALS['current_language'], $GLOBALS['module']);
}
Ejemplo n.º 24
0
 private static function getModuleDependencyMetadata($module)
 {
     /* //Disable caching for now
        $cacheLoc = create_cache_directory("modules/$module/dependencies.php");
        //If the cache file exists, use it.
        if(inDeveloperMode() && empty($_SESSION['developerMode']) && is_file($cacheLoc)) {
            include($cacheLoc);
        }
        //Otherwise load all the def locations and create the cache file.
        else {
        */
     $dependencies = array($module => array());
     foreach (SugarAutoLoader::existingCustom("modules/{$module}/metadata/dependencydefs.php") as $loc) {
         require $loc;
     }
     $defs = SugarAutoLoader::loadExtension("dependencies", $module);
     if ($defs) {
         require $defs;
     }
     /*  //More disabled cache code
             $out = "<?php\n // created: " . date('Y-m-d H:i:s') . "\n"
                  . override_value_to_string('dependencies', $module, $dependencies[$module]);
             file_put_contents($cacheLoc, $out);
         }*/
     return $dependencies[$module];
 }
Ejemplo n.º 25
0
 public function getQuickcreateList()
 {
     // replicate the essential part of the behavior of the private loadMapping() method in SugarController
     foreach (SugarAutoLoader::existingCustom('include/MVC/Controller/wireless_module_registry.php') as $file) {
         require $file;
     }
     // Forcibly remove the Users module
     // So if they have added it, remove it here
     if (isset($wireless_module_registry['Users'])) {
         unset($wireless_module_registry['Users']);
     }
     $quickcreateList = array();
     foreach ($wireless_module_registry as $module => $moduleData) {
         if (empty($moduleData['disable_create'])) {
             $quickcreateList[] = $module;
         }
     }
     return $quickcreateList;
 }
Ejemplo n.º 26
0
 static function addTemplate($module, $object, $template, $object_name = false)
 {
     // Normalize the template name
     if ($template == 'default') {
         $template = 'basic';
     }
     // The ActivityStream has subdirectories but this code doesn't expect it
     // let's fix it up here
     if (strpos($module, '/') !== false) {
         $tmp = explode('/', $module);
         $module = array_pop($tmp);
     }
     // Verify that we should use this template for BWC modules
     if (self::ignoreBWCTemplate($module, $template)) {
         return;
     }
     $templates = array();
     $fields = array();
     if (empty($object_name)) {
         $object_name = $object;
     }
     $_object_name = strtolower($object_name);
     if (!empty($GLOBALS['dictionary'][$object]['table'])) {
         $table_name = $GLOBALS['dictionary'][$object]['table'];
     } else {
         $table_name = strtolower($module);
     }
     if (empty($templates[$template])) {
         foreach (SugarAutoLoader::existingCustom('include/SugarObjects/templates/' . $template . '/vardefs.php', 'include/SugarObjects/implements/' . $template . '/vardefs.php') as $path) {
             require $path;
             $templates[$template] = $vardefs;
         }
     }
     if (!empty($templates[$template])) {
         static $merge_types = array('fields', 'relationships', 'indices', 'name_format_map', 'visibility', 'acls');
         foreach ($merge_types as $merge_type) {
             if (empty($GLOBALS['dictionary'][$object][$merge_type])) {
                 $GLOBALS['dictionary'][$object][$merge_type] = array();
             }
             if (!empty($templates[$template][$merge_type]) && is_array($templates[$template][$merge_type])) {
                 $GLOBALS['dictionary'][$object][$merge_type] = array_merge($templates[$template][$merge_type], $GLOBALS['dictionary'][$object][$merge_type]);
             }
         }
         /* The duplicate_check property is inherited in full unless already defined - merge has no meaning here */
         if (empty($GLOBALS['dictionary'][$object]['duplicate_check']) && !empty($templates[$template]['duplicate_check'])) {
             $GLOBALS['dictionary'][$object]['duplicate_check'] = $templates[$template]['duplicate_check'];
         }
         if (isset($templates[$template]['favorites']) && !isset($GLOBALS['dictionary'][$object]['favorites'])) {
             $GLOBALS['dictionary'][$object]['favorites'] = $templates[$template]['favorites'];
         }
         // maintain a record of this objects inheritance from the SugarObject templates...
         $GLOBALS['dictionary'][$object]['templates'][$template] = $template;
         if (!empty($templates[$template]['uses'])) {
             foreach ($templates[$template]['uses'] as $extraTemplate) {
                 VardefManager::addTemplate($module, $object, $extraTemplate, $object_name);
             }
         }
     }
 }