function display() { global $current_user, $mod_strings; $smarty = new Sugar_Smarty(); $mb = new MBPackage("packageCustom"); $mod = $mb->getCustomModules(); $modules = array(); $custom = array(); if (is_array($mod)) { foreach ($mod as $key => $value) { $modules[] = $key; $custom[] = $value; } } $nb_mod = count($modules); $smarty->assign('mod_strings', $mod_strings); $smarty->assign('modules', $mod); $smarty->assign('custom', $custom); $smarty->assign('nb_mod', $nb_mod); $smarty->assign('defaultHelp', 'exportHelp'); $smarty->assign('moduleList', $GLOBALS['app_list_strings']['moduleList']); $smarty->assign('moduleList', $GLOBALS['app_list_strings']['moduleList']); $ajax = new AjaxCompose(); $ajax->addCrumb($mod_strings['LBL_STUDIO'], 'ModuleBuilder.getContent("module=ModuleBuilder&action=wizard")'); $ajax->addSection('center', $mod_strings['LBL_EC_TITLE'], $smarty->fetch($this->getCustomFilePathIfExists('modules/ModuleBuilder/tpls/exportcustomizations.tpl'))); echo $ajax->getJavascript(); }
function action_ExportCustom() { $modules = $_REQUEST['modules']; $name = $_REQUEST['name']; $author = $_REQUEST['author']; $description = $_REQUEST['description']; ob_clean(); if (!empty($modules) && !empty($name)) { require_once 'modules/ModuleBuilder/MB/ModuleBuilder.php'; $mb = new MBPackage($name); $mb->author = $author; $mb->description = $description; $mb->exportCustom($modules, true, true); } }
/** * @static * @param array $link * @param MBPackage $package * @param array $allowedTypes list of types to allow as related fields * @return array */ public static function getRelatableFieldsForLink($link, $package = null, $allowedTypes = array()) { $rfields = array(); $relatedModule = $link["module"]; $mbModule = null; if (!empty($package)) { $mbModule = $package->getModuleByFullName($relatedModule); } //First, create a dummy bean to access the relationship info if (empty($mbModule)) { $relatedBean = BeanFactory::getBean($relatedModule); $field_defs = $relatedBean->field_defs; } else { $field_defs = $mbModule->getVardefs(false); $field_defs = $field_defs['fields']; } // Adding special fields not available in vardefs if ($relatedModule == 'Quotes') { $field_defs['taxrate_value'] = array('name' => 'taxrate_value', 'vname' => 'LBL_TAXRATE', 'type' => 'decimal'); $field_defs['currency_iso'] = array('name' => 'currency_iso', 'vname' => 'LBL_CURRENCY', 'type' => 'varchar'); } elseif ($relatedModule == 'Products') { $field_defs['discount_amount'] = array('name' => 'discount_amount', 'vname' => 'LBL_EXT_PRICE', 'type' => 'decimal'); } $relatedFields = PdfManagerHelper::cleanFields($field_defs, $relatedModule, false, true); foreach ($relatedFields as $val) { $name = $val[0]; //Rollups must be either a number or a possible number (like a string) to roll up if (!empty($allowedTypes) && !in_array($val[1], $allowedTypes)) { continue; } $def = $field_defs[$name]; if (empty($mbModule)) { $rfields[$name] = empty($def['vname']) ? $name : str_replace(":", "", translate($def['vname'], $relatedModule)); } else { $rfields[$name] = empty($def['vname']) ? $name : str_replace(":", "", $mbModule->mblanguage->translate($def['vname'])); } //Strip the ":" from any labels that have one if (substr($rfields[$name], -1) == ":") { $rfields[$name] = substr($rfields[$name], 0, strlen($rfields[$name]) - 1); } } return $rfields; }
public function action_ExportCustom() { $modules = $_REQUEST['modules']; $name = $_REQUEST['name']; $author = $_REQUEST['author']; $description = $_REQUEST['description']; ob_clean(); if (!empty($modules) && !empty($name)) { $mb = new MBPackage($name); $mb->author = $author; $mb->description = $description; $mb->exportCustom($modules, true, true); } }
/** * @static * @param array $link * @param MBPackage $package * @param array $allowedTypes list of types to allow as related fields * @return array */ public static function getRelatableFieldsForLink($link, $package = null, $allowedTypes = array()) { $rfields = array(); $relatedModule = $link["module"]; $mbModule = null; if (!empty($package)) { $mbModule = $package->getModuleByFullName($relatedModule); } //First, create a dummy bean to access the relationship info if (empty($mbModule)) { $relatedBean = BeanFactory::getBean($relatedModule); $field_defs = $relatedBean->field_defs; } else { $field_defs = $mbModule->getVardefs(false); $field_defs = $field_defs['fields']; } $relatedFields = FormulaHelper::cleanFields($field_defs, false, true); foreach ($relatedFields as $val) { $name = $val[0]; //Rollups must be either a number or a possible number (like a string) to roll up if (!empty($allowedTypes) && !in_array($val[1], $allowedTypes)) { continue; } $def = $field_defs[$name]; if (empty($mbModule)) { $rfields[$name] = empty($def['vname']) ? $name : translate($def['vname'], $relatedModule); } else { $rfields[$name] = empty($def['vname']) ? $name : $mbModule->mblanguage->translate($def['vname']); } //Strip the ":" from any labels that have one if (substr($rfields[$name], -1) == ":") { $rfields[$name] = substr($rfields[$name], 0, strlen($rfields[$name]) - 1); } } return $rfields; }