本文整理汇总了PHP中vtws_getWebserviceEntityId函数的典型用法代码示例。如果您正苦于以下问题:PHP vtws_getWebserviceEntityId函数的具体用法?PHP vtws_getWebserviceEntityId怎么用?PHP vtws_getWebserviceEntityId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtws_getWebserviceEntityId函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
}
示例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;
}
示例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);
}
示例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;
}
示例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');
}
示例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();
}
}
}
示例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;
}
示例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();
}
示例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;
}
}
示例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');
}
示例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>';
}
示例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);
}
示例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();
}
示例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"]};
}