/** * Delete this instance */ function delete() { if ($this->isentitytype) { Vtiger_Access::deleteSharing($this); Vtiger_Access::deleteTools($this); Vtiger_Filter::deleteForModule($this); Vtiger_Block::deleteForModule($this); if (method_exists($this, 'deinitWebservice')) { $this->deinitWebservice(); } } $this->__delete(); Vtiger_Profile::deleteForModule($this); Vtiger_Link::deleteAll($this->id); Vtiger_Menu::detachModule($this); self::syncfile(); }
/** * Export Module Handler * @access private */ function export_Module($moduleInstance) { global $adb; $moduleid = $moduleInstance->id; $sqlresult = $adb->query("SELECT * FROM vtiger_parenttabrel WHERE tabid = {$moduleid}"); $parenttabid = $adb->query_result($sqlresult, 0, 'parenttabid'); $menu = Vtiger_Menu::getInstance($parenttabid); $parent_name = $menu->label; $sqlresult = $adb->query("SELECT * FROM vtiger_tab WHERE tabid = {$moduleid}"); $tabresultrow = $adb->fetch_array($sqlresult); $tabname = $tabresultrow['name']; $tablabel = $tabresultrow['tablabel']; $tabversion = isset($tabresultrow['version']) ? $tabresultrow['version'] : false; $this->openNode('module'); $this->outputNode(date('Y-m-d H:i:s'), 'exporttime'); $this->outputNode($tabname, 'name'); $this->outputNode($tablabel, 'label'); $this->outputNode($parent_name, 'parent'); if (!$moduleInstance->isentitytype) { $this->outputNode('extension', 'type'); } if ($tabversion) { $this->outputNode($tabversion, 'version'); } // Export dependency information $this->export_Dependencies($moduleInstance); // Export module tables $this->export_Tables($moduleInstance); // Export module blocks $this->export_Blocks($moduleInstance); // Export module filters $this->export_CustomViews($moduleInstance); // Export Sharing Access $this->export_SharingAccess($moduleInstance); // Export Events $this->export_Events($moduleInstance); // Export Actions $this->export_Actions($moduleInstance); // Export Related Lists $this->export_RelatedLists($moduleInstance); // Export Custom Links $this->export_CustomLinks($moduleInstance); $this->closeNode('module'); }
/** * Import Module * @access private */ function import_Module() { $tabname = $this->_modulexml->name; $tablabel = $this->_modulexml->label; $parenttab = (string) $this->_modulexml->parent; $tabversion = $this->_modulexml->version; $isextension = false; if (!empty($this->_modulexml->type)) { $type = strtolower($this->_modulexml->type); if ($type == 'extension' || $type == 'language') { $isextension = true; } } $vtigerMinVersion = $this->_modulexml->dependencies->vtiger_version; $vtigerMaxVersion = $this->_modulexml->dependencies->vtiger_max_version; $moduleInstance = new Vtiger_Module(); $moduleInstance->name = $tabname; $moduleInstance->label = $tablabel; $moduleInstance->parent = $parenttab; $moduleInstance->isentitytype = $isextension != true; $moduleInstance->version = !$tabversion ? 0 : $tabversion; $moduleInstance->minversion = !$vtigerMinVersion ? false : $vtigerMinVersion; $moduleInstance->maxversion = !$vtigerMaxVersion ? false : $vtigerMaxVersion; $moduleInstance->save(); if (!empty($parenttab)) { $menuInstance = Vtiger_Menu::getInstance($parenttab); $menuInstance->addModule($moduleInstance); } $this->import_Tables($this->_modulexml); $this->import_Blocks($this->_modulexml, $moduleInstance); $this->import_CustomViews($this->_modulexml, $moduleInstance); $this->import_SharingAccess($this->_modulexml, $moduleInstance); $this->import_Events($this->_modulexml, $moduleInstance); $this->import_Actions($this->_modulexml, $moduleInstance); $this->import_RelatedLists($this->_modulexml, $moduleInstance); $this->import_CustomLinks($this->_modulexml, $moduleInstance); $this->import_CronTasks($this->_modulexml); Vtiger_Module::fireEvent($moduleInstance->name, Vtiger_Module::EVENT_MODULE_POSTINSTALL); $moduleInstance->initWebservice(); }
$menuInstance->updateMenu($moduleInstance); //Fin Instanciacion del modulo Cuentas en el Parent Tab de Agencia //Inicio Instanciacion del modulo Tipos de Comisiones en el Parent Tab de Agencia $moduleInstance = Vtiger_Module::getInstance('RegistroDeVentas'); $moduleInstance->parent = 'Agencia'; $moduleInstance->save(); $menuInstance = Vtiger_Menu::getInstance('Agencia'); $menuInstance->updateMenu($moduleInstance); //Fin Instanciacion del modulo Tipos de Comisiones en el Parent Tab de Agencia //Inicio Instanciacion del modulo Comisiones Agencia en el Parent Tab de Agencia $moduleInstance = Vtiger_Module::getInstance('RegistroDePagos'); $moduleInstance->parent = 'Agencia'; $moduleInstance->save(); $menuInstance = Vtiger_Menu::getInstance('Agencia'); $menuInstance->updateMenu($moduleInstance); //Fin Instanciacion del modulo Comisiones Agencia en el Parent Tab de Agencia //Inicio Instanciacion del modulo Tarifas en el Parent Tab de Agencia $moduleInstance = Vtiger_Module::getInstance('VentaDeProductos'); $moduleInstance->parent = 'Agencia'; $moduleInstance->save(); $menuInstance = Vtiger_Menu::getInstance('Agencia'); $menuInstance->updateMenu($moduleInstance); //Fin Instanciacion del modulo Tarifas en el Parent Tab de Agencia //Inicio Instanciacion del modulo Tarifas en el Parent Tab de Agencia $moduleInstance = Vtiger_Module::getInstance('Envios'); $moduleInstance->parent = 'Agencia'; $moduleInstance->save(); $menuInstance = Vtiger_Menu::getInstance('Agencia'); $menuInstance->updateMenu($moduleInstance); //Fin Instanciacion del modulo Tarifas en el Parent Tab de Agencia echo "OK\n";
include_once 'vtlib/Vtiger/Module.php'; $Vtiger_Utils_Log = true; $MODULENAME = 'Tarifas'; $TABLENAME = 'vtiger_tarifas'; // $moduleInstance = Vtiger_Module::getInstance($MODULENAME); // if ($moduleInstance || file_exists('modules/'.$MODULENAME)) { // echo "Module already present - choose a different name."; // } else { /////////////////////////INICIO MODULO/////////////////////////// $moduleInstance = new Vtiger_Module(); $moduleInstance->name = $MODULENAME; $moduleInstance->parent = 'Sales'; $moduleInstance->save(); // Schema Setup $moduleInstance->initTables(); $menuInstance = Vtiger_Menu::getInstance('Sales'); $menuInstance->addModule($moduleInstance); /////////////////////////FIN MODULO/////////////////////////// /////////////////////////INICIO BLOQUE/////////////////////////// // Field Setup $blockInstance = new Vtiger_Block(); $blockInstance->label = 'LBL_TARIFAS_INFORMATION'; $moduleInstance->addBlock($blockInstance); $blockInstance2 = new Vtiger_Block(); $blockInstance2->label = 'LBL_CUSTOM_INFORMATION'; $moduleInstance->addBlock($blockInstance2); /////////////////////////FIN BLOQUE/////////////////////////// /////////////////////////INICIO CAMPOS/////////////////////////// $fieldInstance1 = new Vtiger_Field(); $fieldInstance1->name = 'codigo'; $fieldInstance1->label = 'Codigo';
chdir('..'); $Vtiger_Utils_Log = true; include_once 'vtlib/Vtiger/Menu.php'; include_once 'vtlib/Vtiger/Module.php'; include_once 'modules/PickList/DependentPickListUtils.php'; include_once 'include/utils/CommonUtils.php'; $module_name = 'Sample'; $table_name = 'vtiger_sample'; $main_name = "titlename"; $main_id = "sampleid"; //module作成 $module = new Vtiger_Module(); $module->name = $module_name; $module->save(); $module->initTables($table_name, $main_id); $menu = Vtiger_Menu::getInstance('Tools'); $menu->addModule($module); // block作成 $blockInstance = new Vtiger_Block(); $blockInstance->label = 'LBL_SAMPLE_INFORMATION'; $module->addBlock($blockInstance); // field作成 $field = new Vtiger_Field(); $field->name = 'TitleName'; $field->table = 'vtiger_sample'; $field->column = 'titlename'; $field->columntype = 'VARCHAR(255)'; $field->uitype = 1; $field->typeofdata = 'V~M'; $blockInstance->addField($field); $filter_field1 = $field;
include_once 'vtlib/Vtiger/Menu.php'; include_once 'vtlib/Vtiger/Module.php'; // Create module instance and save it first $module = new Vtiger_Module(); $module->name = 'Deliverynote'; $module->save(); // Initialize all the tables required $module->initTables(); /** * Creates the following table: * vtiger_deliverynote (deliverynoteid INTEGER) * vtiger_deliverynotecf(deliverynoteid INTEGER PRIMARY KEY) * vtiger_deliverynotegrouprel((deliverynoteid INTEGER PRIMARY KEY, groupname VARCHAR(100)) */ // Add the module to the Menu (entry point from UI) $menu = Vtiger_Menu::getInstance('Inventory'); $menu->addModule($module); // Add the basic module block $block1 = new Vtiger_Block(); $block1->label = 'LBL_DELIVERY_INFORMATION'; $module->addBlock($block1); // Add custom block (required to support Custom Fields) $block2 = new Vtiger_Block(); $block2->label = 'LBL_CUSTOM_INFORMATION'; $module->addBlock($block2); /** Create required fields and add to the block */ $field1 = new Vtiger_Field(); $field1->name = 'deliverynotename'; $field1->label = 'Delivery Order'; $field1->table = $module->basetable; $field1->column = 'deliverynotename';
$menuInstance->updateMenu($moduleInstance); //Fin Instanciacion del modulo Cuentas en el Parent Tab de Satelites //Inicio Instanciacion del modulo Terminales en el Parent Tab de Satelites $moduleInstance = Vtiger_Module::getInstance('Terminales'); $moduleInstance->parent = 'Satelites'; $moduleInstance->save(); $menuInstance = Vtiger_Menu::getInstance('Satelites'); $menuInstance->updateMenu($moduleInstance); //Fin Instanciacion del modulo Terminales en el Parent Tab de Satelites //Inicio Instanciacion del modulo Tipos de Comisiones en el Parent Tab de Satelites $moduleInstance = Vtiger_Module::getInstance('TiposdeComisiones'); $moduleInstance->parent = 'Satelites'; $moduleInstance->save(); $menuInstance = Vtiger_Menu::getInstance('Satelites'); $menuInstance->updateMenu($moduleInstance); //Fin Instanciacion del modulo Tipos de Comisiones en el Parent Tab de Satelites //Inicio Instanciacion del modulo Comisiones Satelites en el Parent Tab de Satelites $moduleInstance = Vtiger_Module::getInstance('ComisionSatelites'); $moduleInstance->parent = 'Satelites'; $moduleInstance->save(); $menuInstance = Vtiger_Menu::getInstance('Satelites'); $menuInstance->updateMenu($moduleInstance); //Fin Instanciacion del modulo Comisiones Satelites en el Parent Tab de Satelites //Inicio Instanciacion del modulo Tarifas en el Parent Tab de Satelites $moduleInstance = Vtiger_Module::getInstance('Tarifas'); $moduleInstance->parent = 'Satelites'; $moduleInstance->save(); $menuInstance = Vtiger_Menu::getInstance('Satelites'); $menuInstance->updateMenu($moduleInstance); //Fin Instanciacion del modulo Tarifas en el Parent Tab de Satelites echo "OK\n";
/** * Delete this instance */ function delete() { if ($this->isentitytype) { Vtiger_Access::deleteSharing($this); Vtiger_Access::deleteTools($this); Vtiger_Filter::deleteForModule($this); Vtiger_Block::deleteForModule($this); } $this->__delete(); Vtiger_Profile::deleteForModule($this); Vtiger_Link::deleteAll($this->id); Vtiger_Menu::detachModule($this); self::syncfile(); }
/** * Delete this instance */ function delete() { $moduleInstance = Vtiger_Module_Model::getInstance($this->name); require_once "modules/{$this->name}/{$this->name}.php"; $focus = new $this->name(); $this->tableName = $focus->table_name; if ($this->isentitytype) { $this->deleteFromCRMEntity(); Vtiger_Access::deleteTools($this); Vtiger_Filter::deleteForModule($this); Vtiger_Block::deleteForModule($this); if (method_exists($this, 'deinitWebservice')) { $this->deinitWebservice(); } } $this->deleteIcons(); $this->unsetAllRelatedList($moduleInstance); ModComments_Module_Model::deleteForModule($moduleInstance); Vtiger_Language::deleteForModule($moduleInstance); Vtiger_Access::deleteSharing($moduleInstance); $this->deleteFromModentityNum(); Vtiger_Cron::deleteForModule($moduleInstance); Vtiger_Profile::deleteForModule($moduleInstance); Settings_Workflows_Module_Model::deleteForModule($moduleInstance); Vtiger_Menu::deleteForModule($moduleInstance); $this->deleteGroup2Modules(); $this->deleteModuleTables(); $this->deleteCRMEntityRel(); Vtiger_Profile::deleteForModule($this); Vtiger_Link::deleteAll($this->id); $this->deleteDir($moduleInstance); $this->__delete(); self::syncfile(); }