本文整理汇总了PHP中vtws_getWebserviceEntityId函数的典型用法代码示例。如果您正苦于以下问题:PHP vtws_getWebserviceEntityId函数的具体用法?PHP vtws_getWebserviceEntityId怎么用?PHP vtws_getWebserviceEntityId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtws_getWebserviceEntityId函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: isHideBlock
public function isHideBlock($record, $view)
{
$db = PearDatabase::getInstance();
$result = $db->pquery("SELECT * FROM vtiger_blocks_hide WHERE enabled = ? AND blockid = ? AND view LIKE '%{$view}%';", array(1, $this->get('id')));
$num_rows = $db->num_rows($result);
$hideBlocks = array();
for ($i = 0; $i < $num_rows; $i++) {
$row = $db->raw_query_result_rowdata($result, $i);
$hideBlocks[] = $row;
}
if (count($hideBlocks) == 0) {
return true;
}
require_once "modules/com_vtiger_workflow/VTJsonCondition.inc";
require_once "modules/com_vtiger_workflow/VTEntityCache.inc";
require_once "modules/com_vtiger_workflow/VTWorkflowUtils.php";
$conditionStrategy = new VTJsonCondition();
$currentUser = Users_Record_Model::getCurrentUserModel();
$util = new VTWorkflowUtils();
$entityCache = new VTEntityCache($currentUser);
$wsId = vtws_getWebserviceEntityId($record->getModuleName(), $record->getId());
$showBlock = false;
foreach ($hideBlocks as $hideBlock) {
$expr = Zend_Json::decode($hideBlock['conditions']);
if (!$record->getId() && $expr) {
continue;
}
$showBlock = $conditionStrategy->evaluate($hideBlock['conditions'], $entityCache, $wsId);
}
return !$showBlock;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:31,代码来源:Block.php
示例2: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$modules = $request->get('modules');
$assignId = $request->get('assigned_user_id');
$currentUser = Users_Record_Model::getCurrentUserModel();
$entityValues = array();
$entityValues['transferRelatedRecordsTo'] = $request->get('transferModule');
//■権限なぜか、エラーになるので権限を固定するinouchi
//$entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType($assignId), $assignId);
$entityValues['assignedTo'] = vtws_getWebserviceEntityId(vtws_getOwnerType(1), 1);
$entityValues['leadId'] = vtws_getWebserviceEntityId($request->getModule(), $recordId);
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $request->getModule());
$convertLeadFields = $recordModel->getConvertLeadFields();
$availableModules = array('Accounts', 'Contacts', 'Potentials');
foreach ($availableModules as $module) {
if (vtlib_isModuleActive($module) && in_array($module, $modules)) {
$entityValues['entities'][$module]['create'] = true;
$entityValues['entities'][$module]['name'] = $module;
foreach ($convertLeadFields[$module] as $fieldModel) {
$fieldName = $fieldModel->getName();
$fieldValue = $request->get($fieldName);
//Potential Amount Field value converting into DB format
if ($fieldModel->getFieldDataType() === 'currency') {
$fieldValue = Vtiger_Currency_UIType::convertToDBFormat($fieldValue);
} elseif ($fieldModel->getFieldDataType() === 'date') {
$fieldValue = DateTimeField::convertToDBFormat($fieldValue);
} elseif ($fieldModel->getFieldDataType() === 'reference' && $fieldValue) {
$ids = vtws_getIdComponents($fieldValue);
if (count($ids) === 1) {
$fieldValue = vtws_getWebserviceEntityId(getSalesEntityType($fieldValue), $fieldValue);
}
}
$entityValues['entities'][$module][$fieldName] = $fieldValue;
}
}
}
try {
$result = vtws_convertlead($entityValues, $currentUser);
} catch (Exception $e) {
$this->showError($request, $e);
exit;
}
if (!empty($result['Accounts'])) {
$accountIdComponents = vtws_getIdComponents($result['Accounts']);
$accountId = $accountIdComponents[1];
}
if (!empty($result['Contacts'])) {
$contactIdComponents = vtws_getIdComponents($result['Contacts']);
$contactId = $contactIdComponents[1];
}
if (!empty($accountId)) {
header("Location: index.php?view=Detail&module=Accounts&record={$accountId}");
} elseif (!empty($contactId)) {
header("Location: index.php?view=Detail&module=Contacts&record={$contactId}");
} else {
$this->showError($request);
exit;
}
}
开发者ID:cin-system,项目名称:cinrepo,代码行数:60,代码来源:SaveConvertLead.php
示例3: transformToSourceRecord
/**
* Tarsform Google Records to Vtiger Records
* @param <array> $targetRecords
* @return <array> tranformed Google Records
*/
public function transformToSourceRecord($targetRecords, $user = false)
{
$entity = array();
$calendarArray = array();
foreach ($targetRecords as $googleRecord) {
if ($googleRecord->getMode() != WSAPP_SyncRecordModel::WSAPP_DELETE_MODE) {
if (!$user) {
$user = Users_Record_Model::getCurrentUserModel();
}
$entity['assigned_user_id'] = vtws_getWebserviceEntityId('Users', $user->id);
$entity['subject'] = $googleRecord->getSubject();
$entity['date_start'] = $googleRecord->getStartDate($user);
$entity['location'] = $googleRecord->getWhere();
$entity['time_start'] = $googleRecord->getStartTimeUTC($user);
$entity['due_date'] = $googleRecord->getEndDate($user);
$entity['time_end'] = $googleRecord->getEndTimeUTC($user);
$entity['eventstatus'] = "Planned";
$entity['activitytype'] = "Meeting";
$entity['description'] = $googleRecord->getDescription();
$entity['duration_hours'] = '00:00';
$entity['visibility'] = $googleRecord->getVisibility($user);
if (empty($entity['subject'])) {
$entity['subject'] = 'Google Event';
}
}
$calendar = $this->getSynchronizeController()->getSourceRecordModel($entity);
$calendar = $this->performBasicTransformations($googleRecord, $calendar);
$calendar = $this->performBasicTransformationsToSourceRecords($calendar, $googleRecord);
$calendarArray[] = $calendar;
}
return $calendarArray;
}
开发者ID:cin-system,项目名称:cinrepo,代码行数:37,代码来源:Calendar.php
示例4: process
function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$record = $request->get('record');
vimport('~~modules/com_vtiger_workflow/include.inc');
vimport('~~modules/com_vtiger_workflow/VTEntityCache.inc');
vimport('~~modules/com_vtiger_workflow/include.inc');
vimport('~~include/Webservices/Utils.php');
vimport('~~include/Webservices/Retrieve.php');
$adb = PearDatabase::getInstance();
$wfs = new VTWorkflowManager($adb);
$workflows = $wfs->getWorkflowsForModule($moduleName, VTWorkflowManager::$TRIGGER);
$currentUser = Users_Record_Model::getCurrentUserModel();
$wsId = vtws_getWebserviceEntityId($moduleName, $record);
$entityCache = new VTEntityCache($currentUser);
$entityData = $entityCache->forId($wsId);
foreach ($workflows as $id => $workflow) {
if (!$workflow->evaluate($entityCache, $entityData->getId())) {
unset($workflows[$id]);
}
}
$viewer = $this->getViewer($request);
$viewer->assign('RECORD', $record);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('WORKFLOWS', $workflows);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->view('WorkflowTrigger.tpl', $moduleName);
}
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:28,代码来源:WorkflowTrigger.php
示例5: loadRecord
/**
* Function to load record
* @param <Number> $recordId
* @return <Vtiger_Record_Model>
*/
protected function loadRecord($recordId)
{
$moduleName = $this->module->getName();
// Preparation to pull required tool-tip field values.
$referenceFields = array();
$fieldNames = array();
foreach ($this->fields as $fieldModel) {
$fieldType = $fieldModel->getFieldDataType();
$fieldName = $fieldModel->get('name');
$fieldNames[] = $fieldName;
if ($fieldType == 'reference' || $fieldType == 'owner') {
$referenceFields[] = $fieldName;
}
}
$wsid = vtws_getWebserviceEntityId($moduleName, $recordId);
$q = sprintf("SELECT %s FROM %s WHERE id='%s' LIMIT 1;", implode(',', $fieldNames), $moduleName, $wsid);
// Retrieves only required fields of the record with permission check.
try {
$data = array_shift(vtws_query($q, Users_Record_Model::getCurrentUserModel()));
if ($data) {
// De-transform the webservice ID to CRM ID.
foreach ($data as $key => $value) {
if (in_array($key, $referenceFields)) {
$value = array_pop(explode('x', $value));
}
$data[$key] = $value;
}
}
$this->record = Vtiger_Record_Model::getCleanInstance($moduleName);
$this->record->setData($data);
} catch (WebServiceException $wex) {
// Error retrieving information !
}
return $this;
}
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:40,代码来源:TooltipView.php
示例6: changePassword
public function changePassword($request)
{
$request = new Vtiger_Request($request);
$viewer = Vtiger_Viewer::getInstance();
$userName = $request->get('username');
$newPassword = $request->get('password');
$confirmPassword = $request->get('confirmPassword');
$shortURLID = $request->get('shorturl_id');
$secretHash = $request->get('secret_hash');
$shortURLModel = Vtiger_ShortURL_Helper::getInstance($shortURLID);
$secretToken = $shortURLModel->handler_data['secret_token'];
$validateData = array('username' => $userName, 'secret_token' => $secretToken, 'secret_hash' => $secretHash);
$valid = $shortURLModel->compareEquals($validateData);
if ($valid) {
$userId = getUserId_Ol($userName);
$user = Users::getActiveAdminUser();
$wsUserId = vtws_getWebserviceEntityId('Users', $userId);
vtws_changePassword($wsUserId, '', $newPassword, $confirmPassword, $user);
} else {
$viewer->assign('ERROR', true);
}
$shortURLModel->delete();
$viewer->assign('USERNAME', $userName);
$viewer->assign('PASSWORD', $newPassword);
$viewer->view('FPLogin.tpl', 'Users');
}
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:26,代码来源:ForgotPassword.php
示例7: handleEvent
function handleEvent($eventName, $data)
{
if ($eventName == 'vtiger.entity.beforesave') {
// Entity is about to be saved, take required action
}
if ($eventName == 'vtiger.entity.aftersave') {
$db = PearDatabase::getInstance();
$relatedToId = $data->get('related_to');
if ($relatedToId) {
$moduleName = getSalesEntityType($relatedToId);
$focus = CRMEntity::getInstance($moduleName);
$focus->retrieve_entity_info($relatedToId, $moduleName);
$focus->id = $relatedToId;
$fromPortal = $data->get('from_portal');
if ($fromPortal) {
$focus->column_fields['from_portal'] = $fromPortal;
}
$entityData = VTEntityData::fromCRMEntity($focus);
$wfs = new VTWorkflowManager($db);
$relatedToEventHandler = new VTWorkflowEventHandler();
$relatedToEventHandler->workflows = $wfs->getWorkflowsForModuleSupportingComments($entityData->getModuleName());
$wsId = vtws_getWebserviceEntityId($entityData->getModuleName(), $entityData->getId());
$fromPortal = $entityData->get('from_portal');
$util = new VTWorkflowUtils();
$entityCache = new VTEntityCache($util->adminUser());
$entityCacheData = $entityCache->forId($wsId);
$entityCacheData->set('from_portal', $fromPortal);
$entityCache->cache[$wsId] = $entityCacheData;
$relatedToEventHandler->handleEvent($eventName, $entityData, $entityCache);
$util->revertUser();
}
}
}
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:33,代码来源:ModCommentsHandler.php
示例8: translateReferenceFieldNamesToIds
public function translateReferenceFieldNamesToIds($entityRecords, $user)
{
$entityRecordList = array();
foreach ($entityRecords as $index => $record) {
$entityRecordList[$record['module']][$index] = $record;
}
foreach ($entityRecordList as $module => $records) {
$handler = vtws_getModuleHandlerFromName($module, $user);
$meta = $handler->getMeta();
$referenceFieldDetails = $meta->getReferenceFieldDetails();
foreach ($referenceFieldDetails as $referenceFieldName => $referenceModuleDetails) {
$recordReferenceFieldNames = array();
foreach ($records as $index => $recordDetails) {
if (!empty($recordDetails[$referenceFieldName])) {
$recordReferenceFieldNames[] = $recordDetails[$referenceFieldName];
}
}
$entityNameIds = wsapp_getRecordEntityNameIds(array_values($recordReferenceFieldNames), $referenceModuleDetails, $user);
if (is_array($entityNameIds)) {
$entityNameIds = array_change_key_case($entityNameIds, CASE_LOWER);
}
foreach ($records as $index => $recordInfo) {
if (!empty($entityNameIds[strtolower($recordInfo[$referenceFieldName])])) {
$recordInfo[$referenceFieldName] = $entityNameIds[strtolower($recordInfo[$referenceFieldName])];
} else {
if ($referenceFieldName == 'account_id') {
if ($recordInfo[$referenceFieldName] != NULL) {
$element['accountname'] = $recordInfo[$referenceFieldName];
$element['assigned_user_id'] = vtws_getWebserviceEntityId('Users', $user->id);
$element['module'] = "Accounts";
$createRecord = array($element);
$createRecord = $this->fillNonExistingMandatoryPicklistValues($createRecord);
$createRecord = $this->fillMandatoryFields($createRecord, $user);
foreach ($createRecord as $key => $record) {
vtws_create($record['module'], $record, $user);
}
$entityNameIds = wsapp_getRecordEntityNameIds(array_values($recordReferenceFieldNames), $referenceModuleDetails, $user);
$recordInfo[$referenceFieldName] = $entityNameIds[$recordInfo[$referenceFieldName]];
}
} else {
$recordInfo[$referenceFieldName] = "";
}
}
$records[$index] = $recordInfo;
}
}
$entityRecordList[$module] = $records;
}
$crmRecords = array();
foreach ($entityRecordList as $module => $entityRecords) {
foreach ($entityRecords as $index => $record) {
$crmRecords[$index] = $record;
}
}
return $crmRecords;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:56,代码来源:OutlookVtigerCRMHandler.php
示例9: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$userId = vtws_getWebserviceEntityId($moduleName, $request->get('userid'));
$transformUserId = vtws_getWebserviceEntityId($moduleName, $request->get('transfer_user_id'));
$userModel = Users_Record_Model::getCurrentUserModel();
$userModuleModel = Users_Module_Model::getInstance($moduleName);
$result = vtws_deleteUser($userId, $transformUserId, $userModel);
$listViewUrl = $userModuleModel->getListViewUrl();
$response = new Vtiger_Response();
$response->setResult(array('message' => vtranslate('LBL_USER_DELETED_SUCCESSFULLY', $moduleName), 'listViewUrl' => $listViewUrl));
$response->emit();
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:13,代码来源:DeleteAjax.php
示例10: captureNow
function captureNow($request)
{
$returnURL = false;
try {
foreach ($request as $key => $value) {
$request[utf8_decode($key)] = $value;
}
if (!vtlib_isModuleActive('Webforms')) {
throw new Exception('webforms is not active');
}
$webform = Webforms_Model::retrieveWithPublicId(vtlib_purify($request['publicid']));
if (empty($webform)) {
throw new Exception("Webform not found.");
}
$returnURL = $webform->getReturnUrl();
// Retrieve user information
$user = CRMEntity::getInstance('Users');
$user->id = $user->getActiveAdminId();
$user->retrieve_entity_info($user->id, 'Users');
// Prepare the parametets
$parameters = array();
$webformFields = $webform->getFields();
foreach ($webformFields as $webformField) {
if ($webformField->getDefaultValue() != null) {
$parameters[$webformField->getFieldName()] = decode_html($webformField->getDefaultValue());
} else {
$webformNeutralizedField = html_entity_decode($webformField->getNeutralizedField());
if (is_array(vtlib_purify($request[$webformNeutralizedField]))) {
$fieldData = implode(" |##| ", vtlib_purify($request[$webformNeutralizedField]));
} else {
$fieldData = vtlib_purify($request[$webformNeutralizedField]);
$fieldData = decode_html($fieldData);
}
$parameters[$webformField->getFieldName()] = stripslashes($fieldData);
}
if ($webformField->getRequired()) {
if (empty($parameters[$webformField->getFieldName()])) {
throw new Exception("Required fields not filled");
}
}
}
$parameters['assigned_user_id'] = vtws_getWebserviceEntityId('Users', $webform->getOwnerId());
// Create the record
$record = vtws_create($webform->getTargetModule(), $parameters, $user);
$this->sendResponse($returnURL, 'ok');
return;
} catch (Exception $e) {
$this->sendResponse($returnURL, false, $e->getMessage());
return;
}
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:51,代码来源:capture.php
示例11: changePassword
public function changePassword($request)
{
$request = new Vtiger_Request($request);
$viewer = Vtiger_Viewer::getInstance();
$username = $request->get('username');
$newPassword = $request->get('password');
$confirmPassword = $request->get('confirmPassword');
$userId = getUserId_Ol($username);
$user = Users::getActiveAdminUser();
$wsUserId = vtws_getWebserviceEntityId('Users', $userId);
vtws_changePassword($wsUserId, '', $newPassword, $confirmPassword, $user);
$viewer->assign('USERNAME', $username);
$viewer->assign('PASSWORD', $newPassword);
$viewer->view('FPLogin.tpl', 'Users');
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:15,代码来源:ForgotPassword.php
示例12: process
public function process(Vtiger_Request $request)
{
include_once 'include/Webservices/Retrieve.php';
include_once 'include/Webservices/Revise.php';
$user = CRMEntity::getInstance('Users');
$user->id = 1;
$user->retrieve_entity_info($user->id, 'Users');
$wsrecord = vtws_retrieve(vtws_getWebserviceEntityId('Invoice', 159), $user);
$new['LineItems'] = $wsrecord['LineItems'];
$new['id'] = $wsrecord['id'];
$new['LineItems'][] = array('parent_id' => '7x159', 'productid' => '14x109', 'sequence_no' => '2', 'quantity' => '3', 'listprice' => '2.1', 'comment' => 'Kommentar ' . date('Y-m-d H:i:s'), 'incrementondel' => '1', 'tax1' => 5);
$lead = vtws_revise($new, $user);
echo '<pre>';
var_dump($wsrecord);
echo '</pre>';
}
开发者ID:Neodracir,项目名称:VtigerCRM-Tools,代码行数:16,代码来源:Example.php
示例13: queryForRecords
public function queryForRecords($query, $onlymine = true)
{
$user = Users_Record_Model::getCurrentUserModel();
if ($onlymine) {
$groupIds = $this->getGroupsIdsForUsers($user->getId());
$groupWsIds = array();
foreach ($groupIds as $groupId) {
$groupWsIds[] = vtws_getWebserviceEntityId('Groups', $groupId);
}
$userwsid = vtws_getWebserviceEntityId('Users', $user->getId());
$userAndGroupIds = array_merge(array($userwsid), $groupWsIds);
$query .= " AND assigned_user_id IN ('" . implode("','", $userAndGroupIds) . "')";
}
// TODO take care of pulling 100+ records
return vtws_query($query . ';', $user);
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:16,代码来源:Feed.php
示例14: savePassword
public function savePassword(Vtiger_Request $request)
{
$module = $request->getModule();
$userModel = vglobal('current_user');
$newPassword = $request->get('new_password');
$oldPassword = $request->get('old_password');
$wsUserId = vtws_getWebserviceEntityId($module, $request->get('userid'));
$wsStatus = vtws_changePassword($wsUserId, $oldPassword, $newPassword, $newPassword, $userModel);
$response = new Vtiger_Response();
if ($wsStatus['message']) {
$response->setResult($wsStatus);
} else {
$response->setError('JS_PASSWORD_INCORRECT_OLD', 'JS_PASSWORD_INCORRECT_OLD');
}
$response->emit();
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:16,代码来源:SaveAjax.php
示例15: getRecordData
public function getRecordData($moduleName, $recordId)
{
${"GLOBALS"}["yhkvuqi"] = "moduleName";
include_once "include/Webservices/Retrieve.php";
include_once "include/Webservices/Utils.php";
${"GLOBALS"}["rwzcgorvwd"] = "modelData";
if (${${"GLOBALS"}["yhkvuqi"]} == "Calendar") {
${${"GLOBALS"}["qdpmrziapjb"]} = vtws_getCalendarEntityType(${${"GLOBALS"}["kpdkgyrhwuc"]});
}
try {
${"GLOBALS"}["zwvujejhu"] = "recordId";
${${"GLOBALS"}["tykmttbjma"]} = vtws_getWebserviceEntityId(${${"GLOBALS"}["qdpmrziapjb"]}, ${${"GLOBALS"}["zwvujejhu"]});
${${"GLOBALS"}["cnbxfeulpcc"]} = vtws_retrieve(${${"GLOBALS"}["tykmttbjma"]}, vglobal("current_user"));
} catch (WebServiceException $ex) {
echo "getRecordData Error: " . $ex->getMessage();
}
return ${${"GLOBALS"}["rwzcgorvwd"]};
}
开发者ID:Wasage,项目名称:werpa,代码行数:18,代码来源:LoadData.php
示例16: execute
public function execute($moduleName, $record, $ids)
{
vimport('~~modules/com_vtiger_workflow/VTEntityCache.inc');
vimport('~~modules/com_vtiger_workflow/include.inc');
vimport('~~include/Webservices/Utils.php');
vimport('~~include/Webservices/Retrieve.php');
$currentUser = Users_Record_Model::getCurrentUserModel();
$wsId = vtws_getWebserviceEntityId($moduleName, $record);
$adb = PearDatabase::getInstance();
$wfs = new VTWorkflowManager($adb);
$entityCache = new VTEntityCache($currentUser);
$entityData = $entityCache->forId($wsId);
foreach ($ids as $id) {
$workflow = $wfs->retrieve($id);
if ($workflow->evaluate($entityCache, $entityData->getId())) {
$workflow->performTasks($entityData);
}
}
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:19,代码来源:WorkflowTrigger.php
示例17: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$ownerId = $request->get('userid');
$newOwnerId = $request->get('transfer_user_id');
if ($request->get('mode') == 'permanent') {
Users_Record_Model::deleteUserPermanently($ownerId, $newOwnerId);
} else {
$userId = vtws_getWebserviceEntityId($moduleName, $ownerId);
$transformUserId = vtws_getWebserviceEntityId($moduleName, $newOwnerId);
$userModel = Users_Record_Model::getCurrentUserModel();
vtws_deleteUser($userId, $transformUserId, $userModel);
if ($request->get('permanent') == '1') {
Users_Record_Model::deleteUserPermanently($ownerId, $newOwnerId);
}
}
$response = new Vtiger_Response();
$response->setResult(array('message' => vtranslate('LBL_USER_DELETED_SUCCESSFULLY', $moduleName)));
$response->emit();
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:20,代码来源:DeleteAjax.php
示例18: wsapp_getRecordEntityNameIds
function wsapp_getRecordEntityNameIds($entityNames, $modules, $user)
{
$entityMetaList = array();
$db = PearDatabase::getInstance();
if (empty($entityNames)) {
return;
}
if (!is_array($entityNames)) {
$entityNames = array($entityNames);
}
if (empty($modules)) {
return array();
}
if (!is_array($modules)) {
$modules = array($modules);
}
$entityNameIds = array();
foreach ($modules as $moduleName) {
if (empty($entityMetaList[$moduleName])) {
$handler = vtws_getModuleHandlerFromName($moduleName, $user);
$meta = $handler->getMeta();
$entityMetaList[$moduleName] = $meta;
}
$meta = $entityMetaList[$moduleName];
$nameFieldsArray = explode(",", $meta->getNameFields());
if (count($nameFieldsArray) > 1) {
$nameFields = "concat(" . implode(",' ',", $nameFieldsArray) . ")";
} else {
$nameFields = $nameFieldsArray[0];
}
$query = "SELECT " . $meta->getObectIndexColumn() . " as id,{$nameFields} as entityname FROM " . $meta->getEntityBaseTable() . " as moduleentity INNER JOIN vtiger_crmentity as crmentity WHERE {$nameFields} IN(" . generateQuestionMarks($entityNames) . ") AND crmentity.deleted=0 AND crmentity.crmid = moduleentity." . $meta->getObectIndexColumn() . "";
$result = $db->pquery($query, $entityNames);
$num_rows = $db->num_rows($result);
for ($i = 0; $i < $num_rows; $i++) {
$id = $db->query_result($result, $i, 'id');
$entityName = $db->query_result($result, $i, 'entityname');
$entityNameIds[decode_html($entityName)] = vtws_getWebserviceEntityId($moduleName, $id);
}
}
return $entityNameIds;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:41,代码来源:Utils.php
示例19: handleEvent
function handleEvent($eventName, $entityData)
{
$moduleName = $entityData->getModuleName();
// Validate the event target
if ($moduleName != 'PurchaseOrder') {
return;
}
//Get Current User Information
global $current_user, $currentModule;
/**
* Adjust the balance amount against total & paid amount
* NOTE: beforesave the total amount will not be populated in event data.
*/
if ($eventName == 'vtiger.entity.aftersave') {
if ($currentModule != 'PurchaseOrder') {
return;
}
$entityDelta = new VTEntityDelta();
$oldCurrency = $entityDelta->getOldValue($entityData->getModuleName(), $entityData->getId(), 'currency_id');
$oldConversionRate = $entityDelta->getOldValue($entityData->getModuleName(), $entityData->getId(), 'conversion_rate');
$newCurrency = $entityDelta->getCurrentValue($entityData->getModuleName(), $entityData->getId(), 'currency_id');
$db = PearDatabase::getInstance();
$wsid = vtws_getWebserviceEntityId('PurchaseOrder', $entityData->getId());
$wsrecord = vtws_retrieve($wsid, $current_user);
if ($oldCurrency != $newCurrency && $oldCurrency != '') {
if ($oldConversionRate != '') {
$wsrecord['paid'] = floatval($wsrecord['paid'] / $oldConversionRate * $wsrecord['conversion_rate']);
}
}
/*
$wsrecord['balance'] = floatval($wsrecord['hdnGrandTotal'] - $wsrecord['paid']);
if ($wsrecord['balance'] == 0)
$wsrecord['postatus'] = 'Received Shipment';
$query = "UPDATE vtiger_purchaseorder SET balance=?,paid=? WHERE purchaseorderid=?";
$db->pquery($query, array($wsrecord['balance'], $wsrecord['paid'], $entityData->getId()));
// TODO Make it available for other event handlers
*/
}
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:39,代码来源:PurchaseOrderHandler.php
示例20: transformToSourceRecord
/**
* Tarsform Google Records to Vtiger Records
* @param <array> $targetRecords
* @return <array> tranformed Google Records
*/
public function transformToSourceRecord($targetRecords)
{
$entity = array();
$contacts = array();
foreach ($targetRecords as $googleRecord) {
if ($googleRecord->getMode() != WSAPP_SyncRecordModel::WSAPP_DELETE_MODE) {
$user = Users_Record_Model::getCurrentUserModel();
$entity['assigned_user_id'] = vtws_getWebserviceEntityId('Users', $user->id);
$entity['lastname'] = $googleRecord->getLastName();
$entity['firstname'] = $googleRecord->getFirstName();
$emails = $googleRecord->getEmails();
$entity['email'] = $emails[0];
$phones = $googleRecord->getPhones();
$entity['mobile'] = $phones[0];
$addresses = $googleRecord->getAddresses();
$entity['mailingstreet'] = $addresses[0];
if (empty($entity['lastname'])) {
if (!empty($entity['firstname'])) {
$entity['lastname'] = $entity['firstname'];
} else {
if (empty($entity['firstname']) && !empty($entity['email'])) {
$entity['lastname'] = $entity['email'];
} else {
if (!empty($entity['mobile']) || !empty($entity['mailingstreet'])) {
$entity['lastname'] = 'Google Contact';
} else {
continue;
}
}
}
}
}
$contact = $this->getSynchronizeController()->getSourceRecordModel($entity);
$contact = $this->performBasicTransformations($googleRecord, $contact);
$contact = $this->performBasicTransformationsToSourceRecords($contact, $googleRecord);
$contacts[] = $contact;
}
return $contacts;
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:44,代码来源:Contacts.php
注:本文中的vtws_getWebserviceEntityId函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论