コード例 #1
0
 function init($module_name, $subPanelName)
 {
     $GLOBALS['log']->debug("in ParserModifySubPanel: module_name={$module_name} child_module={$subPanelName}");
     $this->moduleName = $module_name;
     $this->subPanelName = $subPanelName;
     global $beanList;
     // Sometimes we receive a module name which is not in the correct CamelCase, so shift to lower case for all beanList lookups
     $beanListLower = array_change_key_case($beanList);
     // Retrieve the definitions for all the available subpanels for this module
     $module = BeanFactory::newBeanByName($beanListLower[strtolower($this->moduleName)]);
     require_once 'include/SubPanel/SubPanelDefinitions.php';
     $spd = new SubPanelDefinitions($module);
     // Get the lists of fields already in the subpanel and those that can be added in
     // Get the fields lists from an aSubPanel object describing this subpanel from the SubPanelDefinitions object
     $this->originalListViewDefs = array();
     if (array_key_exists(strtolower($this->subPanelName), $spd->layout_defs['subpanel_setup'])) {
         $originalPanel = $spd->load_subpanel($this->subPanelName, true);
         $this->originalListViewDefs = $originalPanel->get_list_fields();
         $this->panel = $spd->load_subpanel($subPanelName, false);
         $this->listViewDefs = $this->panel->get_list_fields();
         // Retrieve a copy of the bean for the parent module of this subpanel - so we can find additional fields for the layout
         $subPanelParentModuleName = $this->panel->get_module_name();
         $this->subPanelParentModule = null;
         if (!empty($subPanelParentModuleName) && isset($beanListLower[strtolower($subPanelParentModuleName)])) {
             $this->subPanelParentModule = BeanFactory::newBeanByName($beanListLower[strtolower($subPanelParentModuleName)]);
         }
     }
     $this->language_module = $this->panel->template_instance->module_dir;
 }
コード例 #2
0
 } else {
     if (!$export && empty($_REQUEST['repair_silent'])) {
         if (empty($hideModuleMenu)) {
             echo getClassicModuleTitle($mod_strings['LBL_REPAIR_DATABASE'], array($mod_strings['LBL_REPAIR_DATABASE']), true);
         }
         echo "<h1 id=\"rdloading\">{$mod_strings['LBL_REPAIR_DATABASE_PROCESSING']}</h1>";
         ob_flush();
     }
     $sql = '';
     VardefManager::clearVardef();
     $repairedTables = array();
     foreach ($beanFiles as $bean => $file) {
         if (file_exists($file)) {
             require_once $file;
             unset($GLOBALS['dictionary'][$bean]);
             $focus = BeanFactory::newBeanByName($bean);
             if ($focus instanceof SugarBean && !isset($repairedTables[$focus->table_name])) {
                 $sql .= $db->repairTable($focus, $execute);
                 $repairedTables[$focus->table_name] = true;
             }
             //Repair Custom Fields
             if ($focus instanceof SugarBean && $focus->hasCustomFields() && !isset($repairedTables[$focus->table_name . '_cstm'])) {
                 $df = new DynamicField($focus->module_dir);
                 //Need to check if the method exists as during upgrade an old version of Dynamic Fields may be loaded.
                 if (method_exists($df, "repairCustomFields")) {
                     $df->bean = $focus;
                     $sql .= $df->repairCustomFields($execute);
                     $repairedTables[$focus->table_name . '_cstm'] = true;
                 }
             }
         }
コード例 #3
0
ファイル: Popup_picker.php プロジェクト: jglaine/sugar761-ent
    /**
     *
     */
    function process_page()
    {
        global $theme;
        global $mod_strings;
        global $app_strings;
        global $currentModule;
        global $app_list_strings, $sugar_version, $sugar_config;
        $output_html = "<script type=\"text/javascript\" src=\"" . getJSPath('include/javascript/sugar_3.js') . "\"></script>";
        $where = '';
        if (empty($_REQUEST[$currentModule . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset'])) {
            $_POST[$currentModule . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset'] = '';
        }
        if (empty($_REQUEST['saved_associated_data'])) {
            $_POST['saved_associated_data'] = '';
        }
        $where = $this->_get_where_clause();
        // CREATE STUFF
        if ($this->_create) {
            $formBase = new $this->_popupMeta['create']['formBaseClass']();
            if (isset($_REQUEST['doAction']) && $_REQUEST['doAction'] == 'save') {
                $formBase->handleSave('', false, true);
            }
            $lbl_save_button_title = $app_strings['LBL_SAVE_BUTTON_TITLE'];
            $lbl_save_button_key = $app_strings['LBL_SAVE_BUTTON_KEY'];
            $lbl_save_button_label = $app_strings['LBL_SAVE_BUTTON_LABEL'];
            // TODO: cleanup the construction of $addform
            $prefix = empty($this->_popupMeta['create']['getFormBodyParams'][0]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][0];
            $mod = empty($this->_popupMeta['create']['getFormBodyParams'][1]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][1];
            $formBody = empty($this->_popupMeta['create']['getFormBodyParams'][2]) ? '' : $this->_popupMeta['create']['getFormBodyParams'][2];
            $getFormMethod = empty($this->_popupMeta['create']['getFormMethod']) ? 'getFormBody' : $this->_popupMeta['create']['getFormMethod'];
            $formbody = $formBase->{$getFormMethod}($prefix, $mod, $formBody);
            $addform = '<table><tr><td nowrap="nowrap" valign="top">' . str_replace('<br>', '</td><td nowrap="nowrap" valign="top">&nbsp;', $formbody) . '</td></tr></table>' . '<input type="hidden" name="action" value="Popup" />';
            $formSave = <<<EOQ
\t\t\t<input type="hidden" name="create" value="true">
\t\t\t<input type="hidden" name="popup" value="true">
\t\t\t<input type="hidden" name="to_pdf" value="true">
\t\t\t<input type="hidden" name="return_module" value="{$currentModule}">
\t\t\t<input type="hidden" name="return_action" value="Popup">
\t\t\t<input type="submit" name="button" class="button" title="{$lbl_save_button_title}" value="  {$lbl_save_button_label}  " />
\t\t\t<input type="button" name="button" class="button" title="{$app_strings['LBL_CANCEL_BUTTON_TITLE']}" accesskey="{$app_strings['LBL_CANCEL_BUTTON_KEY']}" value="{$app_strings['LBL_CANCEL_BUTTON_LABEL']}" onclick="toggleDisplay('addform');" />
EOQ;
            // if metadata contains custom inputs for the quickcreate
            if (!empty($this->_popupMeta['customInput']) && is_array($this->_popupMeta['customInput'])) {
                foreach ($this->_popupMeta['customInput'] as $key => $value) {
                    $formSave .= '<input type="hidden" name="' . $key . '" value="' . $value . '">\\n';
                }
            }
            $createButtonTranslation = translate($this->_popupMeta['create']['createButton']);
            $createButton = <<<EOQ
\t\t\t<input type="button" id="showAdd" name="showAdd" class="button" value="{$createButtonTranslation}" onclick="toggleDisplay('addform');" />
EOQ;
            $addformheader = get_form_header($createButtonTranslation, $formSave, false);
        }
        // END CREATE STUFF
        // search request inputs
        $searchInputs = array();
        foreach ($this->_popupMeta['searchInputs'] as $input) {
            $searchInputs[$input] = empty($_REQUEST[$input]) ? '' : $_REQUEST[$input];
        }
        $request_data = empty($_REQUEST['request_data']) ? '' : $_REQUEST['request_data'];
        $hide_clear_button = empty($_REQUEST['hide_clear_button']) && empty($this->_hide_clear_button) ? false : true;
        $button = '<script>eval("var request_data = " + window.document.forms[\'popup_query_form\'].request_data.value);</script>';
        if (isset($_REQUEST['mass'])) {
            foreach (array_unique($_REQUEST['mass']) as $record) {
                $button .= "<input style='display: none' checked type='checkbox' name='mass[]' value='{$record}'>\n";
            }
        }
        //START:FOR MULTI-SELECT
        $multi_select = false;
        if (!empty($_REQUEST['mode']) && strtoupper($_REQUEST['mode']) == 'MULTISELECT') {
            $multi_select = true;
            $button .= "<input type='hidden' name='mode' value='MultiSelect'>";
            $button .= "<input type='button' name='button' class='button' onclick=\"send_back_selected('{$currentModule}',document.MassUpdate,'mass[]','" . $app_strings['ERR_NOTHING_SELECTED'] . "', request_data.field_to_name_array);\" title='" . $app_strings['LBL_SELECT_BUTTON_TITLE'] . "' value='  " . $app_strings['LBL_SELECT_BUTTON_LABEL'] . "  ' />\n";
        }
        //END:FOR MULTI-SELECT
        if (!$hide_clear_button) {
            $button .= "<input type='button' name='button' class='button' onclick=\"send_back('','');\" title='" . $app_strings['LBL_CLEAR_BUTTON_TITLE'] . "' value='  " . $app_strings['LBL_CLEAR_BUTTON_LABEL'] . "  ' />\n";
        }
        $button .= "<input type='submit' name='button' class='button' onclick=\"window.close();\" title='" . $app_strings['LBL_CANCEL_BUTTON_TITLE'] . "' value='  " . $app_strings['LBL_CANCEL_BUTTON_LABEL'] . "  ' />\n";
        if (isset($this->_popupMeta['templateForm'])) {
            $form = new XTemplate($this->_popupMeta['templateForm']);
        } else {
            $form = new XTemplate('modules/' . $currentModule . '/Popup_picker.html');
        }
        $form->assign('MOD', $mod_strings);
        $form->assign('APP', $app_strings);
        $form->assign('THEME', $theme);
        $form->assign('MODULE_NAME', $currentModule);
        $form->assign('request_data', $request_data);
        // CREATE STUFF
        if ($this->_create) {
            $form->assign('CREATEBUTTON', $createButton);
            $form->assign('ADDFORMHEADER', $addformheader);
            $form->assign('ADDFORM', $addform);
        }
        // CREATE STUFF
        if (isset($this->_popupMeta['className'])) {
            $seed_bean = BeanFactory::newBeanByName($this->_popupMeta['className']);
        } else {
            $seed_bean = BeanFactory::newBeanByName($this->_popupMeta['moduleMain']);
        }
        // assign search inputs to xtemplates
        foreach (array_keys($searchInputs) as $key) {
            if (!empty($_REQUEST[$key]) && (isset($seed_bean->field_name_map[$key]['type']) && $seed_bean->field_name_map[$key]['type'] == 'bool')) {
                $form->assign(strtoupper($key), ' checked ');
            } else {
                $form->assign(strtoupper($key), $searchInputs[$key]);
            }
        }
        if ($this->_create) {
            $form->assign('CREATE', 'true');
        } else {
            $form->assign('CREATE', 'false');
        }
        // fill any doms
        if (isset($this->_popupMeta['selectDoms'])) {
            foreach ($this->_popupMeta['selectDoms'] as $key => $value) {
                $form->assign($key, get_select_options_with_id($app_list_strings[$value['dom']], $value['searchInput']));
            }
        }
        $form->assign('MULTI_SELECT', !empty($_REQUEST['mode']) ? strtoupper($_REQUEST['mode']) : '');
        ob_start();
        insert_popup_header($theme);
        $output_html .= ob_get_contents();
        ob_end_clean();
        $output_html .= get_form_header($mod_strings['LBL_SEARCH_FORM_TITLE'], '', false);
        $form->parse('main.SearchHeader');
        $output_html .= $form->text('main.SearchHeader');
        // Reset the sections that are already in the page so that they do not print again later.
        $form->reset('main.SearchHeader');
        $ListView = new ListView();
        $ListView->show_select_menu = false;
        $ListView->show_delete_button = false;
        $ListView->show_export_button = false;
        $ListView->process_for_popups = true;
        $ListView->setXTemplate($form);
        $ListView->multi_select_popup = $multi_select;
        $ListView->xTemplate->assign('TAG_TYPE', 'A');
        if (isset($this->_popupMeta['listTitle'])) {
            $ListView->setHeaderTitle($this->_popupMeta['listTitle']);
        } else {
            $ListView->setHeaderTitle($mod_strings['LBL_LIST_FORM_TITLE']);
        }
        $ListView->setHeaderText($button);
        $ListView->setQuery($where, '', $this->_popupMeta['orderBy'], $this->_popupMeta['varName']);
        $ListView->setModStrings($mod_strings);
        ob_start();
        $ListView->processListView($seed_bean, 'main', $this->_popupMeta['varName']);
        $output_html .= ob_get_contents();
        ob_end_clean();
        $json = getJSONobj();
        // decode then encode to escape "'s
        $output_html .= "</form>\n\t\t<script type=\"text/javascript\">\n\t\tfunction save_checks(offset) {\n\t\t\tchecked_ids = Array();\n\t\t\tfor (i = 0; i < document.MassUpdate.elements.length; i++){\n\t\t\t\tif(document.MassUpdate.elements[i].name == 'mass[]' && document.MassUpdate.elements[i].checked) {\n\t\t\t\t\ttemp_string = '';\n\t\t\t\t\ttemp_string += '\"' + document.MassUpdate.elements[i].value + '\": {';\n\t\t\t\t\tfor(the_key in associated_javascript_data[document.MassUpdate.elements[i].value]) {\n\t\t\t\t\t\ttemp_string += '\"' + the_key + '\":\"' + associated_javascript_data[document.MassUpdate.elements[i].value][the_key] + '\",';\n\t\t\t\t\t}\n\t\t\t\t\ttemp_string = temp_string.substring(0,temp_string.length - 1);\n\t\t\t\t\ttemp_string += '}';\n\t\t\t\t\tchecked_ids.push(temp_string);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdocument.MassUpdate.saved_associated_data.value = escape('{' + checked_ids.join(',') + '}');\n\n\t\t\tdocument.MassUpdate.action.value = \"Popup\";\n\t\t\tdocument.MassUpdate.{$currentModule}" . '_' . strtoupper($this->_popupMeta['moduleMain']) . '_offset.value = offset;
			document.MassUpdate.submit();
		}
		// reassigned the saved data from the saved checks
		if(typeof(document.MassUpdate) != \'undefined\' && document.MassUpdate.saved_associated_data.value != \'\') {
			temp_array = ' . (!empty($_REQUEST['saved_associated_data']) ? $json->encode($json->decode(urldecode($_REQUEST['saved_associated_data']))) : '\'\'') . ';
			for(the_key in temp_array) {
				associated_javascript_data[the_key] = temp_array[the_key];
			}
		}

		// save checks across pages for multiselects
		if(typeof(document.MassUpdate) != "undefined") {
			checked_items = Array();
			inputs_array = document.MassUpdate.elements;

			for(wp = 0 ; wp < inputs_array.length; wp++) {
				if(inputs_array[wp].name == "mass[]" && inputs_array[wp].style.display == "none") {
					checked_items.push(inputs_array[wp].value);
				}
			}
			for(i in checked_items) {
				for(wp = 0 ; wp < inputs_array.length; wp++) {
					if(inputs_array[wp].name == "mass[]" && inputs_array[wp].value == checked_items[i]) {
						inputs_array[wp].checked = true;
					}
				}
			}
		}
		</script>';
        $output_html .= insert_popup_footer();
        return $output_html;
    }
コード例 #4
0
 * Copyright (C) SugarCRM Inc. All rights reserved.
 */
global $current_user, $beanList, $beanFiles, $mod_strings;
$installed_classes = array();
$ACLbeanList = $beanList;
// In the event that previous Tracker entries were installed from 510RC, we need to fix the category value
$GLOBALS['db']->query("UPDATE acl_actions set acltype = 'TrackerPerf' where category = 'TrackerPerfs'");
$GLOBALS['db']->query("UPDATE acl_actions set acltype = 'TrackerSession' where category = 'TrackerSessions'");
$GLOBALS['db']->query("UPDATE acl_actions set acltype = 'TrackerQuery' where category = 'TrackerQueries'");
if (is_admin($current_user)) {
    foreach ($ACLbeanList as $module => $class) {
        if (empty($installed_classes[$class]) && isset($beanFiles[$class])) {
            if ($class == 'Tracker') {
                ACLAction::addActions('Trackers', 'Tracker');
            } else {
                $mod = BeanFactory::newBeanByName($class);
                $GLOBALS['log']->debug("DOING: {$class}");
                if ($mod instanceof SugarBean && $mod->bean_implements('ACL') && empty($mod->acl_display_only)) {
                    // BUG 10339: do not display messages for upgrade wizard
                    if (!isset($_REQUEST['upgradeWizard'])) {
                        echo translate('LBL_ADDING', 'ACL', '') . $mod->module_dir . '<br>';
                    }
                    if (!empty($mod->acltype)) {
                        ACLAction::addActions($mod->getACLCategory(), $mod->acltype);
                    } else {
                        ACLAction::addActions($mod->getACLCategory());
                    }
                    $installed_classes[$class] = true;
                }
            }
        }
コード例 #5
0
ファイル: SugarBean.php プロジェクト: jglaine/sugar761-ent
 /**
  * Returns an array of beans of related data.
  *
  * For instance, if an account is related to 10 contacts , this function will return an array of contacts beans (10)
  * with each bean representing a contact record.
  * Method will load the relationship if not done so already.
  *
  * @param string $field_name relationship to be loaded.
  * @param string $bean name  class name of the related bean.
  * @param array $sort_array optional, unused
  * @param int $begin_index Optional, default 0, unused.
  * @param int $end_index Optional, default -1
  * @param int $deleted Optional, Default 0, 0  adds deleted=0 filter, 1  adds deleted=1 filter.
  * @param string $optional_where, Optional, default empty.
  *
  * Internal function, do not override.
  */
 function get_linked_beans($field_name, $bean_name, $sort_array = array(), $begin_index = 0, $end_index = -1, $deleted = 0, $optional_where = "")
 {
     //if bean_name is Case then use aCase
     if ($bean_name == "Case") {
         $bean_name = "aCase";
     }
     if ($this->load_relationship($field_name)) {
         if ($this->{$field_name} instanceof Link) {
             // some classes are still based on Link, e.g. TeamSetLink
             return array_values($this->{$field_name}->getBeans(BeanFactory::newBeanByName($bean_name), $sort_array, $begin_index, $end_index, $deleted, $optional_where));
         } else {
             // Link2 style
             if ($end_index != -1 || !empty($deleted) || !empty($optional_where)) {
                 return array_values($this->{$field_name}->getBeans(array('where' => $optional_where, 'deleted' => $deleted, 'limit' => $end_index - $begin_index)));
             } else {
                 return array_values($this->{$field_name}->getBeans());
             }
         }
     } else {
         return array();
     }
 }
コード例 #6
0
 /**
  * Deletes a record in a bean
  *
  * @param $bean_id
  * @param $module
  */
 protected function _deleteRecord($bean_id, $module)
 {
     static $focus;
     // load bean
     if (!$focus instanceof $module) {
         $focus = BeanFactory::newBeanByName($module);
     }
     $focus->mark_relationships_deleted($bean_id);
     $result = $this->db->query("DELETE FROM {$focus->table_name}\n                WHERE id = '{$bean_id}'");
     if (!$result) {
         return false;
     }
     // Bug 26318: Remove all created e-mail addresses ( from jchi )
     $result2 = $this->db->query("SELECT email_address_id\n                FROM email_addr_bean_rel\n                WHERE email_addr_bean_rel.bean_id='{$bean_id}'\n                    AND email_addr_bean_rel.bean_module='{$focus->module_dir}'");
     $this->db->query("DELETE FROM email_addr_bean_rel\n                WHERE email_addr_bean_rel.bean_id='{$bean_id}'\n                    AND email_addr_bean_rel.bean_module='{$focus->module_dir}'");
     while ($row2 = $this->db->fetchByAssoc($result2)) {
         if (!$this->db->getOne("SELECT email_address_id\n                        FROM email_addr_bean_rel\n                        WHERE email_address_id = '{$row2['email_address_id']}'")) {
             $this->db->query("DELETE FROM email_addresses\n                        WHERE id = '{$row2['email_address_id']}'");
         }
     }
     if ($focus->hasCustomFields()) {
         $this->db->query("DELETE FROM {$focus->table_name}_cstm\n                    WHERE id_c = '{$bean_id}'");
     }
 }
コード例 #7
0
ファイル: utils.php プロジェクト: jglaine/sugar761-ent
function get_bean_select_array($add_blank = true, $bean_name, $display_columns, $where = '', $order_by = '', $blank_is_none = false)
{
    $focus = BeanFactory::newBeanByName($bean_name);
    $user_array = array();
    $key = $bean_name == 'EmailTemplate' ? $bean_name : $bean_name . $display_columns . $where . $order_by;
    $user_array = get_register_value('select_array', $key);
    if (!$user_array) {
        $db = DBManagerFactory::getInstance();
        $temp_result = array();
        $query = "SELECT {$focus->table_name}.id, {$display_columns} as display from {$focus->table_name} ";
        // Bug 36162 - We need to confirm that the user is a member of the team of the item.
        $focus->add_team_security_where_clause($query);
        $query .= "where ";
        if ($where != '') {
            $query .= $where . " AND ";
        }
        $query .= " {$focus->table_name}.deleted=0";
        if ($order_by != '') {
            $query .= " order by {$focus->table_name}.{$order_by}";
        }
        $GLOBALS['log']->debug("get_user_array query: {$query}");
        $result = $db->query($query, true, "Error filling in user array: ");
        if ($add_blank == true) {
            // Add in a blank row
            if ($blank_is_none == true) {
                // set 'blank row' to "--None--"
                global $app_strings;
                $temp_result[''] = $app_strings['LBL_NONE'];
            } else {
                $temp_result[''] = '';
            }
        }
        // Get the id and the name.
        while ($row = $db->fetchByAssoc($result)) {
            $temp_result[$row['id']] = $row['display'];
        }
        $user_array = $temp_result;
        set_register_value('select_array', $key, $temp_result);
    }
    return $user_array;
}
コード例 #8
0
 public function rebuildAuditTables()
 {
     global $mod_strings;
     include 'include/modules.php';
     //bug 15661
     if ($this->show_output) {
         echo "<h3> {$mod_strings['LBL_QR_REBUILDAUDIT']}</h3>";
     }
     if (!in_array(translate('LBL_ALL_MODULES'), $this->module_list) && !empty($this->module_list)) {
         foreach ($this->module_list as $module_name) {
             $bean = BeanFactory::getBean($module_name);
             if (!empty($bean)) {
                 $this->_rebuildAuditTablesHelper($bean);
             }
         }
     } else {
         if (in_array(translate('LBL_ALL_MODULES'), $this->module_list)) {
             foreach ($beanFiles as $bean => $file) {
                 $bean_instance = BeanFactory::newBeanByName($bean);
                 if (!empty($bean_instance)) {
                     $this->_rebuildAuditTablesHelper($bean_instance);
                 }
             }
         }
     }
     if ($this->show_output) {
         echo $mod_strings['LBL_DONE'];
     }
 }
コード例 #9
0
ファイル: view.last.php プロジェクト: jglaine/sugar761-ent
 /**
  * @see SugarView::display()
  */
 public function display()
 {
     global $mod_strings, $app_strings, $current_user, $sugar_config, $current_language;
     $this->ss->assign("IMPORT_MODULE", $_REQUEST['import_module']);
     $this->ss->assign("TYPE", $_REQUEST['type']);
     $this->ss->assign("HEADER", $app_strings['LBL_IMPORT'] . " " . $mod_strings['LBL_MODULE_NAME']);
     $this->ss->assign("MODULE_TITLE", $this->getModuleTitle(false));
     // lookup this module's $mod_strings to get the correct module name
     $module_mod_strings = return_module_language($current_language, $_REQUEST['import_module']);
     $this->ss->assign("MODULENAME", $module_mod_strings['LBL_MODULE_NAME']);
     // read status file to get totals for records imported, errors, and duplicates
     $count = 0;
     $errorCount = 0;
     $dupeCount = 0;
     $createdCount = 0;
     $updatedCount = 0;
     $fp = sugar_fopen(ImportCacheFiles::getStatusFileName(), 'r');
     // Read the data if we successfully opened file
     if ($fp !== false) {
         // Read rows 1 by 1 and add the info
         while ($row = fgetcsv($fp, 8192)) {
             $count += (int) $row[0];
             $errorCount += (int) $row[1];
             $dupeCount += (int) $row[2];
             $createdCount += (int) $row[3];
             $updatedCount += (int) $row[4];
         }
         fclose($fp);
     }
     $this->ss->assign("showUndoButton", FALSE);
     if ($createdCount > 0) {
         $this->ss->assign("showUndoButton", TRUE);
     }
     if ($errorCount > 0 && ($createdCount <= 0 && $updatedCount <= 0)) {
         $activeTab = 2;
     } else {
         if ($dupeCount > 0 && ($createdCount <= 0 && $updatedCount <= 0)) {
             $activeTab = 1;
         } else {
             $activeTab = 0;
         }
     }
     $this->ss->assign("JAVASCRIPT", $this->_getJS($activeTab));
     $this->ss->assign("errorCount", $errorCount);
     $this->ss->assign("dupeCount", $dupeCount);
     $this->ss->assign("createdCount", $createdCount);
     $this->ss->assign("updatedCount", $updatedCount);
     $this->ss->assign("errorFile", ImportCacheFiles::convertFileNameToUrl(ImportCacheFiles::getErrorFileName()));
     $this->ss->assign("errorrecordsFile", ImportCacheFiles::convertFileNameToUrl(ImportCacheFiles::getErrorRecordsWithoutErrorFileName()));
     $this->ss->assign("dupeFile", ImportCacheFiles::convertFileNameToUrl(ImportCacheFiles::getDuplicateFileName()));
     if ($this->bean->object_name == "Prospect") {
         $this->ss->assign("PROSPECTLISTBUTTON", $this->_addToProspectListButton());
     } else {
         $this->ss->assign("PROSPECTLISTBUTTON", "");
     }
     $resultsTable = "";
     foreach (UsersLastImport::getBeansByImport($_REQUEST['import_module']) as $beanname) {
         // load bean
         if (!$this->bean instanceof $beanname) {
             $this->bean = BeanFactory::newBeanByName($beanname);
         }
         $resultsTable .= $this->getListViewResults();
     }
     if (empty($resultsTable)) {
         $resultsTable = $this->getListViewResults();
     }
     $this->ss->assign("RESULTS_TABLE", $resultsTable);
     $this->ss->assign("ERROR_TABLE", $this->getListViewTableFromFile(ImportCacheFiles::getErrorRecordsFileName(), 'errors'));
     $this->ss->assign("DUP_TABLE", $this->getListViewTableFromFile(ImportCacheFiles::getDuplicateFileDisplayName(), 'dup'));
     $content = $this->ss->fetch('modules/Import/tpls/last.tpl');
     $this->ss->assign("CONTENT", $content);
     $this->ss->display('modules/Import/tpls/wizardWrapper.tpl');
 }
コード例 #10
0
ファイル: Tracker.php プロジェクト: jglaine/sugar761-ent
 /**
  * create_tables
  * Override this method to insert ACLActions for the tracker beans
  *
  */
 function create_tables()
 {
     $path = 'modules/Trackers/config.php';
     if (defined('TEMPLATE_URL')) {
         $path = SugarTemplateUtilities::getFilePath($path);
     }
     require $path;
     foreach ($tracker_config as $key => $configEntry) {
         if (isset($configEntry['bean']) && $configEntry['bean'] != 'Tracker') {
             $bean = BeanFactory::newBeanByName($configEntry['bean']);
             if ($bean->bean_implements('ACL')) {
                 ACLAction::addActions($bean->getACLCategory(), $configEntry['bean']);
             }
         }
     }
     parent::create_tables();
 }
コード例 #11
0
 /**
  * Convert a piece of a subpanel layoutdef to the new style
  * @param array $layoutdef old style layout
  * @return array new style layout for this piece
  */
 public function fromLegacySubpanelLayout(array $layoutdef)
 {
     $viewdefs = array('layout' => 'subpanel');
     // we aren't upgrading collections
     if (!empty($layoutdef['collection_list'])) {
         return $viewdefs;
     }
     foreach ($layoutdef as $key => $value) {
         if ($key == 'override_subpanel_name') {
             $subpanelFileName = $value;
             if (substr_count($value, '_') > 1 && stristr($value, 'subpanel')) {
                 $parts = explode('_subpanel_', $value);
                 $beanNameParts = explode('_', $parts[0]);
                 $subPanelBeanName = '';
                 foreach ($beanNameParts as $part) {
                     $subPanelBeanName .= ucwords($part);
                 }
                 // case is not the actually object name, it's aCase
                 if ($subPanelBeanName == 'Case') {
                     $subPanelBeanName = 'aCase';
                 }
                 $focus = BeanFactory::newBeanByName($subPanelBeanName);
                 if ($focus) {
                     $field = $focus->getFieldDefinition($parts[1]);
                     if ($field && $field['type'] == 'link') {
                         // since we have a valid link, we need to test the relationship to see if it's custom relationship
                         $relationships = new DeployedRelationships($focus->module_name);
                         $relationship = $relationships->get($parts[1]);
                         $relDef = array();
                         if ($relationship) {
                             $relDef = $relationship->getDefinition();
                         }
                         if (!empty($relDef['is_custom']) && !empty($relDef['from_studio']) && (!empty($relDef['name']) || !empty($relDef['relationship_name']))) {
                             $name = !empty($relDef['name']) ? $relDef['name'] : $relDef['relationship_name'];
                             $subpanelFileName = "For{$name}";
                         } else {
                             $subpanelFileName = "For{$focus->module_name}";
                         }
                     } else {
                         $subpanelFileName = "For{$focus->module_name}";
                     }
                 }
             }
             $viewdefs['override_subpanel_list_view'] = array('view' => $this->fromLegacySubpanelName($subpanelFileName), 'link' => isset($layoutdef['get_subpanel_data']) ? $layoutdef['get_subpanel_data'] : '');
         } elseif ($key == 'title_key') {
             $viewdefs['label'] = $value;
         } elseif ($key == 'get_subpanel_data') {
             $viewdefs['context']['link'] = $value;
         }
     }
     return $viewdefs;
 }