本文整理汇总了PHP中Vtiger_Field_Model::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Field_Model::delete方法的具体用法?PHP Vtiger_Field_Model::delete怎么用?PHP Vtiger_Field_Model::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Field_Model
的用法示例。
在下文中一共展示了Vtiger_Field_Model::delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete()
{
$adb = PearDatabase::getInstance();
parent::delete();
$fld_module = $this->getModuleName();
$id = $this->getId();
$uitype = $this->get('uitype');
$typeofdata = $this->get('typeofdata');
$fieldname = $this->getName();
$oldfieldlabel = $this->get('label');
$tablename = $this->get('table');
$columnname = $this->get('column');
$fieldtype = explode("~", $typeofdata);
$tabId = $this->getModuleId();
$focus = CRMEntity::getInstance($fld_module);
$deletecolumnname = $tablename . ":" . $columnname . ":" . $fieldname . ":" . $fld_module . "_" . str_replace(" ", "_", $oldfieldlabel) . ":" . $fieldtype[0];
$column_cvstdfilter = $tablename . ":" . $columnname . ":" . $fieldname . ":" . $fld_module . "_" . str_replace(" ", "_", $oldfieldlabel);
$select_columnname = $tablename . ":" . $columnname . ":" . $fld_module . "_" . str_replace(" ", "_", $oldfieldlabel) . ":" . $fieldname . ":" . $fieldtype[0];
$reportsummary_column = $tablename . ":" . $columnname . ":" . str_replace(" ", "_", $oldfieldlabel);
if ($tablename != 'vtiger_crmentity') {
$dbquery = 'alter table ' . $adb->quote($tablename, false) . ' drop column ' . $adb->quote($columnname, false);
$adb->pquery($dbquery, array());
}
//we have to remove the entries in customview and report related tables which have this field ($colName)
$adb->pquery('delete from vtiger_cvcolumnlist where columnname = ? ', array($deletecolumnname));
$adb->pquery('delete from vtiger_cvstdfilter where columnname = ?', array($column_cvstdfilter));
$adb->pquery('delete from vtiger_cvadvfilter where columnname = ?', array($deletecolumnname));
$adb->pquery('delete from vtiger_selectcolumn where columnname = ?', array($select_columnname));
$adb->pquery('delete from vtiger_relcriteria where columnname = ?', array($select_columnname));
$adb->pquery('delete from vtiger_reportsortcol where columnname = ?', array($select_columnname));
$adb->pquery('delete from vtiger_reportdatefilter where datecolumnname = ?', array($column_cvstdfilter));
$adb->pquery('delete from vtiger_reportsummary where columnname like ?', array('%' . $reportsummary_column . '%'));
//Deleting from convert lead mapping vtiger_table- Jaguar
if ($fld_module == 'Leads') {
$deletequery = 'delete from vtiger_convertleadmapping where leadfid=?';
$adb->pquery($deletequery, array($id));
} elseif ($fld_module == 'Accounts' || $fld_module == 'Contacts') {
$map_del_id = array('Accounts' => 'accountfid', 'Contacts' => 'contactfid');
$map_del_q = 'update vtiger_convertleadmapping set ' . $map_del_id[$fld_module] . '=0 where ' . $map_del_id[$fld_module] . '=?';
$adb->pquery($map_del_q, array($id));
}
//HANDLE HERE - we have to remove the table for other picklist type values which are text area and multiselect combo box
if ($this->getFieldDataType() == 'picklist' || $this->getFieldDataType() == 'multipicklist') {
$result = $adb->pquery('SELECT * FROM `vtiger_field` WHERE `columnname` = ? AND `uitype` IN (?,?,?);', [$columnname, 15, 16, 33]);
if (!$adb->num_rows($result)) {
$adb->query('drop table vtiger_' . $columnname);
//To Delete Sequence Table
if (Vtiger_Utils::CheckTable('vtiger_' . $columnname . '_seq')) {
$adb->query('drop table vtiger_' . $columnname . '_seq');
}
$adb->pquery('delete from vtiger_picklist where name=? ', array($columnname));
}
$adb->pquery('delete from vtiger_picklist_dependency where `tabid` = ? AND (sourcefield=? or targetfield=?)', array($tabId, $columnname, $columnname));
}
}
示例2: delete
public function delete()
{
$adb = PearDatabase::getInstance();
parent::delete();
$fld_module = $this->getModuleName();
$id = $this->getId();
$uitype = $this->get('uitype');
$typeofdata = $this->get('typeofdata');
$fieldname = $this->getName();
$oldfieldlabel = $this->get('label');
$tablename = $this->get('table');
$columnname = $this->get('column');
$fieldtype = explode("~", $typeofdata);
$focus = CRMEntity::getInstance($fld_module);
$deletecolumnname = $tablename . ":" . $columnname . ":" . $fieldname . ":" . $fld_module . "_" . str_replace(" ", "_", $oldfieldlabel) . ":" . $fieldtype[0];
$column_cvstdfilter = $tablename . ":" . $columnname . ":" . $fieldname . ":" . $fld_module . "_" . str_replace(" ", "_", $oldfieldlabel);
$select_columnname = $tablename . ":" . $columnname . ":" . $fld_module . "_" . str_replace(" ", "_", $oldfieldlabel) . ":" . $fieldname . ":" . $fieldtype[0];
$reportsummary_column = $tablename . ":" . $columnname . ":" . str_replace(" ", "_", $oldfieldlabel);
if ($tablename != 'vtiger_crmentity') {
$dbquery = 'alter table ' . $adb->sql_escape_string($tablename) . ' drop column ' . $adb->sql_escape_string($columnname);
$adb->pquery($dbquery, array());
}
//we have to remove the entries in customview and report related tables which have this field ($colName)
$adb->pquery("delete from vtiger_cvcolumnlist where columnname = ? ", array($deletecolumnname));
$adb->pquery("delete from vtiger_cvstdfilter where columnname = ?", array($column_cvstdfilter));
$adb->pquery("delete from vtiger_cvadvfilter where columnname = ?", array($deletecolumnname));
$adb->pquery("delete from vtiger_selectcolumn where columnname = ?", array($select_columnname));
$adb->pquery("delete from vtiger_relcriteria where columnname = ?", array($select_columnname));
$adb->pquery("delete from vtiger_reportsortcol where columnname = ?", array($select_columnname));
$adb->pquery("delete from vtiger_reportdatefilter where datecolumnname = ?", array($column_cvstdfilter));
$adb->pquery("delete from vtiger_reportsummary where columnname like ?", array('%' . $reportsummary_column . '%'));
//Deleting from convert lead mapping vtiger_table- Jaguar
if ($fld_module == "Leads") {
$deletequery = 'delete from vtiger_convertleadmapping where leadfid=?';
$adb->pquery($deletequery, array($id));
} elseif ($fld_module == "Accounts" || $fld_module == "Contacts" || $fld_module == "Potentials") {
$map_del_id = array("Accounts" => "accountfid", "Contacts" => "contactfid", "Potentials" => "potentialfid");
$map_del_q = "update vtiger_convertleadmapping set " . $map_del_id[$fld_module] . "=0 where " . $map_del_id[$fld_module] . "=?";
$adb->pquery($map_del_q, array($id));
}
//HANDLE HERE - we have to remove the table for other picklist type values which are text area and multiselect combo box
if ($this->getFieldDataType() == 'picklist' || $this->getFieldDataType() == 'multipicklist') {
$deltablequery = 'drop table vtiger_' . $adb->sql_escape_string($columnname);
$adb->pquery($deltablequery, array());
//To Delete Sequence Table
$deltableseqquery = 'drop table vtiger_' . $adb->sql_escape_string($columnname) . '_seq';
$adb->pquery($deltableseqquery, array());
$adb->pquery("delete from vtiger_picklist where name=? ", array($columnname));
$adb->pquery("delete from vtiger_picklist_dependency where sourcefield=? or targetfield=?", array($columnname, $columnname));
}
}