本文整理汇总了PHP中Vtiger_Utils::AddColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Utils::AddColumn方法的具体用法?PHP Vtiger_Utils::AddColumn怎么用?PHP Vtiger_Utils::AddColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Utils
的用法示例。
在下文中一共展示了Vtiger_Utils::AddColumn方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setRelatedList
/**
* Set related list information between other module
* @param Vtiger_Module Instance of target module with which relation should be setup
* @param String Label to display in related list (default is target module name)
* @param Array List of action button to show ('ADD', 'SELECT')
* @param String Callback function name of this module to use as handler
*
* @internal Creates table vtiger_crmentityrel if it does not exists
*/
function setRelatedList($moduleInstance, $label = '', $actions = false, $function_name = 'get_related_list')
{
global $adb;
if (empty($moduleInstance)) {
return;
}
if (!Vtiger_Utils::CheckTable('vtiger_crmentityrel')) {
Vtiger_Utils::CreateTable('vtiger_crmentityrel', '(crmid INT NOT NULL, module VARCHAR(100) NOT NULL, relcrmid INT NOT NULL, relmodule VARCHAR(100) NOT NULL)', true);
}
$relation_id = $this->__getRelatedListUniqueId();
$sequence = $this->__getNextRelatedListSequence();
$presence = 0;
// 0 - Enabled, 1 - Disabled
if (empty($label)) {
$label = $moduleInstance->name;
}
// Allow ADD action of other module records (default)
if ($actions === false) {
$actions = array('ADD');
}
$useactions_text = $actions;
if (is_array($actions)) {
$useactions_text = implode(',', $actions);
}
$useactions_text = strtoupper($useactions_text);
// Add column to vtiger_relatedlists to save extended actions
Vtiger_Utils::AddColumn('vtiger_relatedlists', 'actions', 'VARCHAR(50)');
$adb->pquery("INSERT INTO vtiger_relatedlists(relation_id,tabid,related_tabid,name,sequence,label,presence,actions) VALUES(?,?,?,?,?,?,?,?)", array($relation_id, $this->id, $moduleInstance->id, $function_name, $sequence, $label, $presence, $useactions_text));
self::log("Setting relation with {$moduleInstance->name} [{$useactions_text}] ... DONE");
}
示例2: __handleVtigerCoreSchemaChanges
/**
* Initialize vtiger schema changes.
* @access private
*/
function __handleVtigerCoreSchemaChanges()
{
// Add version column to the table first
Vtiger_Utils::AddColumn('vtiger_tab', 'version', ' VARCHAR(10)');
Vtiger_Utils::AddColumn('vtiger_tab', 'parent', ' VARCHAR(30)');
}
示例3: addField
/**
* Creating a new field
* @param string $type
* @param array $params
* @return array/false
*/
public function addField($type, $params)
{
$adb = PearDatabase::getInstance();
$inventoryClassName = Vtiger_Loader::getComponentClassName('InventoryField', $type, $this->get('module'));
$instance = new $inventoryClassName();
$table = $this->getTableName();
$columnName = $instance->getColumnName();
$label = $instance->getDefaultLabel();
$defaultValue = $instance->getDefaultValue();
$colSpan = $instance->getColSpan();
if (!$instance->isOnlyOne()) {
$id = $this->getUniqueID($instance);
$columnName = $columnName . $id;
}
if (isset($params['label'])) {
$label = $params['label'];
}
if (isset($params['defaultValue'])) {
$defaultValue = $params['defaultValue'];
}
if (isset($params['colSpan'])) {
$colSpan = $params['colSpan'];
}
Vtiger_Utils::AddColumn($table, $columnName, $instance->getDBType());
foreach ($instance->getCustomColumn() as $column => $criteria) {
Vtiger_Utils::AddColumn($table, $column, $criteria);
}
$result = $adb->query("SELECT MAX(sequence) AS max FROM " . $this->getTableName('fields'));
$sequence = (int) $adb->getSingleValue($result) + 1;
return $adb->insert($this->getTableName('fields'), ['columnname' => $columnName, 'label' => $label, 'invtype' => $instance->getName(), 'defaultvalue' => $defaultValue, 'sequence' => $sequence, 'block' => $params['block'], 'displaytype' => $params['displayType'], 'params' => $params['params'], 'colspan' => $colSpan]);
}
示例4: getTabid
$tabId = getTabid('PBXManager');
Migration_Index_View::ExecuteQuery("UPDATE vtiger_field SET presence=? WHERE tabid=? AND fieldname=?;", array(1, $tabId, "callfrom"));
Migration_Index_View::ExecuteQuery("UPDATE vtiger_field SET presence=? WHERE tabid=? AND fieldname=?;", array(1, $tabId, "callto"));
Migration_Index_View::ExecuteQuery("UPDATE vtiger_field SET presence=? WHERE tabid=? AND fieldname=?;", array(1, $tabId, "timeofcall"));
Migration_Index_View::ExecuteQuery("UPDATE vtiger_field SET presence=? WHERE tabid=? AND fieldname=?;", array(1, $tabId, "status"));
echo '<br>Hiding previous PBXManager fields done.<br>';
//PBXManager porting ends.
//Making document module fields masseditable
Migration_Index_View::ExecuteQuery("UPDATE vtiger_field SET masseditable = ? WHERE tabid = 8 AND fieldname = ?;", array(1, "notes_title"));
Migration_Index_View::ExecuteQuery("UPDATE vtiger_field SET masseditable = ? WHERE tabid = 8 AND fieldname = ?;", array(1, "assigned_user_id"));
Migration_Index_View::ExecuteQuery("UPDATE vtiger_field SET masseditable = ? WHERE tabid = 8 AND fieldname = ?;", array(1, "notecontent"));
Migration_Index_View::ExecuteQuery("UPDATE vtiger_field SET masseditable = ? WHERE tabid = 8 AND fieldname = ?;", array(1, "fileversion"));
Migration_Index_View::ExecuteQuery("UPDATE vtiger_field SET masseditable = ? WHERE tabid = 8 AND fieldname = ?;", array(1, "filestatus"));
Migration_Index_View::ExecuteQuery("UPDATE vtiger_field SET masseditable = ? WHERE tabid = 8 AND fieldname = ?;", array(1, "folderid"));
//Add Vat ID to Company Details
Vtiger_Utils::AddColumn('vtiger_organizationdetails', 'vatid', 'VARCHAR(100)');
//Add Column trial for vtiger_tab table if not exists
$result = $adb->pquery("SHOW COLUMNS FROM vtiger_tab LIKE ?", array('trial'));
if (!$adb->num_rows($result)) {
$adb->pquery("ALTER TABLE vtiger_tab ADD trial INT(1) NOT NULL DEFAULT 0", array());
}
##--http://trac.vtiger.com/cgi-bin/trac.cgi/ticket/7635--##
//Avoid premature deletion of activity related records
$moduleArray = array('Accounts', 'Leads', 'HelpDesk', 'Campaigns', 'Potentials', 'PurchaseOrder', 'SalesOrder', 'Quotes', 'Invoice');
$relatedToQuery = "SELECT fieldid FROM vtiger_field WHERE tabid=? AND fieldname=?";
$calendarInstance = Vtiger_Module::getInstance('Calendar');
$tabId = $calendarInstance->getId();
$result = $adb->pquery($relatedToQuery, array($tabId, 'parent_id'));
$fieldId = $adb->query_result($result, 0, 'fieldid');
$insertQuery = "INSERT INTO vtiger_fieldmodulerel (fieldid,module,relmodule,status,sequence) VALUES(?,?,?,?,?)";
$relModule = 'Calendar';
示例5: migration520_populateFieldForSecurity
migration520_populateFieldForSecurity($leads_tab_id, $campignrelstatus_leads_fieldid);
$campignrelstatus_campaigns_fieldid = $adb->getUniqueID('vtiger_field');
ExecuteQuery("INSERT INTO vtiger_field(tabid, fieldid, columnname, tablename, generatedtype, uitype, fieldname, fieldlabel, readonly, presence, selected, maximumlength, sequence, block, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, masseditable, helpinfo) VALUES ({$campaigns_tab_id}," . $campignrelstatus_campaigns_fieldid . ", 'campaignrelstatus', 'vtiger_campaignrelstatus', 1, '16', 'campaignrelstatus', 'Status', 1, 0, 0, 100, 1, NULL, 1, 'V~O', 1, NULL, 'BAS', 0, NULL)");
migration520_populateFieldForSecurity($campaigns_tab_id, $campignrelstatus_campaigns_fieldid);
ExecuteQuery("CREATE TABLE vtiger_campaignrelstatus (\n\tcampaignrelstatusid INTEGER, campaignrelstatus VARCHAR(200), sortorderid INT, presence INT) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
ExecuteQuery("INSERT INTO vtiger_campaignrelstatus VALUES (" . $adb->getUniqueID('vtiger_campaignrelstatus') . ", '--None--',1,1)");
ExecuteQuery("INSERT INTO vtiger_campaignrelstatus VALUES (" . $adb->getUniqueID('vtiger_campaignrelstatus') . ", 'Contacted - Successful',2,1)");
ExecuteQuery("INSERT INTO vtiger_campaignrelstatus VALUES (" . $adb->getUniqueID('vtiger_campaignrelstatus') . ", 'Contected - Unsuccessful',3,1)");
ExecuteQuery("INSERT INTO vtiger_campaignrelstatus VALUES (" . $adb->getUniqueID('vtiger_campaignrelstatus') . ", 'Contacted - Never Contact Again',4,1)");
ExecuteQuery("CREATE TABLE vtiger_campaignaccountrel (\n\tcampaignid INTEGER UNSIGNED NOT NULL,\n\taccountid INTEGER UNSIGNED NOT NULL,\n\tcampaignrelstatusid INTEGER UNSIGNED DEFAULT 1) ENGINE = InnoDB DEFAULT CHARSET=utf8;");
ExecuteQuery("ALTER TABLE vtiger_campaignaccountrel ADD PRIMARY KEY (campaignid, accountid)");
ExecuteQuery("ALTER TABLE vtiger_campaigncontrel ADD COLUMN campaignrelstatusid INTEGER UNSIGNED NOT NULL DEFAULT 1");
ExecuteQuery("ALTER TABLE vtiger_campaignleadrel ADD COLUMN campaignrelstatusid INTEGER UNSIGNED NOT NULL DEFAULT 1");
ExecuteQuery("INSERT INTO vtiger_relatedlists VALUES (" . $adb->getUniqueID('vtiger_relatedlists') . ", {$accounts_tab_id}, {$campaigns_tab_id}, 'get_campaigns', 13, 'Campaigns', 0, 'select')");
ExecuteQuery("INSERT INTO vtiger_relatedlists VALUES (" . $adb->getUniqueID('vtiger_relatedlists') . ", {$campaigns_tab_id}, {$accounts_tab_id}, 'get_accounts', 5, 'Accounts', 0, 'add,select')");
Vtiger_Utils::AddColumn('vtiger_inventorynotification', 'status', 'VARCHAR(30)');
//Fix : 6182 after migration from 510 'fields to be shown' at a profile for Email module
$query = "SELECT * from vtiger_profile";
$result = $adb->pquery($query, array());
$rows = $adb->num_rows($result);
$fields = "SELECT fieldid from vtiger_field where tablename = ?";
$fieldResult = $adb->pquery($fields, array('vtiger_emaildetails'));
$fieldRows = $adb->num_rows($fieldResult);
$EmailTabid = getTabid('Emails');
for ($i = 0; $i < $rows; $i++) {
$profileid = $adb->query_result($result, $i, 'profileid');
for ($j = 0; $j < $fieldRows; $j++) {
$fieldid = $adb->query_result($fieldResult, $j, 'fieldid');
$sql_profile2field = "select * from vtiger_profile2field where fieldid=? and profileid=?";
$result_profile2field = $adb->pquery($sql_profile2field, array($fieldid, $profileid));
$rows_profile2field = $adb->num_rows($result_profile2field);
示例6: __create
/**
* Create this field instance
* @param Vtiger_Block Instance of the block to use
* @access private
*/
function __create($blockInstance)
{
$this->__handleVtigerCoreSchemaChanges();
global $adb;
$this->block = $blockInstance;
$moduleInstance = $this->getModuleInstance();
$this->id = $this->__getUniqueId();
if (!$this->sequence) {
$this->sequence = $this->__getNextSequence();
}
if ($this->quickcreate != 1) {
// If enabled for display
if (!$this->quicksequence) {
$this->quicksequence = $this->__getNextQuickCreateSequence();
}
} else {
$this->quicksequence = null;
}
// Initialize other variables which are not done
if (!$this->table) {
$this->table = $moduleInstance->basetable;
}
if (!$this->column) {
$this->column = strtolower($this->name);
if (!$this->columntype) {
$this->columntype = 'VARCHAR(100)';
}
}
if (!$this->label) {
$this->label = $this->name;
}
$adb->pquery("INSERT INTO vtiger_field (tabid, fieldid, columnname, tablename, generatedtype,\n\t\t\tuitype, fieldname, fieldlabel, readonly, presence, defaultvalue, maximumlength, sequence,\n\t\t\tblock, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, helpinfo) \n\t\t\tVALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", array($this->getModuleId(), $this->id, $this->column, $this->table, $this->generatedtype, $this->uitype, $this->name, $this->label, $this->readonly, $this->presence, $this->defaultvalue, $this->maximumlength, $this->sequence, $this->getBlockId(), $this->displaytype, $this->typeofdata, $this->quickcreate, $this->quicksequence, $this->info_type, $this->helpinfo));
// Set the field status for mass-edit (if set)
$adb->pquery('UPDATE vtiger_field SET masseditable=? WHERE fieldid=?', array($this->masseditable, $this->id));
Vtiger_Profile::initForField($this);
if (!empty($this->columntype)) {
Vtiger_Utils::AddColumn($this->table, $this->column, $this->columntype);
}
self::log("Creating Field {$this->name} ... DONE");
self::log("Module language mapping for {$this->label} ... CHECK");
}
示例7: ExecutePQuery
$task->summary = 'Send Notification Email to Record Owner';
$task->recepient = "\$(assigned_user_id : (Users) email1)";
$task->subject = "Task : \$subject";
$task->content = '$(assigned_user_id : (Users) last_name) $(assigned_user_id : (Users) first_name) ,<br/>' . '<b>Task Notification Details:</b><br/>' . 'Subject : $subject<br/>' . 'Start date and time : $date_start $time_start ( $(general : (__VtigerMeta__) dbtimezone) ) <br/>' . 'End date and time : $due_date ( $(general : (__VtigerMeta__) dbtimezone) ) <br/>' . 'Status : $taskstatus <br/>' . 'Priority : $taskpriority <br/>' . 'Related To : $(parent_id : (Leads) lastname) $(parent_id : (Leads) firstname) $(parent_id : (Accounts) accountname) ' . '$(parent_id : (Potentials) potentialname) $(parent_id : (HelpDesk) ticket_title) <br/>' . 'Contacts List : $(contact_id : (Contacts) lastname) $(contact_id : (Contacts) firstname) <br/>' . 'Location : $location <br/>' . 'Description : $description';
$taskManager->saveTask($task);
ExecutePQuery("UPDATE com_vtiger_workflows SET defaultworkflow=1 WHERE\r\n\t\t\tmodule_name='Invoice' and summary='UpdateInventoryProducts On Every Save'", array());
$em = new VTEventsManager($adb);
// Registering event for HelpDesk - To reset from_portal value
$em->registerHandler('vtiger.entity.aftersave.final', 'modules/HelpDesk/HelpDeskHandler.php', 'HelpDeskHandler');
Vtiger_Cron::register('Workflow', 'cron/modules/com_vtiger_workflow/com_vtiger_workflow.service', 900, 'com_vtiger_workflow', '', '', 'Recommended frequency for Workflow is 15 mins');
Vtiger_Cron::register('RecurringInvoice', 'cron/modules/SalesOrder/RecurringInvoice.service', 43200, 'SalesOrder', '', '', 'Recommended frequency for RecurringInvoice is 12 hours');
Vtiger_Cron::register('SendReminder', 'cron/SendReminder.service', 900, 'Calendar', '', '', 'Recommended frequency for SendReminder is 15 mins');
Vtiger_Cron::register('ScheduleReports', 'cron/modules/Reports/ScheduleReports.service', 900, 'Reports', '', '', 'Recommended frequency for ScheduleReports is 15 mins');
Vtiger_Cron::register('MailScanner', 'cron/MailScanner.service', 900, 'Settings', '', '', 'Recommended frequency for MailScanner is 15 mins');
ExecutePQuery("DELETE FROM vtiger_settings_field WHERE name='LBL_ASSIGN_MODULE_OWNERS'", array());
Vtiger_Utils::AddColumn('vtiger_tab', 'parent', 'VARCHAR(30)');
ExecuteQuery("update vtiger_tab set parent = 'Sales' where name = 'Accounts'");
ExecuteQuery("update vtiger_tab set parent = 'Tools' where name = 'Calendar'");
ExecuteQuery("update vtiger_tab set parent = 'Sales' where name = 'Contacts'");
ExecuteQuery("update vtiger_tab set parent = 'Analytics' where name = 'Dashboard'");
ExecuteQuery("update vtiger_tab set parent = 'Sales' where name = 'Leads'");
ExecuteQuery("update vtiger_tab set parent = 'Sales' where name = 'Potentials'");
ExecuteQuery("update vtiger_tab set parent = 'Inventory' where name = 'Vendors'");
ExecuteQuery("update vtiger_tab set parent = 'Inventory' where name = 'Products'");
ExecuteQuery("update vtiger_tab set parent = 'Tools' where name = 'Documents'");
ExecuteQuery("update vtiger_tab set parent = 'Tools' where name = 'Emails'");
ExecuteQuery("update vtiger_tab set parent = 'Support' where name = 'HelpDesk'");
ExecuteQuery("update vtiger_tab set parent = 'Support' where name = 'Faq'");
ExecuteQuery("update vtiger_tab set tabsequence = -1 where name = 'Faq'");
ExecuteQuery("update vtiger_tab set parent = 'Inventory' where name = 'PriceBooks'");
ExecuteQuery("update vtiger_tab set tabsequence = -1 where name = 'PriceBooks'");
示例8: 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");
$Calculations = array(array('70', '1748', 'productid', 'vtiger_calculationsproductrel', '1', '10', 'productid', 'Item Name', '0', '2', '', '100', '1', '113', '5', 'V~M', '1', NULL, 'BAS', '0', '', '0', '', "int(19)", "LBL_ITEM_DETAILS", [], ['Products', 'Services']), array('70', '1749', 'quantity', 'vtiger_calculationsproductrel', '1', '7', 'quantity', 'Quantity', '0', '2', '', '100', '2', '113', '5', 'N~O', '1', NULL, 'BAS', '0', '', '0', '', "decimal(25,3)", "LBL_ITEM_DETAILS", [], []), array('70', '1750', 'listprice', 'vtiger_calculationsproductrel', '1', '71', 'listprice', 'List Price', '0', '2', '', '100', '3', '113', '5', 'N~O', '1', NULL, 'BAS', '0', '', '0', '', "decimal(27,8)", "LBL_ITEM_DETAILS", [], []), array('70', '1751', 'subtotal', 'vtiger_calculations', '1', '72', 'hdnSubTotal', 'Sub Total', '1', '2', '', '100', '14', '190', '3', 'N~O', '3', '0', 'BAS', '1', '', '0', '', "decimal(25,8)", "", [], []), array('70', '1752', 'pre_tax_total', 'vtiger_calculations', '1', '72', 'pre_tax_total', 'Pre Tax Total', '1', '2', '', '100', '23', '185', '3', 'N~O', '1', NULL, 'BAS', '1', '', '0', '', "decimal(25,8)", "LBL_PRODUCT_INFORMATION", [], []));
$OSSCosts = array(array('71', '1753', 'productid', 'vtiger_inventoryproductrel', '1', '10', 'productid', 'Item Name', '0', '2', '', '100', '1', '188', '5', 'V~M', '1', NULL, 'BAS', '0', '', '0', '', "int(19)", "LBL_CUSTOM_INFORMATION", [], ['Products', 'Services']), array('71', '1754', 'quantity', 'vtiger_inventoryproductrel', '1', '7', 'quantity', 'Quantity', '0', '2', '', '100', '2', '188', '5', 'N~O', '1', NULL, 'BAS', '0', '', '0', '', "decimal(25,3)", "LBL_CUSTOM_INFORMATION", [], []), array('71', '1755', 'listprice', 'vtiger_inventoryproductrel', '1', '71', 'listprice', 'List Price', '0', '2', '', '100', '3', '188', '5', 'N~O', '1', NULL, 'BAS', '0', '', '0', '', "decimal(27,8)", "LBL_CUSTOM_INFORMATION", [], []));
$setToCRM = array('Calculations' => $Calculations, 'OSSCosts' => $OSSCosts);
$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);
$id = $adb->getUniqueID('vtiger_field');
if ($blockInstance) {
$blockId = $blockInstance->id;
} else {
$blockId = $field['block'];
}
$adb->pquery("INSERT INTO vtiger_field (tabid, fieldid, columnname, tablename, generatedtype,\n\t\t\t\tuitype, fieldname, fieldlabel, readonly, presence, defaultvalue, maximumlength, sequence,\n\t\t\t\tblock, displaytype, typeofdata, quickcreate, quickcreatesequence, info_type, helpinfo, summaryfield, fieldparams,masseditable) \n\t\t\t\tVALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", [getTabid($moduleName), $id, $field['column'], $field['table'], $field['generatedtype'], $field['uitype'], $field['name'], $field['label'], $field['readonly'], $field['presence'], $field['defaultvalue'], $field['maximumlength'], $field['sequence'], $blockId, $field['displaytype'], $field['typeofdata'], $field['quickcreate'], $field['quicksequence'], $field['info_type'], $field['helpinfo'], $field['summaryfield'], $field['fieldparams'], $field['masseditable']]);
if (!empty($field['columntype']) && in_array($field['column'], ['subtotal', 'pre_tax_total'])) {
$columntype = $field['columntype'];
if ($field['uitype'] == 10) {
$columntype .= ', ADD INDEX (`' . $field['column'] . '`)';
}
Vtiger_Utils::AddColumn($field['table'], $field['column'], $columntype);
}
if ($field['setrelatedmodules'] && $field['uitype'] == 10) {
$this->setRelatedModules($field['setrelatedmodules'], $id, $moduleName);
}
}
}
$log->debug("Exiting YetiForceUpdate::addFields() method ...");
}