本文整理汇总了PHP中Vtiger_Field::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Field::getInstance方法的具体用法?PHP Vtiger_Field::getInstance怎么用?PHP Vtiger_Field::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Field
的用法示例。
在下文中一共展示了Vtiger_Field::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 ' . get_class($this) . ' already applied!');
} else {
global $adb;
$moduleInstance = Vtiger_Module::getInstance('GlobalVariable');
// change uitype and label
$field = Vtiger_Field::getInstance('module_list', $moduleInstance);
if ($field) {
$this->ExecuteQuery("update vtiger_field set uitype=3313,fieldlabel='Module List' where fieldid=" . $field->id);
}
// convert all existing records to new format
$gvrs = $adb->pquery('select globalvariableid,module_list from vtiger_globalvariable', array());
$updsql = 'update vtiger_globalvariable set module_list=? where globalvariableid=?';
while ($gv = $adb->fetch_array($gvrs)) {
if (trim($gv['module_list']) != '') {
$ml = array_map('trim', explode(',', $gv['module_list']));
$ml = implode(' |##| ', $ml);
$this->ExecuteQuery($updsql, array($ml, $gv['globalvariableid']));
}
}
// fix incorrect entiyidentifier
$updsql = "UPDATE `vtiger_entityname` SET \n\t\t\t\t`fieldname`='globalno',\n\t\t\t\t`entityidfield`='globalvariableid',\n\t\t\t\t`entityidcolumn`='globalvariableid'\n\t\t\t\tWHERE `modulename`='GlobalVariable' and `tablename`='vtiger_globalvariable'";
$this->sendMsg('Changeset ' . get_class($this) . ' 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 {
global $adb;
$modname = 'SalesOrder';
$module = Vtiger_Module::getInstance($modname);
$field = Vtiger_Field::getInstance('recurring_frequency', $module);
if ($field) {
$field->setPicklistValues(array('2years', '3years', '4years', '5years'));
$this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=7 WHERE recurring_frequency='2years'");
$this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=8 WHERE recurring_frequency='3years'");
$this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=9 WHERE recurring_frequency='4years'");
$this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=10 WHERE recurring_frequency='5years'");
}
$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_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();
}
示例5: 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('Products');
$field = Vtiger_Field::getInstance('discontinued', $moduleInstance);
if ($field) {
$this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
}
$moduleInstance = Vtiger_Module::getInstance('Services');
$field = Vtiger_Field::getInstance('discontinued', $moduleInstance);
if ($field) {
$this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
}
$moduleInstance = Vtiger_Module::getInstance('PriceBooks');
$field = Vtiger_Field::getInstance('active', $moduleInstance);
if ($field) {
$this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例6: undoChange
function undoChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
// undo your magic here
$moduleInstance = Vtiger_Module::getInstance('Potentials');
$field = Vtiger_Field::getInstance('forecast_amount', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=1 where fieldid=' . $field->id);
}
global $adb;
$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) {
$wfid = $adb->query_result($wfrs, 0, 0);
$this->deleteWorkflow($wfid);
$this->sendMsg('Workflow deleted!');
}
$this->sendMsg('Changeset ' . get_class($this) . ' undone!');
$this->markUndone();
} else {
$this->sendMsg('Changeset ' . get_class($this) . ' not applied!');
}
$this->finishExecution();
}
示例7: 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();
}
示例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;
$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();
}
示例9: getHeaders
public function getHeaders()
{
$this->initListViewController();
if (!$this->listviewHeaders) {
$headerFieldModels = array();
foreach ($this->listviewController->getListViewHeaderFields() as $fieldName => $webserviceField) {
$fieldObj = Vtiger_Field::getInstance($webserviceField->getFieldId());
$headerFieldModels[$fieldName] = Vtiger_Field_Model::getInstanceFromFieldObject($fieldObj);
}
$this->listviewHeaders = $headerFieldModels;
}
return $this->listviewHeaders;
}
示例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;
$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();
}
示例11: applyChange
function applyChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
$moduleInstance = Vtiger_Module::getInstance('Vendors');
$field = Vtiger_Field::getInstance('phone', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set uitype=11 where fieldid=' . $field->id);
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例12: applyChange
function applyChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
$moduleInstance = Vtiger_Module::getInstance('Project');
$field = Vtiger_Field::getInstance('targetbudget', $moduleInstance);
if ($field) {
$this->ExecuteQuery("update vtiger_field set typeofdata='N~O' where fieldid=" . $field->id);
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例13: applyChange
function applyChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$moduleInstance = Vtiger_Module::getInstance('GlobalVariable');
$field = Vtiger_Field::getInstance('gvname', $moduleInstance);
if ($field) {
$field->setPicklistValues(array('product_service_default'));
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例14: applyChange
function applyChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
$global_variables = array('product_service_default', 'Debug_Record_Not_Found', 'Product_Default_Units', 'Service_Default_Units', 'Maximum_Scheduled_Workflows', 'Billing_Address_Checked', 'Shipping_Address_Checked', 'Tax_Type_Default', 'calendar_call_default_duration', 'calendar_other_default_duration', 'calendar_sort_users_by', 'Debug_Send_VtigerCron_Error', 'Import_Full_CSV', 'Lead_Convert_TransferToAccount', 'Show_Copy_Adress_Header', 'SalesOrderStatusOnInvoiceSave', 'QuoteStatusOnSalesOrderSave');
$moduleInstance = Vtiger_Module::getInstance('GlobalVariable');
$field = Vtiger_Field::getInstance('gvname', $moduleInstance);
if ($field) {
$field->setPicklistValues($global_variables);
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例15: 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('Products');
$field = Vtiger_Field::getInstance('discontinued', $moduleInstance);
if ($field) {
$this->ExecuteQuery("update vtiger_field set typeofdata='C~O' where typeofdata='V~O' and fieldid=" . $field->id);
$this->ExecuteQuery("update vtiger_field set typeofdata='C~M' where typeofdata='V~M' and fieldid=" . $field->id);
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}