本文整理汇总了PHP中vtws_getIdComponents函数的典型用法代码示例。如果您正苦于以下问题:PHP vtws_getIdComponents函数的具体用法?PHP vtws_getIdComponents怎么用?PHP vtws_getIdComponents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtws_getIdComponents函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: vtws_retrieve
function vtws_retrieve($id, $user)
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes(null, $user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($meta->hasReadAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$RETRIEVE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
$idComponents = vtws_getIdComponents($id);
if (!$meta->exists($idComponents[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
}
$entity = $handler->retrieve($id);
VTWS_PreserveGlobal::flush();
return $entity;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:32,代码来源:Retrieve.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: vtws_changePassword
/**
*
* @param WebserviceId $id
* @param String $oldPassword
* @param String $newPassword
* @param String $confirmPassword
* @param Users $user
*
*/
function vtws_changePassword($id, $oldPassword, $newPassword, $confirmPassword, $user)
{
vtws_preserveGlobal('current_user', $user);
$idComponents = vtws_getIdComponents($id);
if ($idComponents[1] == $user->id || is_admin($user)) {
$newUser = new Users();
$newUser->retrieve_entity_info($idComponents[1], 'Users');
if (!is_admin($user)) {
if (empty($oldPassword)) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDOLDPASSWORD, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$INVALIDOLDPASSWORD));
}
if (!$user->verifyPassword($oldPassword)) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDOLDPASSWORD, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$INVALIDOLDPASSWORD));
}
}
if (strcmp($newPassword, $confirmPassword) === 0) {
$success = $newUser->change_password($oldPassword, $newPassword);
$error = $newUser->db->hasFailedTransaction();
if ($error) {
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$DATABASEQUERYERROR));
}
if (!$success) {
throw new WebServiceException(WebServiceErrorCode::$CHANGEPASSWORDFAILURE, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$CHANGEPASSWORDFAILURE));
}
} else {
throw new WebServiceException(WebServiceErrorCode::$CHANGEPASSWORDFAILURE, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$CHANGEPASSWORDFAILURE));
}
VTWS_PreserveGlobal::flush();
return array('message' => 'Changed password successfully');
}
}
开发者ID:vinzdrance,项目名称:YetiForceCRM,代码行数:40,代码来源:ChangePassword.php
示例4: vtws_update
function vtws_update($element, $user)
{
global $log, $adb;
$idList = vtws_getIdComponents($element['id']);
$webserviceObject = VtigerWebserviceObject::fromId($adb, $idList[0]);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($element['id']);
$types = vtws_listtypes($user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$UPDATE, $element['id'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
if (!$meta->exists($idList[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
}
if ($meta->hasWriteAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
$referenceFields = $meta->getReferenceFieldDetails();
foreach ($referenceFields as $fieldName => $details) {
if (isset($element[$fieldName]) && strlen($element[$fieldName]) > 0) {
$ids = vtws_getIdComponents($element[$fieldName]);
$elemTypeId = $ids[0];
$elemId = $ids[1];
$referenceObject = VtigerWebserviceObject::fromId($adb, $elemTypeId);
if (!in_array($referenceObject->getEntityName(), $details)) {
throw new WebServiceException(WebServiceErrorCode::$REFERENCEINVALID, "Invalid reference specified for {$fieldName}");
}
if (!in_array($referenceObject->getEntityName(), $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to access reference type is denied " . $referenceObject->getEntityName());
}
} else {
if ($element[$fieldName] !== NULL) {
unset($element[$fieldName]);
}
}
}
$meta->hasMandatoryFields($element);
$ownerFields = $meta->getOwnerFields();
if (is_array($ownerFields) && sizeof($ownerFields) > 0) {
foreach ($ownerFields as $ownerField) {
if (isset($element[$ownerField]) && $element[$ownerField] !== null && !$meta->hasAssignPrivilege($element[$ownerField])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Cannot assign record to the given user");
}
}
}
$entity = $handler->update($element);
VTWS_PreserveGlobal::flush();
return $entity;
}
开发者ID:hardikk,项目名称:HNH,代码行数:59,代码来源:Update.php
示例5: vtws_retrieve
function vtws_retrieve($id, $user)
{
global $log, $adb;
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes(null, $user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($meta->hasReadAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$RETRIEVE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
$idComponents = vtws_getIdComponents($id);
if (!$meta->exists($idComponents[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
}
$entity = $handler->retrieve($id);
//return product lines
if ($entityName == 'Quotes' || $entityName == 'PurchaseOrder' || $entityName == 'SalesOrder' || $entityName == 'Invoice') {
list($wsid, $recordid) = explode('x', $id);
$result = $adb->pquery('select * from vtiger_inventoryproductrel where id=?', array($recordid));
while ($row = $adb->getNextRow($result, false)) {
if ($row['discount_amount'] == NULL && $row['discount_percent'] == NULL) {
$discount = 0;
$discount_type = 0;
} else {
$discount = 1;
}
if ($row['discount_amount'] == NULL) {
$discount_amount = 0;
} else {
$discount_amount = $row['discount_amount'];
$discount_type = 'amount';
}
if ($row['discount_percent'] == NULL) {
$discount_percent = 0;
} else {
$discount_percent = $row['discount_percent'];
$discount_type = 'percentage';
}
$onlyPrd = array("productid" => $row['productid'], "comment" => $row['comment'], "qty" => $row['quantity'], "listprice" => $row['listprice'], 'discount' => $discount, "discount_type" => $discount_type, "discount_percentage" => $discount_percent, "discount_amount" => $discount_amount);
$entity['pdoInformation'][] = $onlyPrd;
}
}
VTWS_PreserveGlobal::flush();
return $entity;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:58,代码来源:Retrieve.php
示例6: vtws_retrievedocattachment
function vtws_retrievedocattachment($all_ids, $returnfile, $user)
{
global $log, $adb;
$entities = array();
$docWSId = vtyiicpng_getWSEntityId('Documents');
$log->debug("Entering function vtws_retrievedocattachment");
$all_ids = "(" . str_replace($docWSId, '', $all_ids) . ")";
$query = "SELECT n.notesid, n.filename, n.filelocationtype\n FROM vtiger_notes n\n INNER JOIN vtiger_crmentity c ON c.crmid=n.notesid\n WHERE n.notesid in {$all_ids} and n.filelocationtype in ('I','E') and c.deleted=0";
$result = $adb->query($query);
$nr = $adb->num_rows($result);
for ($i = 0; $i < $nr; $i++) {
$id = $docWSId . $adb->query_result($result, $i, 'notesid');
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes(null, $user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($meta->hasReadAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$RETRIEVE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object ({$id}) is denied");
}
$ids = vtws_getIdComponents($id);
if (!$meta->exists($ids[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Document Record you are trying to access is not found");
}
$document_id = $ids[1];
$filetype = $adb->query_result($result, $i, 'filelocationtype');
if ($filetype == 'E') {
$entity["recordid"] = $adb->query_result($result, $i, 'notesid');
$entity["filetype"] = $fileType;
$entity["filename"] = $adb->query_result($result, $i, 'filename');
$entity["filesize"] = 0;
$entity["attachment"] = base64_encode('');
} elseif ($filetype == 'I') {
$entity = vtws_retrievedocattachment_get_attachment($document_id, true, $returnfile);
}
$entities[$id] = $entity;
VTWS_PreserveGlobal::flush();
}
// end for ids
$log->debug("Leaving function vtws_retrievedocattachment");
return $entities;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:54,代码来源:RetrieveDocAttachment.php
示例7: delete
public function delete($id)
{
$ids = vtws_getIdComponents($id);
$elemid = $ids[1];
$crmObject = new VtigerCRMObject($this->tabId, true);
$error = $crmObject->delete($elemid);
if (!$error) {
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, "Database error while performing required operation");
}
return array("status" => "successful");
}
开发者ID:hardikk,项目名称:HNH,代码行数:11,代码来源:VtigerModuleOperation.php
示例8: delete
public function delete($id)
{
$ids = vtws_getIdComponents($id);
$elemid = $ids[1];
$crmObject = new VtigerCRMObject($this->tabId, true);
$error = $crmObject->delete($elemid);
if (!$error) {
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, vtws_getWebserviceTranslatedString('LBL_' . WebServiceErrorCode::$DATABASEQUERYERROR));
}
return array("status" => "successful");
}
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:11,代码来源:VtigerModuleOperation.php
示例9: vtws_retrieve_inventory
/**
* Retrieve inventory record with LineItems
*/
function vtws_retrieve_inventory($id)
{
$current_user = vglobal('current_user');
$record = vtws_retrieve($id, $current_user);
$handler = vtws_getModuleHandlerFromName('LineItem', $user);
$id = vtws_getIdComponents($id);
$id = $id[1];
$inventoryLineItems = $handler->getAllLineItemForParent($id);
$record['LineItems'] = $inventoryLineItems;
return $record;
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:14,代码来源:RetrieveInventory.php
示例10: delete
public function delete($id)
{
$ids = vtws_getIdComponents($id);
$elemId = $ids[1];
$result = null;
$query = 'update ' . $this->entityTableName . ' set deleted=1 where ' . $this->meta->getObectIndexColumn() . '=?';
$transactionSuccessful = vtws_runQueryAsTransaction($query, array($elemId), $result);
if (!$transactionSuccessful) {
throw new WebServiceException(WebServiceErrorCode::$DATABASEQUERYERROR, "Database error while performing required operation");
}
return array("status" => "successful");
}
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:12,代码来源:VtigerTaxOperation.php
示例11: cbws_getrecordimageinfo
function cbws_getrecordimageinfo($id, $user)
{
global $log, $adb, $site_URL;
$log->debug("Entering function cbws_getrecordimageinfo({$id})");
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes(null, $user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied");
}
if ($meta->hasReadAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read entity is denied");
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$RETRIEVE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
$idComponents = vtws_getIdComponents($id);
if (!$meta->exists($idComponents[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found");
}
$ids = vtws_getIdComponents($id);
$pdoid = $ids[1];
$rdo = array();
$query = 'select vtiger_attachments.name, vtiger_attachments.type, vtiger_attachments.attachmentsid, vtiger_attachments.path
from vtiger_attachments
inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_attachments.attachmentsid
inner join vtiger_seattachmentsrel on vtiger_attachments.attachmentsid=vtiger_seattachmentsrel.attachmentsid
where (vtiger_crmentity.setype LIKE "%Image" or vtiger_crmentity.setype LIKE "%Attachment")
and deleted=0 and vtiger_seattachmentsrel.crmid=?';
$result_image = $adb->pquery($query, array($pdoid));
$rdo['results'] = $adb->num_rows($result_image);
$rdo['images'] = array();
while ($img = $adb->fetch_array($result_image)) {
$imga = array();
$imga['name'] = $img['name'];
$imga['path'] = $img['path'];
$imga['fullpath'] = $site_URL . '/' . $img['path'] . $img['attachmentsid'] . '_' . $img['name'];
$imga['type'] = $img['type'];
$imga['id'] = $img['attachmentsid'];
$rdo['images'][] = $imga;
}
VTWS_PreserveGlobal::flush();
$log->debug("Leaving function cbws_getrecordimageinfo");
return $rdo;
}
开发者ID:kduqi,项目名称:corebos,代码行数:53,代码来源:getRecordImages.php
示例12: process
function process(Mobile_API_Request $request)
{
global $current_user, $adb, $currentModule;
$current_user = $this->getActiveUser();
$response = new Mobile_API_Response();
$record = $request->get('record');
$relatedmodule = $request->get('relatedmodule');
$currentPage = $request->get('page', 0);
// Input validation
if (empty($record)) {
$response->setError(1001, 'Record id is empty');
return $response;
}
$recordid = vtws_getIdComponents($record);
$recordid = $recordid[1];
$module = Mobile_WS_Utils::detectModulenameFromRecordId($record);
// Initialize global variable
$currentModule = $module;
$functionHandler = Mobile_WS_Utils::getRelatedFunctionHandler($module, $relatedmodule);
if ($functionHandler) {
$sourceFocus = CRMEntity::getInstance($module);
$relationResult = call_user_func_array(array($sourceFocus, $functionHandler), array($recordid, getTabid($module), getTabid($relatedmodule)));
$query = $relationResult['query'];
$querySEtype = "vtiger_crmentity.setype as setype";
if ($relatedmodule == 'Calendar') {
$querySEtype = "vtiger_activity.activitytype as setype";
}
$query = sprintf("SELECT vtiger_crmentity.crmid, {$querySEtype} %s", substr($query, stripos($query, 'FROM')));
$queryResult = $adb->query($query);
// Gather resolved record id's
$relatedRecords = array();
while ($row = $adb->fetch_array($queryResult)) {
$targetSEtype = $row['setype'];
if ($relatedmodule == 'Calendar') {
if ($row['setype'] != 'Task' && $row['setype'] != 'Emails') {
$targetSEtype = 'Events';
} else {
$targetSEtype = $relatedmodule;
}
}
$relatedRecords[] = sprintf("%sx%s", Mobile_WS_Utils::getEntityModuleWSId($targetSEtype), $row['crmid']);
}
// Perform query to get record information with grouping
$wsquery = sprintf("SELECT * FROM %s WHERE id IN ('%s');", $relatedmodule, implode("','", $relatedRecords));
$newRequest = new Mobile_API_Request();
$newRequest->set('module', $relatedmodule);
$newRequest->set('query', $wsquery);
$newRequest->set('page', $currentPage);
$response = parent::process($newRequest);
}
return $response;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:52,代码来源:RelatedRecordsWithGrouping.php
示例13: vtws_internal_setrelation
function vtws_internal_setrelation($elementId, $moduleName, $withTheseIds)
{
global $adb;
if (!is_array($withTheseIds)) {
$withTheseIds = array($withTheseIds);
}
$focus = CRMEntity::getInstance($moduleName);
foreach ($withTheseIds as $withThisId) {
list($withModuleId, $withElementId) = vtws_getIdComponents($withThisId);
$withModuleName = $adb->query_result($adb->pquery('select name from vtiger_ws_entity where id=?', array($withModuleId)), 0, 0);
relateEntities($focus, $moduleName, $elementId, $withModuleName, $withElementId);
}
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:13,代码来源:SetRelation.php
示例14: saveCommentToHelpDesk
function saveCommentToHelpDesk($commentcontent, $record, $user)
{
global $current_user;
$current_user = $user;
$targetModule = 'HelpDesk';
$recordComponents = vtws_getIdComponents($record);
$focus = CRMEntity::getInstance('HelpDesk');
$focus->retrieve_entity_info($recordComponents[1], $targetModule);
$focus->id = $recordComponents[1];
$focus->mode = 'edit';
$focus->column_fields['comments'] = $commentcontent;
$focus->save($targetModule);
return false;
}
开发者ID:kduqi,项目名称:corebos,代码行数:14,代码来源:AddRecordComment.php
示例15: SaveAttachmentDB
/**
* Save the attachment to the database
*/
function SaveAttachmentDB($element)
{
global $adb;
$attachid = $adb->getUniqueId('vtiger_crmentity');
$filename = $element['name'];
$description = $filename;
$date_var = $adb->formatDate(date('YmdHis'), true);
$usetime = $adb->formatDate($date_var, true);
$userid = vtws_getIdComponents($element['assigned_user_id']);
$userid = $userid[1];
$setype = $element['setype'];
$adb->pquery("INSERT INTO vtiger_crmentity(crmid, smcreatorid, smownerid,\n\t\t\t\tmodifiedby, setype, description, createdtime, modifiedtime, presence, deleted)\n\t\t\t\tVALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", array($attachid, $userid, $userid, $userid, $setype, $description, $usetime, $usetime, 1, 0));
SaveAttachmentFile($attachid, $filename, $element['content']);
return $attachid;
}
开发者ID:casati-dolibarr,项目名称:corebos,代码行数:18,代码来源:AttachmentHelper.php
示例16: sanitizeForInsert
function sanitizeForInsert($row, $meta)
{
global $adb;
$associatedToUser = false;
if (strtolower($meta->getEntityName()) == "emails") {
if (isset($row['parent_id'])) {
$components = vtws_getIdComponents($row['parent_id']);
if ($components[0] == VtigerWebserviceObject::fromName($adb, 'Users')) {
$associatedToUser = true;
}
}
}
$references = $meta->getReferenceFieldDetails();
foreach ($references as $field => $typeList) {
if (strpos($row[$field], 'x') !== false) {
$row[$field] = vtws_getIdComponents($row[$field]);
$row[$field] = $row[$field][1];
}
}
$ownerFields = $meta->getOwnerFields();
foreach ($ownerFields as $index => $field) {
if (isset($row[$field]) && $row[$field] != null) {
$ownerDetails = vtws_getIdComponents($row[$field]);
$row[$field] = $ownerDetails[1];
}
}
if (strtolower($meta->getEntityName()) == "emails") {
if (isset($row['parent_id'])) {
if ($associatedToUser === true) {
$_REQUEST['module'] = 'Emails';
$row['parent_id'] = $row['parent_id'] . "@-1|";
$_REQUEST['parent_id'] = $row['parent_id'];
} else {
$emailFields = $meta->getEmailFields();
$fieldId = getEmailFieldId($meta, $row['parent_id'], $emailFields);
$row['parent_id'] = $row['parent_id'] . "@{$fieldId}|";
}
}
}
if ($row["id"]) {
unset($row["id"]);
}
if (isset($row[$meta->getObectIndexColumn()])) {
unset($row[$meta->getObectIndexColumn()]);
}
return $row;
}
开发者ID:vtiger-jp,项目名称:vtigercrm-5.1.x-ja,代码行数:47,代码来源:DataTransform.php
示例17: pullContactsBySupportEndDate
protected function pullContactsBySupportEndDate($feed, $start, $end, &$result, $color = null, $textColor = 'white')
{
$query = "SELECT firstname,lastname,support_end_date FROM Contacts";
$query .= " WHERE support_end_date >= '{$start}' AND support_end_date <= '{$end}'";
$records = $feed->queryForRecords($query);
foreach ($records as $record) {
$item = array();
list($modid, $crmid) = vtws_getIdComponents($record['id']);
$item['id'] = $crmid;
$item['title'] = decode_html(trim($record['firstname'] . ' ' . $record['lastname']));
$item['start'] = $record['support_end_date'];
$item['url'] = sprintf('index.php?module=Contacts&view=Detail&record=%s', $crmid);
$item['color'] = $color;
$item['textColor'] = $textColor;
$result[] = $item;
}
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:17,代码来源:Contacts.php
示例18: process
public function process($feed, $request, $start, $end, &$result, $userid = false, $color = null, $textColor = 'white')
{
$query = "SELECT subject,duedate FROM Invoice";
$query .= " WHERE duedate >= '{$start}' AND duedate <= '{$end}'";
$records = $feed->queryForRecords($query);
foreach ($records as $record) {
$item = array();
list($modid, $crmid) = vtws_getIdComponents($record['id']);
$item['id'] = $crmid;
$item['title'] = decode_html($record['subject']);
$item['start'] = $record['duedate'];
$item['url'] = sprintf('index.php?module=Invoice&view=Detail&record=%s', $crmid);
$item['color'] = $color;
$item['textColor'] = $textColor;
$result[] = $item;
}
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:17,代码来源:Invoice.php
示例19: create
public function create($elementType, $element)
{
$db = PearDatabase::getInstance();
$sql = 'SELECT * FROM vtiger_producttaxrel WHERE productid =? AND taxid=?';
list($typeId, $productId) = vtws_getIdComponents($element['productid']);
list($typeId, $taxId) = vtws_getIdComponents($element['taxid']);
$params = array($productId, $taxId);
$result = $db->pquery($sql, $params);
$rowCount = $db->num_rows($result);
if ($rowCount > 0) {
$id = $db->query_result($result, 0, $this->meta->getObectIndexColumn());
$meta = $this->getMeta();
$element['id'] = vtws_getId($meta->getEntityId(), $id);
return $this->update($element);
} else {
unset($element['id']);
return parent::create($elementType, $element);
}
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:19,代码来源:VtigerProductTaxesOperation.php
示例20: vtws_deleteUser
/**
* @author MAK
*/
function vtws_deleteUser($id, $newOwnerId, $user)
{
global $log, $adb;
$webserviceObject = VtigerWebserviceObject::fromId($adb, $id);
$handlerPath = $webserviceObject->getHandlerPath();
$handlerClass = $webserviceObject->getHandlerClass();
require_once $handlerPath;
$handler = new $handlerClass($webserviceObject, $user, $adb, $log);
$meta = $handler->getMeta();
$entityName = $meta->getObjectEntityName($id);
$types = vtws_listtypes($user);
if (!in_array($entityName, $types['types'])) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to perform the operation is denied, EntityName = " . $entityName);
}
if ($entityName !== $webserviceObject->getEntityName()) {
throw new WebServiceException(WebServiceErrorCode::$INVALIDID, "Id specified is incorrect");
}
if (!$meta->hasPermission(EntityMeta::$DELETE, $id)) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to read given object is denied");
}
$idComponents = vtws_getIdComponents($id);
if (!$meta->exists($idComponents[1])) {
throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND, "Record you are trying to access is not found, idComponent = " . $idComponents);
}
if ($meta->hasWriteAccess() !== true) {
throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED, "Permission to write is denied");
}
$newIdComponents = vtws_getIdComponents($newOwnerId);
if (empty($newIdComponents[1])) {
//force the default user to be the default admin user.
//added cause eazybusiness team is sending this value empty
$newIdComponents[1] = 1;
}
vtws_transferOwnership($idComponents[1], $newIdComponents[1]);
//delete from user vtiger_table;
$sql = "delete from vtiger_users where id=?";
vtws_runQueryAsTransaction($sql, array($idComponents[1]), $result);
VTWS_PreserveGlobal::flush();
return array("status" => "successful");
}
开发者ID:sacredwebsite,项目名称:vtigercrm,代码行数:43,代码来源:DeleteUser.php
注:本文中的vtws_getIdComponents函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论