Example #1
0
 function process($option)
 {
     switch ($option) {
         case 'SelectModuleWizard':
             require_once 'modules/Studio/wizards/' . $option . '.php';
             $newWiz = new $option();
             $newWiz->display();
             break;
         case 'EditDropDownWizard':
             require_once 'modules/Studio/wizards/' . $option . '.php';
             $newWiz = new $option();
             $newWiz->display();
             break;
         case 'RenameTabs':
             require_once 'modules/Studio/wizards/RenameModules.php';
             $newWiz = new RenameModules();
             $newWiz->process();
             break;
         case 'ConfigureTabs':
             header('Location: index.php?module=Administration&action=ConfigureTabs');
             sugar_cleanup(true);
         case 'ConfigureGroupTabs':
             require_once 'modules/Studio/TabGroups/EditViewTabs.php';
             break;
         case 'Workflow':
             header('Location: index.php?module=WorkFlow&action=ListView');
             sugar_cleanup(true);
         case 'RepairCustomFields':
             header('Location: index.php?module=Administration&action=UpgradeFields');
             sugar_cleanup(true);
         case 'MigrateCustomFields':
             header('LOCATION: index.php?module=Administration&action=Development');
             sugar_cleanup(true);
         case 'SugarPortal':
             header('LOCATION: index.php?module=Studio&action=Portal');
             sugar_cleanup(true);
         case 'Classic':
             header('Location: index.php?module=DynamicLayout&action=index');
             sugar_cleanup(true);
         default:
             $this->display();
     }
 }
 /**
  * @group bug45804
  */
 public function testDashletsRenaming()
 {
     $this->markTestSkipped('Because of bug 47239,  Skipping test.');
     $module = 'Accounts';
     $newSingular = 'Account1';
     $newPlural = 'Accounts2';
     $rm = new RenameModules();
     $_REQUEST['slot_0'] = 0;
     $_REQUEST['key_0'] = $module;
     $_REQUEST['svalue_0'] = $newSingular;
     $_REQUEST['value_0'] = $newPlural;
     $_REQUEST['delete_0'] = '';
     $_REQUEST['dropdown_lang'] = $this->language;
     $_REQUEST['dropdown_name'] = 'moduleList';
     global $app_list_strings;
     foreach (getTypeDisplayList() as $typeDisplay) {
         if (!isset($app_list_strings[$typeDisplay][$module])) {
             $app_list_strings[$typeDisplay][$module] = 'Account';
         }
     }
     $rm->save(FALSE);
     //Test dashlets renames
     $callStrings = return_module_language('en_us', 'Accounts', TRUE);
     $this->assertEquals('My Accounts2', $callStrings['LBL_HOMEPAGE_TITLE'], "Renaming dashlets failed for module.");
     //Ensure we recorded which modules were modified.
     $renamedModules = $rm->getRenamedModules();
     $this->assertTrue(count($renamedModules) > 0);
     //cleanup
     $this->removeCustomAppStrings();
     $this->removeModuleStrings($renamedModules);
 }
Example #3
0
/**
 * Patch for bug57431
 * Compares current moduleList to base moduleList to detect if some modules have been renamed
 * Run changeModuleModStrings to create new labels based on customizations.
 */
function updateRenamedModulesLabels()
{
    require_once 'modules/Studio/wizards/RenameModules.php';
    require_once 'include/utils.php';
    $klass = new RenameModules();
    $languages = get_languages();
    foreach ($languages as $langKey => $langName) {
        //get list strings for this language
        $strings = return_app_list_strings_language($langKey);
        //get base list strings for this language
        if (file_exists("include/language/{$langKey}.lang.php")) {
            include "include/language/{$langKey}.lang.php";
            //Keep only renamed modules
            $renamedModules = array_diff($strings['moduleList'], $app_list_strings['moduleList']);
            foreach ($renamedModules as $moduleId => $moduleName) {
                if (isset($app_list_strings['moduleListSingular'][$moduleId])) {
                    $klass->selectedLanguage = $langKey;
                    $replacementLabels = array('singular' => $strings['moduleListSingular'][$moduleId], 'plural' => $strings['moduleList'][$moduleId], 'prev_singular' => $app_list_strings['moduleListSingular'][$moduleId], 'prev_plural' => $app_list_strings['moduleList'][$moduleId], 'key_plural' => $moduleId, 'key_singular' => $klass->getModuleSingularKey($moduleId));
                    $klass->changeModuleModStrings($moduleId, $replacementLabels);
                }
            }
        }
    }
}