本文整理汇总了PHP中VTEntityData::fromEntityId方法的典型用法代码示例。如果您正苦于以下问题:PHP VTEntityData::fromEntityId方法的具体用法?PHP VTEntityData::fromEntityId怎么用?PHP VTEntityData::fromEntityId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTEntityData
的用法示例。
在下文中一共展示了VTEntityData::fromEntityId方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fetchEntity
function fetchEntity($moduleName, $recordId)
{
$adb = PearDatabase::getInstance();
$entityData = VTEntityData::fromEntityId($adb, $recordId);
if ($moduleName == 'HelpDesk') {
$entityData->set('comments', getTicketComments($recordId));
}
self::$newEntity[$moduleName][$recordId] = $entityData;
}
示例2: handleEvent
function handleEvent($eventName, $entityData)
{
$adb = PearDatabase::getInstance();
$moduleName = $entityData->getModuleName();
$recordId = $entityData->getId();
if ($eventName == 'vtiger.entity.beforesave') {
if (!empty($recordId)) {
self::$oldEntity[$moduleName][$recordId] = VTEntityData::fromEntityId($adb, $recordId);
}
}
if ($eventName == 'vtiger.entity.aftersave') {
self::$newEntity[$moduleName][$recordId] = VTEntityData::fromEntityId($adb, $recordId);
$this->computeDelta($moduleName, $recordId);
}
}
示例3: vtws_sendRecoverPassword
function vtws_sendRecoverPassword($username)
{
global $adb, $log, $current_user, $PORTAL_URL, $url_code;
$log->debug("Entering function vtws_sendRecoverPassword");
$ctors = $adb->query("select contactid,email,user_password\n\t\t\tfrom vtiger_contactdetails\n\t\t\tinner join vtiger_portalinfo on id=contactid\n\t\t\twhere isactive=1 and user_name='{$username}'");
if (!ctors or $adb->num_rows($ctors) == 0) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDUSERPWD, "Invalid username: username not found or not active");
}
require_once 'modules/Emails/mail.php';
require_once 'modules/Contacts/Contacts.php';
$cto = $adb->fetch_array($ctors);
$password = $cto['user_password'];
$entityData = VTEntityData::fromEntityId($adb, $cto['contactid']);
$contents = Contacts::getPortalEmailContents($entityData, $password);
$subject = getTranslatedString('Customer Portal Login Details', 'Contacts');
$mail_status = send_mail('Contacts', $cto['email'], $current_user->user_name, "", $subject, $contents);
$log->debug("Exiting function vtws_sendRecoverPassword");
return $mail_status;
}
示例4: save
//.........这里部分代码省略.........
$oplkjyxi = "availTaxes";
foreach (${$oplkjyxi} as ${${"GLOBALS"}["wfuwxbmiwytq"]}) {
$psuluqnb = "request_tax_name";
$enefpgduf = "tax";
${"GLOBALS"}["wxlvsgkcw"] = "request_tax_name";
${${"GLOBALS"}["hvjpdk"]} = ${$enefpgduf}["taxname"];
${${"GLOBALS"}["wxlvsgkcw"]} = ${${"GLOBALS"}["hvjpdk"]} . "_group_percentage";
$lifliipv = "request_tax_name";
$_REQUEST[${${"GLOBALS"}["hwivgkl"]}] = isset($this->_groupTax[${${"GLOBALS"}["hwivgkl"]}]) ? $this->_groupTax[${$psuluqnb}] : 0;
$bltbxkcxbjyp = "tmpTaxValue";
${${"GLOBALS"}["fvbuscvwjf"]} = $_REQUEST["total"] * ($_REQUEST[${$lifliipv}] / 100);
${${"GLOBALS"}["zjswudci"]} += ${$bltbxkcxbjyp};
}
$_REQUEST["total"] += ${${"GLOBALS"}["yirabwmnwgyp"]};
}
$_REQUEST["shipping_handling_charge"] = $this->_shippingCost;
${${"GLOBALS"}["cxnjuagap"]} = 0;
$bbluqvmmcrl = "tax";
foreach (${$mdwcbjhvim} as ${$bbluqvmmcrl}) {
$rbwcrso = "request_tax_name";
${"GLOBALS"}["woxvppdlct"] = "tmpTaxValue";
$xeqhidsvg = "shipTaxValue";
${"GLOBALS"}["rihoezbjibn"] = "tax_name";
${${"GLOBALS"}["rihoezbjibn"]} = ${${"GLOBALS"}["wfuwxbmiwytq"]}["taxname"];
${$rbwcrso} = ${${"GLOBALS"}["hvjpdk"]} . "_sh_percent";
$uaabpfjmwc = "request_tax_name";
$_REQUEST["sh" . ${${"GLOBALS"}["hwivgkl"]}] = isset($this->_shipTaxes[${${"GLOBALS"}["hwivgkl"]}]) ? $this->_shipTaxes[${${"GLOBALS"}["hwivgkl"]}] : 0;
${${"GLOBALS"}["fvbuscvwjf"]} = $_REQUEST["shipping_handling_charge"] * ($_REQUEST["sh" . ${$uaabpfjmwc}] / 100);
${$xeqhidsvg} += ${${"GLOBALS"}["woxvppdlct"]};
}
$_REQUEST["total"] += ${${"GLOBALS"}["ouawiowlgku"]} + $_REQUEST["shipping_handling_charge"];
$_REQUEST["adjustment"] = floatval($this->get("txtAdjustment"));
$_REQUEST["total"] += $_REQUEST["adjustment"];
${$nxxrnbh} = $this->getInternalObject();
$intObject->mode = "edit";
$intObject->isLineItemUpdate = true;
@saveInventoryProductDetails(${$klivirms}, $this->getModuleName());
for (${${"GLOBALS"}["jsntgvnqkf"]} = 1; ${${"GLOBALS"}["jsntgvnqkf"]} <= count($this->_listitems); ${$qwpblm}++) {
${"GLOBALS"}["xzgznik"] = "values";
${${"GLOBALS"}["xzgznik"]} = array();
$dqnotemwlbq = "params";
${$dqnotemwlbq} = array();
foreach (${${"GLOBALS"}["ogvkpmc"]} as ${${"GLOBALS"}["nctgtuliixp"]}) {
${"GLOBALS"}["fjordnwx"] = "values";
${${"GLOBALS"}["fjordnwx"]}[] = "`" . ${${"GLOBALS"}["nctgtuliixp"]} . "` = ?";
${${"GLOBALS"}["tjyzhfdvth"]}[] = $this->_listitems[${${"GLOBALS"}["jsntgvnqkf"]} - 1][${${"GLOBALS"}["nctgtuliixp"]}];
}
if (count(${${"GLOBALS"}["ibmlnecaubpt"]}) > 0) {
$nvtwyqcc = "params";
$wbzhsv = "i";
$glpeqaibe = "params";
${${"GLOBALS"}["tjyzhfdvth"]}[] = $this->getId();
$mjhhtobppu = "sql";
${$nvtwyqcc}[] = ${$wbzhsv};
${${"GLOBALS"}["hdblop"]} = "UPDATE vtiger_inventoryproductrel SET " . implode(",", ${${"GLOBALS"}["ibmlnecaubpt"]}) . " WHERE id = ? AND sequence_no = ?";
$adb->pquery(${$mjhhtobppu}, ${$glpeqaibe});
}
}
}
if (!empty(${${"GLOBALS"}["xkutivbm"]})) {
$wrqjvjvs = "update_query";
${"GLOBALS"}["ryhoienvnsn"] = "cur_sym_rate";
$xepbzcbhw = "update_params";
${"GLOBALS"}["ohiigcodbwo"] = "conversion_rate";
$pcrolhc = "currency_id";
${"GLOBALS"}["udferc"] = "conversion_rate";
$fkgwwhoop = "intObject";
${"GLOBALS"}["nglnmk"] = "update_query";
${"GLOBALS"}["nvezfxsotm"] = "currency_id";
if (strpos(${${"GLOBALS"}["nvezfxsotm"]}, "x") !== false) {
${"GLOBALS"}["twtpeleg"] = "parts";
${${"GLOBALS"}["bbeqpsqwehf"]} = explode("x", ${${"GLOBALS"}["xkutivbm"]});
${${"GLOBALS"}["xkutivbm"]} = ${${"GLOBALS"}["twtpeleg"]}[1];
} else {
${"GLOBALS"}["kuscdvfpt"] = "currency_id";
${${"GLOBALS"}["kuscdvfpt"]} = ${${"GLOBALS"}["xkutivbm"]};
}
$ksoimju = "cur_sym_rate";
${$ksoimju} = getCurrencySymbolandCRate(${${"GLOBALS"}["xkutivbm"]});
${${"GLOBALS"}["ohiigcodbwo"]} = ${${"GLOBALS"}["ryhoienvnsn"]}["rate"];
${"GLOBALS"}["epcnplti"] = "update_params";
${$fkgwwhoop} = $this->getInternalObject();
${$wrqjvjvs} = "update " . $intObject->table_name . " set currency_id = ?, conversion_rate = ? WHERE " . $intObject->table_index . " = ?";
${$xepbzcbhw} = array(${$pcrolhc}, ${${"GLOBALS"}["udferc"]}, $this->_id);
$adb->pquery(${${"GLOBALS"}["nglnmk"]}, ${${"GLOBALS"}["epcnplti"]});
}
if (file_exists(vglobal("root_directory") . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "Invoice" . DIRECTORY_SEPARATOR . "InvoiceHandler.php")) {
${"GLOBALS"}["hebripdxg"] = "entityData";
${"GLOBALS"}["llplslhg"] = "adb";
require_once "modules/Invoice/InvoiceHandler.php";
require_once "include/events/VTEventHandler.inc";
require_once "data/VTEntityDelta.php";
${${"GLOBALS"}["hebripdxg"]} = \VTEntityData::fromEntityId(${${"GLOBALS"}["llplslhg"]}, $this->getId(), $this->getModuleName());
$omsgxnkjeni = "handler";
${$omsgxnkjeni} = new \InvoiceHandler();
$handler->handleEvent("vtiger.entity.aftersave", ${${"GLOBALS"}["xxguhqgid"]});
}
$this->afterTransfer();
$this->_data = false;
}
示例5: trash
/** Function to delete an entity with given Id */
function trash($module, $id)
{
global $log, $current_user, $adb;
if (!self::isBulkSaveMode()) {
require_once "include/events/include.inc";
$em = new VTEventsManager($adb);
// Initialize Event trigger cache
$em->initTriggerCache();
$entityData = VTEntityData::fromEntityId($adb, $id);
$em->triggerEvent("vtiger.entity.beforedelete", $entityData);
}
$this->mark_deleted($id);
$this->unlinkDependencies($module, $id);
require_once 'libraries/freetag/freetag.class.php';
$freetag = new freetag();
$freetag->delete_all_object_tags_for_user($current_user->id, $id);
$sql_recentviewed = 'DELETE FROM vtiger_tracker WHERE user_id = ? AND item_id = ?';
$this->db->pquery($sql_recentviewed, array($current_user->id, $id));
if ($em) {
$em->triggerEvent("vtiger.entity.afterdelete", $entityData);
}
}
示例6: relateEntities
/**
* Function to related two records of different entity types
*/
function relateEntities($focus, $sourceModule, $sourceRecordId, $destinationModule, $destinationRecordIds)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$log->debug("Entering relateEntities method ({$sourceModule}, {$sourceRecordId}, {$destinationModule}, {$destinationRecordIds})");
require_once 'include/events/include.inc';
//require_once('modules/com_vtiger_workflow/VTWorkflowManager.inc');
//require_once('modules/com_vtiger_workflow/VTEntityCache.inc');
$em = new VTEventsManager($adb);
$em->initTriggerCache();
if (!is_array($destinationRecordIds)) {
$destinationRecordIds = [$destinationRecordIds];
}
$data = [];
$data['CRMEntity'] = $focus;
$data['entityData'] = VTEntityData::fromEntityId($adb, $sourceRecordId);
$data['sourceModule'] = $sourceModule;
$data['sourceRecordId'] = $sourceRecordId;
$data['destinationModule'] = $destinationModule;
foreach ($destinationRecordIds as $destinationRecordId) {
$data['destinationRecordId'] = $destinationRecordId;
$em->triggerEvent('vtiger.entity.link.before', $data);
$focus->save_related_module($sourceModule, $sourceRecordId, $destinationModule, $destinationRecordId);
$focus->trackLinkedInfo($sourceModule, $sourceRecordId, $destinationModule, $destinationRecordId);
/*
$wfs = new VTWorkflowManager($adb);
$workflows = $wfs->getWorkflowsForModule($sourceModule, VTWorkflowManager::$ON_RELATED);
$entityCache = new VTEntityCache(Users_Record_Model::getCurrentUserModel());
$entityData = VTEntityData::fromCRMEntity($focus);
$entityData->eventType = VTWorkflowManager::$ON_RELATED;
$entityData->relatedInfo = [
'destId' => $destinationRecordId,
'destModule' => $destinationModule,
];
foreach ($workflows as $id => $workflow) {
if ($workflow->evaluate($entityCache, $entityData->getId())) {
$workflow->performTasks($entityData);
}
}
*/
$em->triggerEvent('vtiger.entity.link.after', $data);
}
$log->debug("Exiting relateEntities method ...");
}
示例7: vtws_convertlead
function vtws_convertlead($entityvalues, $user)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$log->debug('Start ' . __CLASS__ . ':' . __FUNCTION__);
if (empty($entityvalues['assignedTo'])) {
$entityvalues['assignedTo'] = vtws_getWebserviceEntityId('Users', $user->id);
}
if (empty($entityvalues['transferRelatedRecordsTo'])) {
$entityvalues['transferRelatedRecordsTo'] = 'Accounts';
}
$leadObject = VtigerWebserviceObject::fromName($adb, 'Leads');
$handlerPath = $leadObject->getHandlerPath();
$handlerClass = $leadObject->getHandlerClass();
require_once $handlerPath;
$leadHandler = new $handlerClass($leadObject, $user, $adb, $log);
$leadInfo = vtws_retrieve($entityvalues['leadId'], $user);
$sql = "select converted from vtiger_leaddetails where converted = 1 and leadid=?";
$leadIdComponents = vtws_getIdComponents($entityvalues['leadId']);
$result = $adb->pquery($sql, array($leadIdComponents[1]));
if ($result === false) {
$log->error('Error converting a lead: ' . vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$DATABASEQUERYERROR));
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$DATABASEQUERYERROR));
}
$rowCount = $adb->num_rows($result);
if ($rowCount > 0) {
$log->error('Error converting a lead: Lead is already converted');
throw new WebServiceException(WebServiceErrorCode::$LEAD_ALREADY_CONVERTED, "Lead is already converted");
}
require_once "include/events/include.inc";
$em = new VTEventsManager($adb);
// Initialize Event trigger cache
$em->initTriggerCache();
$entityData = VTEntityData::fromEntityId($adb, $leadIdComponents[1]);
$em->triggerEvent('entity.convertlead.before', [$entityvalues, $user, $leadInfo]);
$entityIds = [];
$availableModules = ['Accounts', 'Contacts', 'Potentials'];
if (!($entityvalues['entities']['Accounts']['create'] || $entityvalues['entities']['Contacts']['create'])) {
return null;
}
foreach ($availableModules as $entityName) {
if ($entityvalues['entities'][$entityName]['create']) {
$entityvalue = $entityvalues['entities'][$entityName];
$entityObject = VtigerWebserviceObject::fromName($adb, $entityvalue['name']);
$handlerPath = $entityObject->getHandlerPath();
$handlerClass = $entityObject->getHandlerClass();
require_once $handlerPath;
$entityHandler = new $handlerClass($entityObject, $user, $adb, $log);
$entityObjectValues = array();
$entityObjectValues['assigned_user_id'] = $entityvalues['assignedTo'];
$entityObjectValues = vtws_populateConvertLeadEntities($entityvalue, $entityObjectValues, $entityHandler, $leadHandler, $leadInfo);
//update potential related to property
if ($entityvalue['name'] == 'Potentials') {
if (!empty($entityIds['Accounts'])) {
$entityObjectValues['related_to'] = $entityIds['Accounts'];
}
if (!empty($entityIds['Contacts'])) {
$entityObjectValues['contact_id'] = $entityIds['Contacts'];
}
}
//update the contacts relation
if ($entityvalue['name'] == 'Contacts') {
if (!empty($entityIds['Accounts'])) {
$entityObjectValues['parent_id'] = $entityIds['Accounts'];
}
}
try {
$create = true;
if ($entityvalue['name'] == 'Accounts' && $entityvalue['convert_to_id'] && is_int($entityvalue['convert_to_id'])) {
$entityIds[$entityName] = vtws_getWebserviceEntityId('Accounts', $entityvalue['convert_to_id']);
$create = false;
}
if ($create) {
$entityRecord = vtws_create($entityvalue['name'], $entityObjectValues, $user);
$entityIds[$entityName] = $entityRecord['id'];
}
} catch (Exception $e) {
$log->error('Error converting a lead: ' . $e->getMessage());
throw new WebServiceException(WebServiceErrorCode::$UNKNOWNOPERATION, $e->getMessage() . ' : ' . $entityvalue['name']);
}
}
}
try {
$accountIdComponents = vtws_getIdComponents($entityIds['Accounts']);
$accountId = $accountIdComponents[1];
$contactIdComponents = vtws_getIdComponents($entityIds['Contacts']);
$contactId = $contactIdComponents[1];
if (!empty($accountId) && !empty($contactId) && !empty($entityIds['Potentials'])) {
$potentialIdComponents = vtws_getIdComponents($entityIds['Potentials']);
$potentialId = $potentialIdComponents[1];
$sql = "insert into vtiger_contpotentialrel values(?,?)";
$result = $adb->pquery($sql, array($contactId, $potentialIdComponents[1]));
if ($result === false) {
throw new WebServiceException(WebServiceErrorCode::$FAILED_TO_CREATE_RELATION, "Failed to related Contact with the Potential");
}
}
$transfered = vtws_convertLeadTransferHandler($leadIdComponents, $entityIds, $entityvalues);
$relatedIdComponents = vtws_getIdComponents($entityIds[$entityvalues['transferRelatedRecordsTo']]);
vtws_getRelatedActivities($leadIdComponents[1], $accountId, $contactId, $relatedIdComponents[1]);
vtws_updateConvertLeadStatus($entityIds, $entityvalues['leadId'], $user);
//.........这里部分代码省略.........
示例8: DeleteEntity
/**
* This function returns no value but handles the delete functionality of each entity.
* Input Parameter are $module - module name, $return_module - return module name, $focus - module object, $record - entity id, $return_id - return entity id.
*/
function DeleteEntity($module, $return_module, $focus, $record, $return_id)
{
global $log, $adb;
$log->debug("Entering DeleteEntity method ({$module}, {$return_module}, {$record}, {$return_id})");
require_once "include/events/include.inc";
$em = new VTEventsManager($adb);
$em->initTriggerCache();
$entityData = VTEntityData::fromEntityId($adb, $record);
$em->triggerEvent("vtiger.entity.beforeunlink", $entityData);
if ($module != $return_module && !empty($return_module) && !empty($return_id)) {
$focus->unlinkRelationship($record, $return_module, $return_id);
$focus->trackUnLinkedInfo($return_module, $return_id, $module, $record);
} else {
$focus->trash($module, $record);
}
if ($em) {
$entityData = VTEntityData::fromEntityId($adb, $record);
$em->triggerEvent("vtiger.entity.afterunlink", $entityData);
}
$log->debug("Exiting DeleteEntity method ...");
}
示例9: relateEntities
/**
* Function to related two records of different entity types
*/
function relateEntities($focus, $sourceModule, $sourceRecordId, $destinationModule, $destinationRecordIds)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$log->debug("Entering relateEntities method ({$sourceModule}, {$sourceRecordId}, {$destinationModule}, {$destinationRecordIds})");
require_once "include/events/include.inc";
$em = new VTEventsManager($adb);
$em->initTriggerCache();
if (!is_array($destinationRecordIds)) {
$destinationRecordIds = [$destinationRecordIds];
}
$data = [];
$data['CRMEntity'] = $focus;
$data['entityData'] = VTEntityData::fromEntityId($adb, $sourceRecordId);
$data['sourceModule'] = $sourceModule;
$data['sourceRecordId'] = $sourceRecordId;
$data['destinationModule'] = $destinationModule;
foreach ($destinationRecordIds as $destinationRecordId) {
$data['destinationRecordId'] = $destinationRecordId;
$em->triggerEvent('vtiger.entity.link.before', $data);
$focus->save_related_module($sourceModule, $sourceRecordId, $destinationModule, $destinationRecordId);
$focus->trackLinkedInfo($sourceModule, $sourceRecordId, $destinationModule, $destinationRecordId);
$em->triggerEvent('vtiger.entity.link.after', $data);
}
$log->debug("Exiting relateEntities method ...");
}
示例10: trash
/** Function to delete an entity with given Id */
function trash($module, $id)
{
global $log, $current_user, $adb;
$recordType = Vtiger_Functions::getCRMRecordType($id);
if ($recordType != $module) {
throw new AppException(vtranslate('LBL_PERMISSION_DENIED'));
}
if (!self::isBulkSaveMode()) {
require_once "include/events/include.inc";
$em = new VTEventsManager($adb);
// Initialize Event trigger cache
$em->initTriggerCache();
$entityData = VTEntityData::fromEntityId($adb, $id);
$em->triggerEvent("vtiger.entity.beforedelete", $entityData);
}
$this->mark_deleted($id);
$this->unlinkDependencies($module, $id);
require_once 'libraries/freetag/freetag.class.php';
$freetag = new freetag();
$freetag->delete_all_object_tags_for_user($current_user->id, $id);
$this->db->delete('vtiger_tracker', 'user_id = ? AND item_id = ?', [$current_user->id, $id]);
if ($em) {
$em->triggerEvent("vtiger.entity.afterdelete", $entityData);
}
}