本文整理汇总了PHP中Vtiger_Block::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Block::getInstance方法的具体用法?PHP Vtiger_Block::getInstance怎么用?PHP Vtiger_Block::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Block
的用法示例。
在下文中一共展示了Vtiger_Block::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$moduleInstance = Vtiger_Module::getInstance('Users');
$block = Vtiger_Block::getInstance('LBL_CALENDAR_SETTINGS', $moduleInstance);
if (!$block) {
$block = new Vtiger_Block();
$block->label = 'LBL_CALENDAR_SETTINGS';
$block->sequence = 2;
$moduleInstance->addBlock($block);
}
$this->ExecuteQuery("delete from vtiger_picklist where name='hour_format'");
$this->ExecuteQuery("delete from vtiger_picklist where name='start_hour'");
$field = Vtiger_Field::getInstance('hour_format', $moduleInstance);
$this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $field->id);
$field->setPicklistValues(array('am/pm', '12', '24'));
$start_hour = Vtiger_Field::getInstance('start_hour', $moduleInstance);
$this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $start_hour->id);
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例2: applyChange
function applyChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset assignto_mailscanner already applied!');
} else {
$mod_hd = Vtiger_Module::getInstance('HelpDesk');
$block_hd = Vtiger_Block::getInstance('LBL_TICKET_INFORMATION', $mod_hd);
$field1 = new Vtiger_Field();
$field1->name = 'from_mailscanner';
$field1->label = 'From mailscanner';
$field1->column = 'from_mailscanner';
$field1->columntype = 'VARCHAR(3)';
$field1->sequence = 1;
$field1->uitype = 56;
$field1->typeofdata = 'C~O';
$field1->displaytype = 3;
$field1->presence = 0;
$field1->readonly = 1;
$block_hd->addField($field1);
$this->ExecuteQuery('ALTER TABLE vtiger_mailscanner_rules ADD assign_to INT(11)');
$this->sendMsg('Changeset assignto_mailscanner applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例3: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
$moduleInstance = Vtiger_Module::getInstance('Users');
$block = Vtiger_Block::getInstance('LBL_USER_ADV_OPTIONS', $moduleInstance);
$field = Vtiger_Field::getInstance('failed_login_attempts', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
} else {
$user_field = new Vtiger_Field();
$user_field->name = 'failed_login_attempts';
$user_field->label = 'LBL_FAILED_LOGIN_ATTEMPTS';
$user_field->table = 'vtiger_users';
$user_field->column = 'failed_login_attempts';
$user_field->columntype = 'int(11)';
$user_field->typeofdata = 'I~O';
$user_field->uitype = '7';
$user_field->masseditable = '0';
$block->addField($user_field);
$this->ExecuteQuery('update vtiger_users set failed_login_attempts=0');
RecalculateSharingRules();
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例4: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
$moduleInstance = Vtiger_Module::getInstance('Users');
$block = Vtiger_Block::getInstance('LBL_MORE_INFORMATION', $moduleInstance);
$field = Vtiger_Field::getInstance('send_email_to_sender', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
} else {
$user_field = new Vtiger_Field();
$user_field->name = 'send_email_to_sender';
$user_field->label = 'LBL_SEND_EMAIL_TO_SENDER';
$user_field->table = 'vtiger_users';
$user_field->column = 'send_email_to_sender';
$user_field->columntype = 'varchar(3)';
$user_field->typeofdata = 'C~O';
$user_field->uitype = '56';
$user_field->masseditable = '0';
$block->addField($user_field);
$this->ExecuteQuery("update vtiger_users set send_email_to_sender='1'");
RecalculateSharingRules();
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例5: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$moduleInstance = Vtiger_Module::getInstance('Users');
$block = Vtiger_Block::getInstance('LBL_CALENDAR_SETTINGS', $moduleInstance);
if (!$block) {
$block = new Vtiger_Block();
$block->label = 'LBL_CALENDAR_SETTINGS';
$block->sequence = 2;
$moduleInstance->addBlock($block);
}
$this->ExecuteQuery('drop table if exists vtiger_hour_format');
$this->ExecuteQuery('drop table if exists vtiger_start_hour');
$field = Vtiger_Field::getInstance('hour_format', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $field->id);
} else {
$field = new Vtiger_Field();
$field->name = 'hour_format';
$field->label = 'Calendar Hour Format';
$field->table = 'vtiger_users';
$field->column = 'hour_format';
$field->columntype = 'varchar(4)';
$field->typeofdata = 'V~O';
$field->uitype = '16';
$field->masseditable = '0';
$block->addField($field);
}
$field->setPicklistValues(array('12', '24'));
$start_hour = Vtiger_Field::getInstance('start_hour', $moduleInstance);
if ($start_hour) {
$this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $start_hour->id);
} else {
$start_hour = new Vtiger_Field();
$start_hour->name = 'start_hour';
$start_hour->label = 'Day starts at';
$start_hour->table = 'vtiger_users';
$start_hour->column = 'start_hour';
$start_hour->columntype = 'varchar(5)';
$start_hour->typeofdata = 'V~O';
$start_hour->uitype = '16';
$start_hour->masseditable = '0';
$block->addField($start_hour);
}
$start_hour->setPicklistValues(array('00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00'));
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例6: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$chktbl = $adb->query('select 1 from com_vtiger_workflow_tasktypes limit 1');
if ($chktbl) {
$moduleInstance = Vtiger_Module::getInstance('Potentials');
$block = Vtiger_Block::getInstance('LBL_OPPORTUNITY_INFORMATION', $moduleInstance);
$field = Vtiger_Field::getInstance('forecast_amount', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
} else {
$forecast_field = new Vtiger_Field();
$forecast_field->name = 'forecast_amount';
$forecast_field->label = 'Forecast Amount';
$forecast_field->table = 'vtiger_potential';
$forecast_field->column = 'forecast_amount';
$forecast_field->columntype = 'decimal(25,4)';
$forecast_field->typeofdata = 'N~O';
$forecast_field->uitype = '71';
$forecast_field->masseditable = '0';
$block->addField($forecast_field);
}
$wfrs = $adb->query("SELECT workflow_id FROM com_vtiger_workflows WHERE summary='Calculate or Update forecast amount'");
if ($wfrs and $adb->num_rows($wfrs) == 1) {
$this->sendMsg('Workfolw already exists!');
} else {
$workflowManager = new VTWorkflowManager($adb);
$taskManager = new VTTaskManager($adb);
$potentailsWorkFlow = $workflowManager->newWorkFlow("Potentials");
$potentailsWorkFlow->test = '';
$potentailsWorkFlow->description = "Calculate or Update forecast amount";
$potentailsWorkFlow->executionCondition = VTWorkflowManager::$ON_EVERY_SAVE;
$potentailsWorkFlow->defaultworkflow = 1;
$workflowManager->save($potentailsWorkFlow);
$task = $taskManager->createTask('VTUpdateFieldsTask', $potentailsWorkFlow->id);
$task->active = true;
$task->summary = 'update forecast amount';
$task->field_value_mapping = '[{"fieldname":"forecast_amount","valuetype":"expression","value":"amount * probability / 100"}]';
$taskManager->saveTask($task);
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
} else {
$this->sendMsgError('This changeset could not be applied because it depends on create_workflow_tasktype which probably has not been applied yet. Apply that changeset and try this one again.');
}
}
$this->finishExecution();
}
示例7: initialize
/**
* Initialize this instance
* @param Array
* @param Vtiger_Module Instance of module to which this field belongs
* @param Vtiger_Block Instance of block to which this field belongs
* @access private
*/
function initialize($valuemap, $moduleInstance = false, $blockInstance = false)
{
$this->id = $valuemap['fieldid'];
$this->name = $valuemap['fieldname'];
$this->label = $valuemap['fieldlabel'];
$this->column = $valuemap['columnname'];
$this->table = $valuemap['tablename'];
$this->uitype = $valuemap['uitype'];
$this->typeofdata = $valuemap['typeofdata'];
$this->helpinfo = $valuemap['helpinfo'];
$this->masseditable = $valuemap['masseditable'];
$this->block = $blockInstance ? $blockInstance : Vtiger_Block::getInstance($valuemap['block'], $moduleInstance);
}
示例8: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$modname = 'Products';
$module = Vtiger_Module::getInstance($modname);
$block = Vtiger_Block::getInstance('LBL_PRICING_INFORMATION', $module);
$field = Vtiger_Field::getInstance('cost_price', $module);
if (!$field) {
$field1 = new Vtiger_Field();
$field1->name = 'cost_price';
$field1->label = 'Cost Price';
$field1->column = 'cost_price';
$field1->columntype = 'DECIMAL(28,6)';
$field1->uitype = 71;
$field1->typeofdata = 'N~O';
$field1->displaytype = 1;
$field1->presence = 0;
$block->addField($field1);
}
$modname = 'Services';
$module = Vtiger_Module::getInstance($modname);
$block = Vtiger_Block::getInstance('LBL_PRICING_INFORMATION', $module);
$field = Vtiger_Field::getInstance('cost_price', $module);
if (!$field) {
$field1 = new Vtiger_Field();
$field1->name = 'cost_price';
$field1->label = 'Cost Price';
$field1->column = 'cost_price';
$field1->columntype = 'DECIMAL(28,6)';
$field1->uitype = 71;
$field1->typeofdata = 'N~O';
$field1->displaytype = 1;
$field1->presence = 0;
$block->addField($field1);
}
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
$this->finishExecution();
}
示例9: initialize
/**
* Initialize this instance
* @param Array
* @param Vtiger_Module Instance of module to which this field belongs
* @param Vtiger_Block Instance of block to which this field belongs
* @access private
*/
function initialize($valuemap, $moduleInstance = false, $blockInstance = false)
{
$this->id = $valuemap['fieldid'];
$this->name = $valuemap['fieldname'];
$this->label = $valuemap['fieldlabel'];
$this->column = $valuemap['columnname'];
$this->table = $valuemap['tablename'];
$this->uitype = $valuemap['uitype'];
$this->typeofdata = $valuemap['typeofdata'];
$this->helpinfo = $valuemap['helpinfo'];
$this->masseditable = $valuemap['masseditable'];
$this->displaytype = $valuemap['displaytype'];
$this->generatedtype = $valuemap['generatedtype'];
$this->readonly = $valuemap['readonly'];
$this->presence = $valuemap['presence'];
$this->defaultvalue = $valuemap['defaultvalue'];
$this->quickcreate = $valuemap['quickcreate'];
$this->sequence = $valuemap['sequence'];
$this->summaryfield = $valuemap['summaryfield'];
$this->block = $blockInstance ? $blockInstance : Vtiger_Block::getInstance($valuemap['block'], $moduleInstance);
}
示例10: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$vendorsInstance = Vtiger_Module::getInstance('Vendors');
$blockInstance = Vtiger_Block::getInstance('LBL_VENDOR_INFORMATION', $vendorsInstance);
$field = Vtiger_Field::getInstance('assigned_user_id', $vendorsInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
} else {
$field = new Vtiger_Field();
$field->name = 'assigned_user_id';
$field->label = 'Assigned To';
$field->table = 'vtiger_crmentity';
$field->column = 'smownerid';
$field->columntype = 'INT(11)';
$field->uitype = 53;
$field->displaytype = 1;
$field->typeofdata = 'V~M';
$field->presence = 2;
$field->quickcreate = 0;
$field->quicksequence = 5;
$blockInstance->addField($field);
// Allow Sharing access and role-based security for Vendors
Vtiger_Access::deleteSharing($vendorsInstance);
Vtiger_Access::initSharing($vendorsInstance);
Vtiger_Access::allowSharing($vendorsInstance);
Vtiger_Access::setDefaultSharing($vendorsInstance);
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例11: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$moduleInstance = Vtiger_Module::getInstance('ModComments');
$block = Vtiger_Block::getInstance('LBL_OTHER_INFORMATION', $moduleInstance);
$field = Vtiger_Field::getInstance('relatedassignedemail', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
} else {
$modfield = new Vtiger_Field();
$modfield->name = 'relatedassignedemail';
$modfield->label = 'Related Assigned Email';
$modfield->table = $moduleInstance->basetable;
$modfield->column = 'relatedassignedemail';
$modfield->columntype = 'varchar(254)';
$modfield->typeofdata = 'E~O';
$modfield->uitype = '13';
$modfield->displaytype = 2;
// read only
$modfield->masseditable = '0';
$block->addField($modfield);
}
$this->ExecuteQuery('UPDATE vtiger_modcomments
INNER JOIN vtiger_crmentity on crmid=related_to
INNER JOIN vtiger_users on id = smownerid
SET relatedassignedemail = email1');
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例12: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
$moduleInstance = Vtiger_Module::getInstance('cbMap');
$block = Vtiger_Block::getInstance('LBL_MAP_INFORMATION', $moduleInstance);
$field = Vtiger_Field::getInstance('targetname', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
} else {
$field = new Vtiger_Field();
$field->name = 'targetname';
$field->label = 'Target Module';
$field->table = 'vtiger_cbmap';
$field->column = 'targetname';
$field->columntype = 'varchar(200)';
$field->typeofdata = 'V~O';
$field->uitype = '1613';
$field->masseditable = '0';
$field->sequence = 4;
$block->addField($field);
}
$field = Vtiger_Field::getInstance('assigned_user_id', $moduleInstance);
$this->ExecuteQuery('update vtiger_field set sequence=6 where fieldid=' . $field->id);
$field = Vtiger_Field::getInstance('createdtime', $moduleInstance);
$this->ExecuteQuery('update vtiger_field set sequence=7 where fieldid=' . $field->id);
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例13: vtlib_handler
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
*/
function vtlib_handler($modulename, $event_type)
{
global $adb;
require_once 'include/events/include.inc';
include_once 'vtlib/Vtiger/Module.php';
if ($event_type == 'module.postinstall') {
// TODO Handle post installation actions
$modAccounts = Vtiger_Module::getInstance('Accounts');
$modContacts = Vtiger_Module::getInstance('Contacts');
$modInvD = Vtiger_Module::getInstance('InventoryDetails');
$modIss = Vtiger_Module::getInstance('Issuecards');
if ($modAccounts) {
$modAccounts->setRelatedList($modIss, 'Issuecards', array('ADD'), 'get_dependents_list');
}
if ($modContacts) {
$modContacts->setRelatedList($modIss, 'Issuecards', array('ADD'), 'get_dependents_list');
}
if ($modInvD) {
$field = Vtiger_Field::getInstance('related_to', $modInvD);
$field->setRelatedModules(array('Issuecards'));
$modIss->setRelatedList($modInvD, 'InventoryDetails', array(''), 'get_dependents_list');
}
//Add Gendoc to Issuecards
if (vtlib_isModuleActive("evvtgendoc")) {
$modIss->addLink('LISTVIEWBASIC', 'Generate Document', "javascript:showgendoctemplates('\$MODULE\$');");
$modIss->addLink('DETAILVIEWWIDGET', 'Generate Document', "module=evvtgendoc&action=evvtgendocAjax&file=DetailViewWidget&formodule=\$MODULE\$&forrecord=\$RECORD\$", 'modules/evvtgendoc/evvtgendoc.gif');
}
$emm = new VTEntityMethodManager($adb);
// Adding EntityMethod for Updating Products data after updating PurchaseOrder
$emm->addEntityMethod("Issuecards", "UpdateInventory", "include/InventoryHandler.php", "handleInventoryProductRel");
// Creating Workflow for Updating Inventory Stock on Issuecards
$vtWorkFlow = new VTWorkflowManager($adb);
$invWorkFlow = $vtWorkFlow->newWorkFlow("Issuecards");
$invWorkFlow->test = '[{"fieldname":"pslip_no","operation":"does not contain","value":"`!`"}]';
$invWorkFlow->description = "UpdateInventoryProducts On Every Save";
$invWorkFlow->defaultworkflow = 1;
$vtWorkFlow->save($invWorkFlow);
$tm = new VTTaskManager($adb);
$task = $tm->createTask('VTEntityMethodTask', $invWorkFlow->id);
$task->active = true;
$task->methodName = "UpdateInventory";
$task->summary = "Update product stock";
$tm->saveTask($task);
$this->setModuleSeqNumber('configure', $modulename, 'pslip-', '0000001');
} else {
if ($event_type == 'module.disabled') {
// TODO Handle actions when this module is disabled.
} else {
if ($event_type == 'module.enabled') {
// TODO Handle actions when this module is enabled.
} else {
if ($event_type == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
} else {
if ($event_type == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else {
if ($event_type == 'module.postupdate') {
// TODO Handle actions after this module is updated.
$modInvD = Vtiger_Module::getInstance('InventoryDetails');
$modIss = Vtiger_Module::getInstance('Issuecards');
//Add subject field to can import and export
$block = Vtiger_Block::getInstance('LBL_ISSUECARDS_INFO', $modIss);
$field = Vtiger_Field::getInstance('subject', $modIss);
if (!$field) {
$field1 = new Vtiger_Field();
$field1->name = 'subject';
$field1->label = 'subject';
$field1->table = 'vtiger_issuecards';
$field1->column = 'subject';
$field1->columntype = 'VARCHAR(100)';
$field1->sequence = 3;
$field1->uitype = 1;
$field1->typeofdata = 'V~O';
$field1->displaytype = 1;
$field1->presence = 0;
$block->addField($field1);
}
if ($modInvD) {
$field = Vtiger_Field::getInstance('related_to', $modInvD);
$field->setRelatedModules(array('Issuecards'));
$modIss->setRelatedList($modInvD, 'InventoryDetails', array(''), 'get_dependents_list');
}
//Add Gendoc to Issuecards
if (vtlib_isModuleActive("evvtgendoc")) {
$modIss->addLink('LISTVIEWBASIC', 'Generate Document', "javascript:showgendoctemplates('\$MODULE\$');");
$modIss->addLink('DETAILVIEWWIDGET', 'Generate Document', "module=evvtgendoc&action=evvtgendocAjax&file=DetailViewWidget&formodule=\$MODULE\$&forrecord=\$RECORD\$", 'modules/evvtgendoc/evvtgendoc.gif');
}
$emm = new VTEntityMethodManager($adb);
// Adding EntityMethod for Updating Products data after updating Issuecards
$emm->addEntityMethod("Issuecards", "UpdateInventory", "include/InventoryHandler.php", "handleInventoryProductRel");
// Creating Workflow for Updating Inventory Stock on Issuecards
$vtWorkFlow = new VTWorkflowManager($adb);
$invWorkFlow = $vtWorkFlow->newWorkFlow("Issuecards");
$invWorkFlow->test = '[{"fieldname":"pslip_no","operation":"does not contain","value":"`!`"}]';
//.........这里部分代码省略.........
示例14: addFields
public function addFields()
{
global $log, $adb;
$log->debug("Entering YetiForceUpdate::addFields() method ...");
include_once 'vtlib/Vtiger/Module.php';
$columnName = array("tabid", "id", "column", "table", "generatedtype", "uitype", "name", "label", "readonly", "presence", "defaultvalue", "maximumlength", "sequence", "block", "displaytype", "typeofdata", "quickcreate", "quicksequence", "info_type", "masseditable", "helpinfo", "summaryfield", "fieldparams", "columntype", "blocklabel", "setpicklistvalues", "setrelatedmodules");
$OSSMailTemplates = array(array('49', '1739', 'ossmailtemplates_type', 'vtiger_ossmailtemplates', '1', '16', 'ossmailtemplates_type', 'LBL_TYPE', '1', '2', '', '100', '8', '126', '1', 'V~M', '1', NULL, 'BAS', '1', '', '0', '', "varchar(255)", "LBL_OSSMAILTEMPLATES_INFORMATION", array('PLL_MODULE', 'PLL_RECORD'), array()));
$Users = array(array('29', '1740', 'emailoptout', 'vtiger_users', '1', '56', 'emailoptout', 'Approval for email', '1', '0', '', '50', '22', '79', '1', 'V~O', '1', NULL, 'BAS', '1', '', '0', '', "varchar(3)", "LBL_MORE_INFORMATION", array(), array()));
$ProjectMilestone = array(array('41', '1741', 'projectmilestone_priority', 'vtiger_projectmilestone', '1', '15', 'projectmilestone_priority', 'LBL_PRIORITY', '1', '2', '', '100', '10', '101', '1', 'V~O', '1', NULL, 'BAS', '1', '', '0', '', "varchar(255)", "LBL_PROJECT_MILESTONE_INFORMATION", array('PLL_LOW', 'PLL_NORMAL', 'PLL_HIGH'), array()), array('41', '1743', 'projectmilestone_progress', 'vtiger_projectmilestone', '1', '1', 'projectmilestone_progress', 'LBL_PROGRESS', '1', '2', '', '100', '11', '101', '10', 'V~O', '1', NULL, 'BAS', '1', '', '0', '', "varchar(10)", "LBL_PROJECT_MILESTONE_INFORMATION", array(), array()));
$ProjectTask = array(array('42', '1742', 'estimated_work_time', 'vtiger_projecttask', '1', '7', 'estimated_work_time', 'LBL_ESTIMATED_WORK_TIME', '1', '2', '', '100', '9', '105', '1', 'NN~M', '1', 3, 'BAS', '1', '', '0', '', "decimal(8,2)", "LBL_CUSTOM_INFORMATION", array(), array()));
$Contacts = array(array('4', '1744', 'jobtitle', 'vtiger_contactdetails', '1', '1', 'jobtitle', 'Job title', '1', '2', '', '100', '31', '4', '1', 'V~O', '1', NULL, 'BAS', '1', '', '0', '', "varchar(100)", "LBL_CONTACT_INFORMATION", array(), array()), array(4, 1746, 'decision_maker', 'vtiger_contactdetails', 1, '56', 'decision_maker', 'Decision maker', 1, 2, '', 100, 9, 5, 1, 'C~O', 1, NULL, 'BAS', 1, '', 0, '', "tinyint(1)", "LBL_CUSTOM_INFORMATION", array(), array()));
$OSSMailView = array(array('54', '1745', 'date', 'vtiger_ossmailview', '1', '70', 'date', 'Date of receipt', '1', '2', '', '100', '24', '134', '2', 'DT~O', '1', NULL, 'BAS', '1', '', '0', '', "datetime", "LBL_INFORMATION", array(), array()));
$setToCRM = array('OSSMailTemplates' => $OSSMailTemplates, 'Users' => $Users, 'ProjectMilestone' => $ProjectMilestone, 'ProjectTask' => $ProjectTask, 'Contacts' => $Contacts, 'OSSMailView' => $OSSMailView);
$setToCRMAfter = array();
foreach ($setToCRM as $nameModule => $module) {
if (!$module) {
continue;
}
foreach ($module as $key => $fieldValues) {
for ($i = 0; $i < count($fieldValues); $i++) {
$setToCRMAfter[$nameModule][$key][$columnName[$i]] = $fieldValues[$i];
}
}
}
foreach ($setToCRMAfter as $moduleName => $fields) {
foreach ($fields as $field) {
if (self::checkFieldExists($field, $moduleName)) {
continue;
}
$moduleInstance = Vtiger_Module::getInstance($moduleName);
$blockInstance = Vtiger_Block::getInstance($field['blocklabel'], $moduleInstance);
$fieldInstance = new Vtiger_Field();
$fieldInstance->column = $field['column'];
$fieldInstance->name = $field['name'];
$fieldInstance->label = $field['label'];
$fieldInstance->table = $field['table'];
$fieldInstance->uitype = $field['uitype'];
$fieldInstance->typeofdata = $field['typeofdata'];
$fieldInstance->readonly = $field['readonly'];
$fieldInstance->displaytype = $field['displaytype'];
$fieldInstance->masseditable = $field['masseditable'];
$fieldInstance->quickcreate = $field['quickcreate'];
$fieldInstance->columntype = $field['columntype'];
$fieldInstance->presence = $field['presence'];
$fieldInstance->maximumlength = $field['maximumlength'];
$fieldInstance->quicksequence = $field['quicksequence'];
$fieldInstance->info_type = $field['info_type'];
$fieldInstance->helpinfo = $field['helpinfo'];
$fieldInstance->summaryfield = $field['summaryfield'];
$fieldInstance->generatedtype = $field['generatedtype'];
$fieldInstance->defaultvalue = $field['defaultvalue'];
$blockInstance->addField($fieldInstance);
if ($field['setpicklistvalues'] && ($field['uitype'] == 15 || $field['uitype'] == 16 || $field['uitype'] == 33)) {
$fieldInstance->setPicklistValues($field['setpicklistvalues']);
}
if ($field['setrelatedmodules'] && $field['uitype'] == 10) {
$fieldInstance->setRelatedModules($field['setrelatedmodules']);
}
}
}
$result = $adb->query("SHOW TABLES LIKE 'vtiger_ossmailtemplates_type';");
if ($adb->num_rows($result) == 1) {
$adb->pquery("UPDATE `vtiger_ossmailtemplates_type` SET `presence` = ? WHERE `ossmailtemplates_type` = ?;", array(0, 'PLL_MODULE'));
}
}
示例15: update_Blocks
/**
* Update Blocks of the module
* @access private
*/
function update_Blocks($modulenode, $moduleInstance)
{
if (empty($modulenode->blocks) || empty($modulenode->blocks->block)) {
return;
}
foreach ($modulenode->blocks->block as $blocknode) {
$this->listBlocks[] = strval($blocknode->label);
$blockInstance = Vtiger_Block::getInstance((string) $blocknode->label, $moduleInstance);
if (!$blockInstance) {
$blockInstance = $this->import_Block($modulenode, $moduleInstance, $blocknode);
} else {
$this->update_Block($modulenode, $moduleInstance, $blocknode, $blockInstance);
}
$this->update_Fields($blocknode, $blockInstance, $moduleInstance);
}
// Deleting removed blocks
$listBlockBeforeUpdate = Vtiger_Block::getAllForModule($moduleInstance);
foreach ($listBlockBeforeUpdate as $blockInstance) {
if (!in_array($blockInstance->label, $this->listBlocks)) {
$blockInstance->delete();
}
}
}