function undoChange() { if ($this->hasError()) { $this->sendError(); } if ($this->isApplied()) { vtlib_toggleModuleAccess('CobroPago', false); $this->sendMsg('CobroPago deactivated!'); $this->markUndone(false); $this->sendMsg('Changeset ' . get_class($this) . ' undone!'); } else { $this->sendMsg('Changeset ' . get_class($this) . ' not applied, it cannot be undone!'); } $this->finishExecution(); }
function undoChange() { if ($this->hasError()) { $this->sendError(); } if ($this->isSystemUpdate()) { $this->sendMsg('Changeset ' . get_class($this) . ' is a system update, it cannot be undone!'); } else { if ($this->isApplied()) { vtlib_toggleModuleAccess('Calendar4You', false); $this->sendMsg('Calendar4You deactivated!'); $this->sendMsg('Changeset ' . get_class($this) . ' undone!'); $this->markUndone(); } else { $this->sendMsg('Changeset ' . get_class($this) . ' not applied!'); } } $this->finishExecution(); }
function applyChange() { if ($this->hasError()) { $this->sendError(); } if ($this->isApplied()) { $this->sendMsg('Changeset ' . get_class($this) . ' already applied!'); } else { $toinstall = array('GlobalVariable'); foreach ($toinstall as $module) { if ($this->isModuleInstalled($module)) { vtlib_toggleModuleAccess($module, true); $this->sendMsg("{$module} activated!"); } else { $this->installManifestModule($module); } } $this->sendMsg('Changeset ' . get_class($this) . ' applied!'); $this->markApplied(); } $this->finishExecution(); }
function installAddons() { $packageList = array('module' => array('ConfigEditor', 'Import', 'Integration', 'MailManager', 'Mobile', 'ModTracker', 'PBXManager', 'ServiceContracts', 'Services', 'VtigerBackup', 'WSAPP', 'cbupdater', 'CobroPago' => false, 'Assets' => false, 'CronTasks' => false, 'CustomerPortal' => false, 'FieldFormulas' => false, 'ModComments' => false, 'ProjectMilestone' => false, 'ProjectTask' => false, 'Project' => false, 'RecycleBin' => false, 'SMSNotifier' => false, 'Tooltip' => false, 'Webforms' => false), 'lang' => array('it_it' => true, 'pt_br' => false, 'en_gb' => false, 'de_de' => false, 'nl_nl' => false, 'fr_fr' => false, 'hu_hu' => false, 'es_mx' => false, 'es_es' => false)); $packageImport = new Vtiger_PackageImport(); foreach ($packageList as $type => $packages) { foreach ($packages as $package => $enabled) { if (is_numeric($package)) { $package = $enabled; $enabled = true; } switch ($type) { case 'module': $packageImport->importManifest('modules/' . $package); vtlib_toggleModuleAccess($package, $enabled, true); break; case 'lang': $packageImport->importManifest('include/language/' . $package . '.manifest.xml'); vtlib_toggleLanguageAccess($package, $enabled); break; } } } }
function installOptionalModules($selected_modules) { global $log; require_once 'vtlib/Vtiger/Package.php'; require_once 'vtlib/Vtiger/Module.php'; $selected_modules = split(":", $selected_modules); if ($handle = opendir('packages/5.1.0/optional')) { while (false !== ($file = readdir($handle))) { $filename_arr = explode(".", $file); $packagename = $filename_arr[0]; if (!empty($packagename)) { $packagepath = "packages/5.1.0/optional/{$file}"; $package = new Vtiger_Package(); $module = $package->getModuleNameFromZip($packagepath); if ($module != null) { $moduleInstance = Vtiger_Module::getInstance($module); if (in_array($packagename, $selected_modules)) { if ($moduleInstance) { initUpdateVtlibModule($module, $packagepath); } else { installVtlibModule($packagename, $packagepath); } } elseif ($moduleInstance) { initUpdateVtlibModule($module, $packagepath); vtlib_toggleModuleAccess((string) $module, false); } } } } closedir($handle); } }
private static function copyCustomModules($selectedModules, $sourceDirectory, $destinationDirectory) { global $adb; $selectedModules = explode(":", $selectedModules); $customModulesResult = $adb->pquery('SELECT tabid, name FROM vtiger_tab WHERE customized = 1', array()); $noOfCustomModules = $adb->num_rows($customModulesResult); $mandatoryModules = Common_Install_Wizard_Utils::getMandatoryModuleList(); $optionalModules = Common_Install_Wizard_Utils::getInstallableModulesFromPackages(); $skipModules = array_merge($mandatoryModules, $optionalModules); for ($i = 0; $i < $noOfCustomModules; ++$i) { $moduleName = $adb->query_result($customModulesResult, $i, 'name'); if (!in_array($moduleName, $skipModules)) { Migration_Utils::copyModuleFiles($moduleName, $sourceDirectory, $destinationDirectory); if (!in_array($moduleName, $selectedModules)) { vtlib_toggleModuleAccess((string) $moduleName, false); } } } }
@error_reporting(0); @ini_set('display_errors', 'off'); @set_time_limit(0); @ini_set('memory_limit', '1024M'); if (count($argv) == 3) { $module = $argv[1]; $type = $argv[2]; require_once 'vtlib/Vtiger/Module.php'; require_once 'vtlib/Vtiger/Package.php'; global $current_user, $adb; $Vtiger_Utils_Log = false; // Turn off debugging level $current_user = new Users(); $current_user->retrieveCurrentUserInfoFromFile(1); // admin $package = new Vtiger_Package(); $tabrs = $adb->pquery('select count(*) from vtiger_tab where name=?', array($module)); if ($tabrs and $adb->query_result($tabrs, 0, 0) == 1) { vtlib_toggleModuleAccess($module, true); echo "Module activated: {$module} \n"; } else { if (strtolower($type) == 'language') { $rdo = $package->importManifest('include/language/' . $module . '.manifest.xml'); } else { $rdo = $package->importManifest('modules/' . $module . '/manifest.xml'); } echo "Module installed: {$module} \n"; } } else { echo "\n Incorrect amount of parameters \n"; }
$module_enable = vtlib_purify($_REQUEST['module_enable']); $module_type = vtlib_purify($_REQUEST['module_type']); if ($module_name != '') { if ($module_type == 'language') { if ($module_enable == 'true') { vtlib_toggleLanguageAccess($module_name, true); } if ($module_disable == 'true') { vtlib_toggleLanguageAccess($module_name, false); } } else { if ($module_enable == 'true') { vtlib_toggleModuleAccess($module_name, true); } if ($module_disable == 'true') { vtlib_toggleModuleAccess($module_name, false); } } } // Check write permissions on the required directories $dir_notwritable = array(); if (!vtlib_isDirWriteable('test/vtlib')) { $dir_notwritable[] = 'test/vtlib'; } if (!vtlib_isDirWriteable('cron/modules')) { $dir_notwritable[] = 'cron/modules'; } if (!vtlib_isDirWriteable('modules')) { $dir_notwritable[] = 'modules'; } if (!vtlib_isDirWriteable('Smarty/templates/modules')) {
$currencyThousandSeparator->helpinfo = "<b>Currency - Grouping Separator</b> <br/><br/>" . "Grouping separator specifies the separator to be used to group " . "the whole number part into hundreds, thousands etc. <br/>" . "<b>Eg:</b> <br/>" . ". => 123.456.789 <br/>" . ", => 123,456,789 <br/>" . "' => 123'456'789 <br/>" . " => 123 456 789 <br/>" . "\$ => 123\$456\$789 <br/>"; $currencyBlock->addField($currencyThousandSeparator); $currencyThousandSeparator->setPicklistValues(array(".", ",", "'", " ", "\$")); $currencySymbolPlacement = new Vtiger_Field(); $currencySymbolPlacement->name = 'currency_symbol_placement'; $currencySymbolPlacement->label = 'Symbol Placement'; $currencySymbolPlacement->table = 'vtiger_users'; $currencySymbolPlacement->column = 'currency_symbol_placement'; $currencySymbolPlacement->columntype = 'varchar(20)'; $currencySymbolPlacement->typeofdata = 'V~O'; $currencySymbolPlacement->uitype = 16; $currencySymbolPlacement->defaultvalue = ','; $currencySymbolPlacement->sequence = 5; $currencySymbolPlacement->helpinfo = "<b>Currency - Symbol Placement</b> <br/><br/>" . "Symbol Placement allows you to configure the position of the " . "currency symbol with respect to the currency value.<br/>" . "<b>Eg:</b> <br/>" . "\$1.0 => \$123,456,789.50 <br/>" . "1.0\$ => 123,456,789.50\$ <br/>"; $currencyBlock->addField($currencySymbolPlacement); $currencySymbolPlacement->setPicklistValues(array("\$1.0", "1.0\$")); // Update the block and the sequence for Currency field of Users module - Push it to Currency Configuration block ExecuteQuery("UPDATE vtiger_field SET block={$currencyBlock->id}, sequence=1 WHERE tablename='vtiger_users' AND fieldname='currency_id'"); ExecuteQuery("UPDATE vtiger_users SET currency_grouping_pattern='123,456,789',\n\t\t\t\t\t\t\t\t\t\tcurrency_decimal_separator='.',\n\t\t\t\t\t\t\t\t\t\tcurrency_grouping_separator=',',\n\t\t\t\t\t\t\t\t\t\tcurrency_symbol_placement='\$1.0'"); ExecuteQuery("UPDATE vtiger_field SET uitype='71' WHERE uitype=1 AND tablename='vtiger_campaign'\n\t\t\t\t\t\t\tAND fieldname IN ('expectedrevenue', 'actualcost', 'expectedroi', 'actualroi', 'budgetcost')"); ExecuteQuery("UPDATE vtiger_field SET uitype='72' WHERE uitype IN ('1','71')\n\t\t\t\t\tAND fieldname IN ('unit_price', 'hdnGrandTotal', 'hdnSubTotal', 'txtAdjustment', 'hdnDiscountAmount', 'hdnS_H_Amount')"); $sql = "INSERT INTO vtiger_ws_fieldtype(uitype,fieldtype) VALUES ('71', 'currency')"; ExecuteQuery($sql); $sql = "INSERT INTO vtiger_ws_fieldtype(uitype,fieldtype) VALUES ('72', 'currency')"; ExecuteQuery($sql); $packageImport = new Vtiger_PackageImport(); $packageImport->importManifest('modules/ConfigEditor'); vtlib_toggleModuleAccess('ConfigEditor', true, true); $packageImport->importManifest('modules/WSAPP'); vtlib_toggleModuleAccess('WSAPP', true, true); $migrationlog->debug("\n\nDB Changes from 5.2.1 to 5.3.0RC -------- Ends \n\n");
/** * Function to enable the module * @param type $moduleName -- name of the module */ public function enableModule($moduleName) { //Handling events after enable module vtlib_toggleModuleAccess($moduleName, true); }